2025-12-04T07:56:46.2553919Z Current runner version: '2.329.0' 2025-12-04T07:56:46.2583115Z ##[group]Runner Image Provisioner 2025-12-04T07:56:46.2584312Z Hosted Compute Agent 2025-12-04T07:56:46.2585262Z Version: 20251124.448 2025-12-04T07:56:46.2586256Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T07:56:46.2587472Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T07:56:46.2588355Z ##[endgroup] 2025-12-04T07:56:46.2589188Z ##[group]Operating System 2025-12-04T07:56:46.2590643Z Ubuntu 2025-12-04T07:56:46.2591484Z 24.04.3 2025-12-04T07:56:46.2592323Z LTS 2025-12-04T07:56:46.2593059Z ##[endgroup] 2025-12-04T07:56:46.2594064Z ##[group]Runner Image 2025-12-04T07:56:46.2594959Z Image: ubuntu-24.04 2025-12-04T07:56:46.2595761Z Version: 20251126.144.1 2025-12-04T07:56:46.2597644Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T07:56:46.2600668Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T07:56:46.2602549Z ##[endgroup] 2025-12-04T07:56:46.2606736Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T07:56:46.2609898Z Actions: read 2025-12-04T07:56:46.2610960Z ArtifactMetadata: read 2025-12-04T07:56:46.2611780Z Attestations: read 2025-12-04T07:56:46.2612736Z Checks: read 2025-12-04T07:56:46.2613471Z Contents: read 2025-12-04T07:56:46.2614234Z Deployments: read 2025-12-04T07:56:46.2615715Z Discussions: read 2025-12-04T07:56:46.2616478Z Issues: read 2025-12-04T07:56:46.2617423Z Metadata: read 2025-12-04T07:56:46.2618221Z Models: read 2025-12-04T07:56:46.2619044Z Packages: read 2025-12-04T07:56:46.2619846Z Pages: read 2025-12-04T07:56:46.2621022Z PullRequests: read 2025-12-04T07:56:46.2621846Z RepositoryProjects: read 2025-12-04T07:56:46.2622839Z SecurityEvents: read 2025-12-04T07:56:46.2623828Z Statuses: read 2025-12-04T07:56:46.2624608Z ##[endgroup] 2025-12-04T07:56:46.2627035Z Secret source: Actions 2025-12-04T07:56:46.2628223Z Prepare workflow directory 2025-12-04T07:56:46.3221061Z Prepare all required actions 2025-12-04T07:56:46.3294177Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T07:56:46.3301603Z ##[group] Inputs 2025-12-04T07:56:46.3302485Z check_experiments: 2025-12-04T07:56:46.3303437Z opt_out_experiments: 2025-12-04T07:56:46.3304388Z triggering_actor: pytorchmergebot 2025-12-04T07:56:46.3305300Z issue_owner: 2025-12-04T07:56:46.3306151Z curr_branch: main 2025-12-04T07:56:46.3307000Z curr_ref_type: branch 2025-12-04T07:56:46.3307817Z issue_number: 5132 2025-12-04T07:56:46.3308782Z ##[endgroup] 2025-12-04T07:56:46.3309591Z Complete job name: get-label-type / runner-determinator 2025-12-04T07:56:46.4089552Z ##[group]Run cat < runner_determinator.py 2025-12-04T07:56:46.4092663Z cat < runner_determinator.py 2025-12-04T07:56:46.4093645Z # flake8: noqa: G004 2025-12-04T07:56:46.4094624Z  2025-12-04T07:56:46.4095693Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T07:56:46.4097362Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T07:56:46.4098967Z # python .github/scripts/update_runner_determinator.py 2025-12-04T07:56:46.4100198Z  2025-12-04T07:56:46.4100919Z """ 2025-12-04T07:56:46.4102047Z This runner determinator is used to determine which set of runners to run a 2025-12-04T07:56:46.4103592Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T07:56:46.4105423Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T07:56:46.4106980Z of which runners should be used to run which job. 2025-12-04T07:56:46.4108033Z  2025-12-04T07:56:46.4109138Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T07:56:46.4111032Z separated by a line containing "---". If the line is not present, the 2025-12-04T07:56:46.4112805Z settings are considered to be empty with only the second part, the user 2025-12-04T07:56:46.4114247Z list, defined. 2025-12-04T07:56:46.4115036Z  2025-12-04T07:56:46.4115991Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T07:56:46.4117772Z used to define any settings that are needed to determine which runners to use. 2025-12-04T07:56:46.4119238Z It's fields are defined by the RolloutSettings class below. 2025-12-04T07:56:46.4120643Z  2025-12-04T07:56:46.4121810Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T07:56:46.4123311Z The user list is also a comma separated list of additional features or 2025-12-04T07:56:46.4124790Z experiments which the user could be opted in to. 2025-12-04T07:56:46.4125790Z  2025-12-04T07:56:46.4126513Z The user list has the following rules: 2025-12-04T07:56:46.4127437Z  2025-12-04T07:56:46.4128462Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T07:56:46.4129942Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T07:56:46.4131592Z - A "#" prefix opts the user out of all experiments 2025-12-04T07:56:46.4132615Z  2025-12-04T07:56:46.4133228Z Example config: 2025-12-04T07:56:46.4134249Z  # A list of experiments that can be opted into. 2025-12-04T07:56:46.4135567Z  # This defines the behavior they'll induce when opted into. 2025-12-04T07:56:46.4136635Z  # Expected syntax is: 2025-12-04T07:56:46.4138019Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T07:56:46.4139672Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T07:56:46.4141272Z  2025-12-04T07:56:46.4142009Z  experiments: 2025-12-04T07:56:46.4142841Z  lf: 2025-12-04T07:56:46.4143592Z  rollout_percent: 25 2025-12-04T07:56:46.4144611Z  all_branches: false 2025-12-04T07:56:46.4145511Z  default: true 2025-12-04T07:56:46.4146266Z  --- 2025-12-04T07:56:46.4147078Z  2025-12-04T07:56:46.4147934Z  # Opt-ins: 2025-12-04T07:56:46.4149008Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T07:56:46.4151143Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T07:56:46.4152550Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T07:56:46.4153855Z  # Experiments should be from the above list. 2025-12-04T07:56:46.4155103Z  2025-12-04T07:56:46.4155816Z  @User1,-lf,split_build 2025-12-04T07:56:46.4156730Z  @User2,lf 2025-12-04T07:56:46.4157698Z  @User3,split_build 2025-12-04T07:56:46.4158633Z """ 2025-12-04T07:56:46.4159307Z  2025-12-04T07:56:46.4160345Z import json 2025-12-04T07:56:46.4161255Z import logging 2025-12-04T07:56:46.4162081Z import os 2025-12-04T07:56:46.4163009Z import random 2025-12-04T07:56:46.4163764Z import re 2025-12-04T07:56:46.4164549Z import sys 2025-12-04T07:56:46.4165630Z from argparse import ArgumentParser 2025-12-04T07:56:46.4166735Z from collections.abc import Iterable 2025-12-04T07:56:46.4167734Z from functools import cache 2025-12-04T07:56:46.4168911Z from logging import LogRecord 2025-12-04T07:56:46.4169958Z from typing import Any, NamedTuple 2025-12-04T07:56:46.4171298Z from urllib.request import Request, urlopen 2025-12-04T07:56:46.4172577Z  2025-12-04T07:56:46.4173548Z import yaml 2025-12-04T07:56:46.4174362Z from github import Auth, Github 2025-12-04T07:56:46.4175481Z from github.Issue import Issue 2025-12-04T07:56:46.4176509Z  2025-12-04T07:56:46.4177264Z  2025-12-04T07:56:46.4178165Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T07:56:46.4179577Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T07:56:46.4181434Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T07:56:46.4182939Z  2025-12-04T07:56:46.4183832Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T07:56:46.4184999Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T07:56:46.4186302Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T07:56:46.4187460Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T07:56:46.4188470Z  2025-12-04T07:56:46.4189316Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T07:56:46.4190687Z  2025-12-04T07:56:46.4191412Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T07:56:46.4192530Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T07:56:46.4193487Z  2025-12-04T07:56:46.4194179Z  2025-12-04T07:56:46.4195079Z class Experiment(NamedTuple): 2025-12-04T07:56:46.4196017Z  rollout_perc: float = ( 2025-12-04T07:56:46.4197472Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T07:56:46.4198825Z  ) 2025-12-04T07:56:46.4199608Z  all_branches: bool = ( 2025-12-04T07:56:46.4201216Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T07:56:46.4202566Z  ) 2025-12-04T07:56:46.4203332Z  default: bool = ( 2025-12-04T07:56:46.4204512Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T07:56:46.4205858Z  ) 2025-12-04T07:56:46.4206565Z  2025-12-04T07:56:46.4207369Z  # Add more fields as needed 2025-12-04T07:56:46.4208371Z  2025-12-04T07:56:46.4209082Z  2025-12-04T07:56:46.4209958Z class Settings(NamedTuple): 2025-12-04T07:56:46.4211068Z  """ 2025-12-04T07:56:46.4212075Z  Settings for the experiments that can be opted into. 2025-12-04T07:56:46.4213303Z  """ 2025-12-04T07:56:46.4214081Z  2025-12-04T07:56:46.4214824Z  experiments: dict[str, Experiment] = {} 2025-12-04T07:56:46.4216021Z  2025-12-04T07:56:46.4217003Z  2025-12-04T07:56:46.4217810Z class ColorFormatter(logging.Formatter): 2025-12-04T07:56:46.4279116Z  """Color codes the log messages based on the log level""" 2025-12-04T07:56:46.4280357Z  2025-12-04T07:56:46.4280923Z  COLORS = { 2025-12-04T07:56:46.4281615Z  "WARNING": "\033[33m", # Yellow 2025-12-04T07:56:46.4282477Z  "ERROR": "\033[31m", # Red 2025-12-04T07:56:46.4283348Z  "CRITICAL": "\033[31m", # Red 2025-12-04T07:56:46.4284224Z  "INFO": "\033[0m", # Reset 2025-12-04T07:56:46.4285031Z  "DEBUG": "\033[0m", # Reset 2025-12-04T07:56:46.4285779Z  } 2025-12-04T07:56:46.4286357Z  2025-12-04T07:56:46.4287044Z  def format(self, record: LogRecord) -> str: 2025-12-04T07:56:46.4288238Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T07:56:46.4289491Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T07:56:46.4290797Z  return super().format(record) 2025-12-04T07:56:46.4291583Z  2025-12-04T07:56:46.4292101Z  2025-12-04T07:56:46.4292705Z handler = logging.StreamHandler() 2025-12-04T07:56:46.4293934Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T07:56:46.4295298Z  2025-12-04T07:56:46.4296021Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T07:56:46.4296991Z log.addHandler(handler) 2025-12-04T07:56:46.4297750Z log.setLevel(logging.INFO) 2025-12-04T07:56:46.4298461Z  2025-12-04T07:56:46.4298971Z  2025-12-04T07:56:46.4299715Z def set_github_output(key: str, value: str) -> None: 2025-12-04T07:56:46.4300843Z  """ 2025-12-04T07:56:46.4301682Z  Defines outputs of the github action that invokes this script 2025-12-04T07:56:46.4302691Z  """ 2025-12-04T07:56:46.4303322Z  if not GITHUB_OUTPUT: 2025-12-04T07:56:46.4305076Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T07:56:46.4306878Z  log.warning( 2025-12-04T07:56:46.4308292Z  "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:46.4309764Z  ) 2025-12-04T07:56:46.4310753Z  print(f"::set-output name={key}::{value}") 2025-12-04T07:56:46.4311604Z  return 2025-12-04T07:56:46.4312210Z  2025-12-04T07:56:46.4312821Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T07:56:46.4313770Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T07:56:46.4314666Z  f.write(f"{key}={value}\n") 2025-12-04T07:56:46.4315418Z  2025-12-04T07:56:46.4315964Z  2025-12-04T07:56:46.4316855Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T07:56:46.4317982Z  return frozenset( 2025-12-04T07:56:46.4319072Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T07:56:46.4320462Z  ) 2025-12-04T07:56:46.4321097Z  2025-12-04T07:56:46.4321664Z  2025-12-04T07:56:46.4322267Z def parse_args() -> Any: 2025-12-04T07:56:46.4323270Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T07:56:46.4324813Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T07:56:46.4326115Z  parser.add_argument( 2025-12-04T07:56:46.4326936Z  "--github-issue-repo", 2025-12-04T07:56:46.4327796Z  type=str, 2025-12-04T07:56:46.4328546Z  required=False, 2025-12-04T07:56:46.4329589Z  default="pytorch/test-infra", 2025-12-04T07:56:46.4330740Z  help="GitHub repo to get the issue", 2025-12-04T07:56:46.4331645Z  ) 2025-12-04T07:56:46.4332312Z  parser.add_argument( 2025-12-04T07:56:46.4333109Z  "--github-repo", 2025-12-04T07:56:46.4333888Z  type=str, 2025-12-04T07:56:46.4334633Z  required=True, 2025-12-04T07:56:46.4335539Z  help="GitHub repo where CI is running", 2025-12-04T07:56:46.4336417Z  ) 2025-12-04T07:56:46.4337046Z  parser.add_argument( 2025-12-04T07:56:46.4338151Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T07:56:46.4339304Z  ) 2025-12-04T07:56:46.4339956Z  parser.add_argument( 2025-12-04T07:56:46.4341286Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T07:56:46.4342506Z  ) 2025-12-04T07:56:46.4343157Z  parser.add_argument( 2025-12-04T07:56:46.4344291Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T07:56:46.4345515Z  ) 2025-12-04T07:56:46.4346172Z  parser.add_argument( 2025-12-04T07:56:46.4347573Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T07:56:46.4348821Z  ) 2025-12-04T07:56:46.4349491Z  parser.add_argument( 2025-12-04T07:56:46.4350504Z  "--github-ref-type", 2025-12-04T07:56:46.4351262Z  type=str, 2025-12-04T07:56:46.4351947Z  required=True, 2025-12-04T07:56:46.4352881Z  help="Current GitHub ref type, branch or tag", 2025-12-04T07:56:46.4353770Z  ) 2025-12-04T07:56:46.4354357Z  parser.add_argument( 2025-12-04T07:56:46.4355135Z  "--eligible-experiments", 2025-12-04T07:56:46.4356039Z  type=_str_comma_separated_to_set, 2025-12-04T07:56:46.4356860Z  required=False, 2025-12-04T07:56:46.4357572Z  default="", 2025-12-04T07:56:46.4358980Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T07:56:46.4360692Z  ) 2025-12-04T07:56:46.4361286Z  parser.add_argument( 2025-12-04T07:56:46.4362072Z  "--opt-out-experiments", 2025-12-04T07:56:46.4362951Z  type=_str_comma_separated_to_set, 2025-12-04T07:56:46.4363770Z  required=False, 2025-12-04T07:56:46.4364470Z  default="", 2025-12-04T07:56:46.4365136Z  help=( 2025-12-04T07:56:46.4366272Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T07:56:46.4368083Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T07:56:46.4369434Z  ), 2025-12-04T07:56:46.4370219Z  ) 2025-12-04T07:56:46.4370813Z  parser.add_argument( 2025-12-04T07:56:46.4371551Z  "--pr-number", 2025-12-04T07:56:46.4372296Z  type=str, 2025-12-04T07:56:46.4372984Z  required=False, 2025-12-04T07:56:46.4373685Z  default="", 2025-12-04T07:56:46.4374491Z  help="the optional PR number where this is run", 2025-12-04T07:56:46.4375395Z  ) 2025-12-04T07:56:46.4375959Z  2025-12-04T07:56:46.4376540Z  return parser.parse_args() 2025-12-04T07:56:46.4377270Z  2025-12-04T07:56:46.4377802Z  2025-12-04T07:56:46.4378773Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T07:56:46.4380337Z  auth = Auth.Token(github_token) 2025-12-04T07:56:46.4381182Z  return Github(auth=auth) 2025-12-04T07:56:46.4381956Z  2025-12-04T07:56:46.4382485Z  2025-12-04T07:56:46.4383502Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T07:56:46.4384918Z  repo = gh.get_repo(repo) 2025-12-04T07:56:46.4385845Z  return repo.get_issue(number=issue_num) 2025-12-04T07:56:46.4386719Z  2025-12-04T07:56:46.4387261Z  2025-12-04T07:56:46.4387887Z def get_potential_pr_author( 2025-12-04T07:56:46.4389033Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T07:56:46.4390389Z ) -> str: 2025-12-04T07:56:46.4391330Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T07:56:46.4392736Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T07:56:46.4394038Z  # embedded in the tag name: ciflow// 2025-12-04T07:56:46.4395035Z  2025-12-04T07:56:46.4395679Z  gh = get_gh_client(github_token) 2025-12-04T07:56:46.4396502Z  2025-12-04T07:56:46.4397283Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T07:56:46.4398637Z  split_tag = ref_name.split("/") 2025-12-04T07:56:46.4399487Z  if ( 2025-12-04T07:56:46.4400357Z  len(split_tag) == 3 2025-12-04T07:56:46.4401233Z  and split_tag[0] == "ciflow" 2025-12-04T07:56:46.4402162Z  and split_tag[2].isnumeric() 2025-12-04T07:56:46.4402994Z  ): 2025-12-04T07:56:46.4403686Z  pr_number = split_tag[2] 2025-12-04T07:56:46.4404553Z  try: 2025-12-04T07:56:46.4405333Z  repository = gh.get_repo(repo) 2025-12-04T07:56:46.4406397Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T07:56:46.4407466Z  except Exception as e: 2025-12-04T07:56:46.4408385Z  raise Exception( # noqa: TRY002 2025-12-04T07:56:46.4409537Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T07:56:46.4410943Z  ) from e 2025-12-04T07:56:46.4411918Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T07:56:46.4413158Z  # In all other cases, return the original input username 2025-12-04T07:56:46.4414188Z  return username 2025-12-04T07:56:46.4414898Z  2025-12-04T07:56:46.4415458Z  2025-12-04T07:56:46.4416186Z def is_exception_branch(branch: str) -> bool: 2025-12-04T07:56:46.4417105Z  """ 2025-12-04T07:56:46.4418238Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T07:56:46.4419576Z  """ 2025-12-04T07:56:46.4420717Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T07:56:46.4421848Z  2025-12-04T07:56:46.4422448Z  2025-12-04T07:56:46.4423089Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T07:56:46.4423946Z  try: 2025-12-04T07:56:46.4424626Z  data = yaml.safe_load(yaml_text) 2025-12-04T07:56:46.4425532Z  return data 2025-12-04T07:56:46.4426295Z  except yaml.YAMLError: 2025-12-04T07:56:46.4427157Z  log.exception("Error loading YAML") 2025-12-04T07:56:46.4428059Z  raise 2025-12-04T07:56:46.4428722Z  2025-12-04T07:56:46.4429278Z  2025-12-04T07:56:46.4430506Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T07:56:46.4431809Z  """ 2025-12-04T07:56:46.4433105Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T07:56:46.4434411Z  2025-12-04T07:56:46.4435327Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:46.4436628Z  and the text below is the list of opted in users. 2025-12-04T07:56:46.4437602Z  2025-12-04T07:56:46.4438567Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T07:56:46.4439768Z  """ 2025-12-04T07:56:46.4440772Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T07:56:46.4441802Z  if len(rollout_state_parts) >= 2: 2025-12-04T07:56:46.4442875Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T07:56:46.4443911Z  else: 2025-12-04T07:56:46.4444589Z  return "", rollout_state 2025-12-04T07:56:46.4445372Z  2025-12-04T07:56:46.4445946Z  2025-12-04T07:56:46.4446642Z class UserOptins(dict[str, list[str]]): 2025-12-04T07:56:46.4447516Z  """ 2025-12-04T07:56:46.4448425Z  Dictionary of users with a list of features they have opted into 2025-12-04T07:56:46.4449539Z  """ 2025-12-04T07:56:46.4450364Z  2025-12-04T07:56:46.4451134Z  2025-12-04T07:56:46.4452036Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T07:56:46.4453247Z  """ 2025-12-04T07:56:46.4454497Z  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:46.4455944Z  2025-12-04T07:56:46.4457322Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T07:56:46.4459049Z  - Example line: "@User1,lf,split_build" 2025-12-04T07:56:46.4460419Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T07:56:46.4461500Z  2025-12-04T07:56:46.4462080Z  2025-12-04T07:56:46.4462639Z  """ 2025-12-04T07:56:46.4463277Z  optins = UserOptins() 2025-12-04T07:56:46.4464150Z  for user in user_optin_text.split("\n"): 2025-12-04T07:56:46.4465147Z  user = user.strip("\r\n\t -") 2025-12-04T07:56:46.4466105Z  if not user or not user.startswith("@"): 2025-12-04T07:56:46.4467056Z  # Not a valid user. Skip 2025-12-04T07:56:46.4467908Z  continue 2025-12-04T07:56:46.4468622Z  2025-12-04T07:56:46.4469197Z  if user: 2025-12-04T07:56:46.4470155Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T07:56:46.4471373Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T07:56:46.4472450Z  2025-12-04T07:56:46.4473047Z  return optins 2025-12-04T07:56:46.4473732Z  2025-12-04T07:56:46.4474313Z  2025-12-04T07:56:46.4475150Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T07:56:46.4476190Z  """ 2025-12-04T07:56:46.4476908Z  Check if the experiment name is valid. 2025-12-04T07:56:46.4477831Z  A valid name: 2025-12-04T07:56:46.4478975Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T07:56:46.4480866Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T07:56:46.4482094Z  - Cannot contain spaces 2025-12-04T07:56:46.4483096Z  """ 2025-12-04T07:56:46.4483863Z  2025-12-04T07:56:46.4484659Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T07:56:46.4485875Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T07:56:46.4487126Z  2025-12-04T07:56:46.4487737Z  if valid: 2025-12-04T07:56:46.4488420Z  return True 2025-12-04T07:56:46.4489109Z  2025-12-04T07:56:46.4489686Z  log.error( 2025-12-04T07:56:46.4492413Z  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:46.4495045Z  ) 2025-12-04T07:56:46.4495672Z  return False 2025-12-04T07:56:46.4496369Z  2025-12-04T07:56:46.4496932Z  2025-12-04T07:56:46.4497783Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T07:56:46.4498859Z  """ 2025-12-04T07:56:46.4499918Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T07:56:46.4501321Z  """ 2025-12-04T07:56:46.4501943Z  try: 2025-12-04T07:56:46.4502599Z  if settings_text: 2025-12-04T07:56:46.4503885Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T07:56:46.4505233Z  # for easy reading 2025-12-04T07:56:46.4506875Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T07:56:46.4508415Z  # the backtick character in shell commands. 2025-12-04T07:56:46.4509474Z  backtick = chr(96) # backtick character 2025-12-04T07:56:46.4510807Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T07:56:46.4511974Z  settings = load_yaml(settings_text) 2025-12-04T07:56:46.4512850Z  2025-12-04T07:56:46.4513855Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T07:56:46.4515146Z  experiments = {} 2025-12-04T07:56:46.4515925Z  2025-12-04T07:56:46.4516853Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T07:56:46.4518186Z  if not is_valid_experiment_name(exp_name): 2025-12-04T07:56:46.4520231Z  # 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:46.4522023Z  continue 2025-12-04T07:56:46.4522790Z  2025-12-04T07:56:46.4523399Z  valid_settings = {} 2025-12-04T07:56:46.4524326Z  for setting in exp_settings: 2025-12-04T07:56:46.4525286Z  if setting not in Experiment._fields: 2025-12-04T07:56:46.4526227Z  log.warning( 2025-12-04T07:56:46.4527482Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T07:56:46.4528683Z  ) 2025-12-04T07:56:46.4529436Z  else: 2025-12-04T07:56:46.4530634Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T07:56:46.4531617Z  2025-12-04T07:56:46.4532386Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T07:56:46.4533485Z  return Settings(experiments) 2025-12-04T07:56:46.4534312Z  2025-12-04T07:56:46.4534901Z  except Exception: 2025-12-04T07:56:46.4535756Z  log.exception("Failed to parse settings") 2025-12-04T07:56:46.4536663Z  2025-12-04T07:56:46.4537261Z  return Settings() 2025-12-04T07:56:46.4537969Z  2025-12-04T07:56:46.4538530Z  2025-12-04T07:56:46.4539527Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T07:56:46.4540713Z  """ 2025-12-04T07:56:46.4541471Z  Parse settings, if any, from the rollout state. 2025-12-04T07:56:46.4542405Z  2025-12-04T07:56:46.4543313Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:46.4544616Z  and the text below is the list of opted in users. 2025-12-04T07:56:46.4545577Z  2025-12-04T07:56:46.4546581Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T07:56:46.4547802Z  """ 2025-12-04T07:56:46.4548799Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:46.4550282Z  return parse_settings_from_text(settings_text) 2025-12-04T07:56:46.4551227Z  2025-12-04T07:56:46.4551793Z  2025-12-04T07:56:46.4552554Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T07:56:46.4553577Z  """ 2025-12-04T07:56:46.4554272Z  Parse users from the rollout state. 2025-12-04T07:56:46.4555147Z  2025-12-04T07:56:46.4555702Z  """ 2025-12-04T07:56:46.4556635Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:46.4558133Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T07:56:46.4559075Z  2025-12-04T07:56:46.4559622Z  2025-12-04T07:56:46.4560836Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:46.4562142Z  """ 2025-12-04T07:56:46.4562881Z  Check if a user is opted into an experiment 2025-12-04T07:56:46.4563775Z  """ 2025-12-04T07:56:46.4564592Z  return experiment_name in user_optins.get(user, []) 2025-12-04T07:56:46.4565597Z  2025-12-04T07:56:46.4566147Z  2025-12-04T07:56:46.4567207Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:46.4568503Z  """ 2025-12-04T07:56:46.4569315Z  Check if a user explicitly opted out of an experiment 2025-12-04T07:56:46.4570555Z  """ 2025-12-04T07:56:46.4571479Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T07:56:46.4572663Z  experiment_optout = "-" + experiment_name 2025-12-04T07:56:46.4573756Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T07:56:46.4574791Z  return False 2025-12-04T07:56:46.4575484Z  2025-12-04T07:56:46.4576261Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T07:56:46.4577303Z  log.warning( 2025-12-04T07:56:46.4578702Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T07:56:46.4580380Z  ) 2025-12-04T07:56:46.4581014Z  2025-12-04T07:56:46.4581589Z  return True 2025-12-04T07:56:46.4582247Z  2025-12-04T07:56:46.4582826Z  2025-12-04T07:56:46.4583457Z def get_runner_prefix( 2025-12-04T07:56:46.4584240Z  rollout_state: str, 2025-12-04T07:56:46.4585067Z  workflow_requestors: Iterable[str], 2025-12-04T07:56:46.4585955Z  branch: str, 2025-12-04T07:56:46.4586857Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:46.4588006Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:46.4589035Z  is_canary: bool = False, 2025-12-04T07:56:46.4589829Z ) -> str: 2025-12-04T07:56:46.4590761Z  settings = parse_settings(rollout_state) 2025-12-04T07:56:46.4591776Z  user_optins = parse_users(rollout_state) 2025-12-04T07:56:46.4592666Z  2025-12-04T07:56:46.4593475Z  fleet_prefix = "" 2025-12-04T07:56:46.4594221Z  prefixes = [] 2025-12-04T07:56:46.4595361Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T07:56:46.4596974Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T07:56:46.4598209Z  log.info( 2025-12-04T07:56:46.4599409Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T07:56:46.4600863Z  ) 2025-12-04T07:56:46.4601568Z  continue 2025-12-04T07:56:46.4602262Z  2025-12-04T07:56:46.4602875Z  if opt_out_experiments: 2025-12-04T07:56:46.4603818Z  if experiment_name in opt_out_experiments: 2025-12-04T07:56:46.4604920Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T07:56:46.4605906Z  log.info( 2025-12-04T07:56:46.4607496Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T07:56:46.4609149Z  ) 2025-12-04T07:56:46.4609870Z  continue 2025-12-04T07:56:46.4611211Z  2025-12-04T07:56:46.4611838Z  if eligible_experiments: 2025-12-04T07:56:46.4612812Z  if experiment_name not in eligible_experiments: 2025-12-04T07:56:46.4613927Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T07:56:46.4614851Z  log.info( 2025-12-04T07:56:46.4616229Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T07:56:46.4617653Z  ) 2025-12-04T07:56:46.4618357Z  continue 2025-12-04T07:56:46.4619238Z  elif not experiment_settings.default: 2025-12-04T07:56:46.4620331Z  log.info( 2025-12-04T07:56:46.4621502Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T07:56:46.4622753Z  ) 2025-12-04T07:56:46.4623450Z  continue 2025-12-04T07:56:46.4624133Z  2025-12-04T07:56:46.4624918Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T07:56:46.4625984Z  opted_out_users = [ 2025-12-04T07:56:46.4626781Z  requestor 2025-12-04T07:56:46.4627601Z  for requestor in workflow_requestors 2025-12-04T07:56:46.4628744Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T07:56:46.4629816Z  ] 2025-12-04T07:56:46.4630605Z  2025-12-04T07:56:46.4631200Z  if opted_out_users: 2025-12-04T07:56:46.4632031Z  log.info( 2025-12-04T07:56:46.4633119Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T07:56:46.4634286Z  ) 2025-12-04T07:56:46.4634957Z  continue 2025-12-04T07:56:46.4635691Z  2025-12-04T07:56:46.4636458Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T07:56:46.4637487Z  opted_in_users = [ 2025-12-04T07:56:46.4638286Z  requestor 2025-12-04T07:56:46.4639116Z  for requestor in workflow_requestors 2025-12-04T07:56:46.4640422Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T07:56:46.4641484Z  ] 2025-12-04T07:56:46.4642113Z  2025-12-04T07:56:46.4642698Z  enabled = False 2025-12-04T07:56:46.4643465Z  if opted_in_users: 2025-12-04T07:56:46.4644469Z  log.info( 2025-12-04T07:56:46.4645567Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T07:56:46.4646715Z  ) 2025-12-04T07:56:46.4647416Z  enabled = True 2025-12-04T07:56:46.4648181Z  2025-12-04T07:56:46.4648864Z  elif experiment_settings.rollout_perc: 2025-12-04T07:56:46.4650515Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T07:56:46.4652106Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T07:56:46.4653278Z  log.info( 2025-12-04T07:56:46.4654802Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T07:56:46.4656362Z  ) 2025-12-04T07:56:46.4657115Z  enabled = True 2025-12-04T07:56:46.4657880Z  2025-12-04T07:56:46.4658453Z  if enabled: 2025-12-04T07:56:46.4659226Z  label = experiment_name 2025-12-04T07:56:46.4660386Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T07:56:46.4662012Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T07:56:46.4663505Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T07:56:46.4664788Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T07:56:46.4665913Z  if is_canary: 2025-12-04T07:56:46.4666790Z  label += CANARY_FLEET_SUFFIX 2025-12-04T07:56:46.4667705Z  fleet_prefix = label 2025-12-04T07:56:46.4668538Z  else: 2025-12-04T07:56:46.4669342Z  prefixes.append(label) 2025-12-04T07:56:46.4670376Z  2025-12-04T07:56:46.4670983Z  if len(prefixes) > 1: 2025-12-04T07:56:46.4671746Z  log.error( 2025-12-04T07:56:46.4673538Z  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:46.4675459Z  ) 2025-12-04T07:56:46.4676144Z  prefixes = prefixes[:1] 2025-12-04T07:56:46.4676954Z  2025-12-04T07:56:46.4677552Z  # Fleet always comes first 2025-12-04T07:56:46.4678461Z  if fleet_prefix: 2025-12-04T07:56:46.4679271Z  prefixes.insert(0, fleet_prefix) 2025-12-04T07:56:46.4680293Z  2025-12-04T07:56:46.4681042Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T07:56:46.4682011Z  2025-12-04T07:56:46.4682575Z  2025-12-04T07:56:46.4683636Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T07:56:46.4684953Z  """ 2025-12-04T07:56:46.4685956Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T07:56:46.4687144Z  2025-12-04T07:56:46.4688144Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T07:56:46.4689317Z  """ 2025-12-04T07:56:46.4690231Z  gh = get_gh_client(github_token) 2025-12-04T07:56:46.4691187Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T07:56:46.4692288Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T07:56:46.4693291Z  2025-12-04T07:56:46.4693857Z  2025-12-04T07:56:46.4694876Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T07:56:46.4696342Z  for _ in range(num_retries): 2025-12-04T07:56:46.4697175Z  try: 2025-12-04T07:56:46.4697943Z  req = Request(url=url, headers=headers) 2025-12-04T07:56:46.4699058Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T07:56:46.4700331Z  return json.loads(content) 2025-12-04T07:56:46.4701288Z  except Exception as e: 2025-12-04T07:56:46.4702259Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T07:56:46.4703173Z  2025-12-04T07:56:46.4704155Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T07:56:46.4705358Z  return {} 2025-12-04T07:56:46.4706006Z  2025-12-04T07:56:46.4706564Z  2025-12-04T07:56:46.4707148Z @cache 2025-12-04T07:56:46.4708215Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T07:56:46.4709499Z  """ 2025-12-04T07:56:46.4710396Z  Dynamically get PR information 2025-12-04T07:56:46.4711231Z  """ 2025-12-04T07:56:46.4712093Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T07:56:46.4713157Z  headers = { 2025-12-04T07:56:46.4713983Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T07:56:46.4715219Z  "Authorization": f"token {github_token}", 2025-12-04T07:56:46.4716135Z  } 2025-12-04T07:56:46.4716893Z  json_response: dict[str, Any] = download_json( 2025-12-04T07:56:46.4717913Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T07:56:46.4718822Z  headers=headers, 2025-12-04T07:56:46.4719578Z  ) 2025-12-04T07:56:46.4720350Z  2025-12-04T07:56:46.4720943Z  if not json_response: 2025-12-04T07:56:46.4721971Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T07:56:46.4723056Z  return {} 2025-12-04T07:56:46.4723740Z  2025-12-04T07:56:46.4724341Z  return json_response 2025-12-04T07:56:46.4725101Z  2025-12-04T07:56:46.4725673Z  2025-12-04T07:56:46.4726651Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T07:56:46.4727880Z  """ 2025-12-04T07:56:46.4728797Z  Dynamically get the latest list of labels from the pull request 2025-12-04T07:56:46.4729892Z  """ 2025-12-04T07:56:46.4730984Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T07:56:46.4732031Z  return { 2025-12-04T07:56:46.4733040Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T07:56:46.4734201Z  } 2025-12-04T07:56:46.4734804Z  2025-12-04T07:56:46.4735359Z  2025-12-04T07:56:46.4735957Z def main() -> None: 2025-12-04T07:56:46.4736697Z  args = parse_args() 2025-12-04T07:56:46.4737455Z  2025-12-04T07:56:46.4738155Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T07:56:46.4739038Z  2025-12-04T07:56:46.4739659Z  # Check if the PR is opt-out 2025-12-04T07:56:46.4740741Z  if args.pr_number: 2025-12-04T07:56:46.4741906Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T07:56:46.4743170Z  if OPT_OUT_LABEL in labels: 2025-12-04T07:56:46.4744039Z  log.info( 2025-12-04T07:56:46.4745241Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T07:56:46.4746528Z  ) 2025-12-04T07:56:46.4747501Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:46.4748626Z  sys.exit() 2025-12-04T07:56:46.4749574Z  2025-12-04T07:56:46.4750361Z  try: 2025-12-04T07:56:46.4751131Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T07:56:46.4752384Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T07:56:46.4753560Z  ) 2025-12-04T07:56:46.4754326Z  2025-12-04T07:56:46.4754987Z  username = get_potential_pr_author( 2025-12-04T07:56:46.4755924Z  args.github_token, 2025-12-04T07:56:46.4756766Z  args.github_repo, 2025-12-04T07:56:46.4757597Z  args.github_actor, 2025-12-04T07:56:46.4758438Z  args.github_ref_type, 2025-12-04T07:56:46.4759324Z  args.github_branch, 2025-12-04T07:56:46.4760293Z  ) 2025-12-04T07:56:46.4760912Z  2025-12-04T07:56:46.4761717Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T07:56:46.4762749Z  2025-12-04T07:56:46.4763435Z  runner_label_prefix = get_runner_prefix( 2025-12-04T07:56:46.4764343Z  rollout_state, 2025-12-04T07:56:46.4765213Z  (args.github_issue_owner, username), 2025-12-04T07:56:46.4766149Z  args.github_branch, 2025-12-04T07:56:46.4767234Z  args.eligible_experiments, 2025-12-04T07:56:46.4768171Z  args.opt_out_experiments, 2025-12-04T07:56:46.4769040Z  is_canary, 2025-12-04T07:56:46.4769808Z  ) 2025-12-04T07:56:46.4770752Z  2025-12-04T07:56:46.4771369Z  except Exception as e: 2025-12-04T07:56:46.4772170Z  log.error( 2025-12-04T07:56:46.4773359Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T07:56:46.4774624Z  ) 2025-12-04T07:56:46.4775408Z  2025-12-04T07:56:46.4776310Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:46.4777397Z  2025-12-04T07:56:46.4777957Z  2025-12-04T07:56:46.4778560Z if __name__ == "__main__": 2025-12-04T07:56:46.4779347Z  main() 2025-12-04T07:56:46.4780156Z  2025-12-04T07:56:46.4780719Z EOF 2025-12-04T07:56:46.4781300Z  2025-12-04T07:56:46.4781923Z cat runner_determinator.py 2025-12-04T07:56:46.5292778Z shell: /usr/bin/bash -e {0} 2025-12-04T07:56:46.5293822Z env: 2025-12-04T07:56:46.5294497Z GITHUB_TOKEN: *** 2025-12-04T07:56:46.5294908Z ISSUE_NUMBER: 5132 2025-12-04T07:56:46.5295356Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T07:56:46.5295847Z ISSUE_OWNER: 2025-12-04T07:56:46.5296231Z CHECK_EXPERIMENTS: 2025-12-04T07:56:46.5296662Z OPT_OUT_EXPERIMENTS: 2025-12-04T07:56:46.5297071Z PR_NUMBER: 2025-12-04T07:56:46.5297453Z ##[endgroup] 2025-12-04T07:56:46.5539669Z # flake8: noqa: G004 2025-12-04T07:56:46.5540217Z 2025-12-04T07:56:46.5540701Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T07:56:46.5541625Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T07:56:46.5542428Z # python .github/scripts/update_runner_determinator.py 2025-12-04T07:56:46.5542865Z 2025-12-04T07:56:46.5543038Z """ 2025-12-04T07:56:46.5543607Z This runner determinator is used to determine which set of runners to run a 2025-12-04T07:56:46.5544466Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T07:56:46.5545350Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T07:56:46.5546153Z of which runners should be used to run which job. 2025-12-04T07:56:46.5546531Z 2025-12-04T07:56:46.5546903Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T07:56:46.5547960Z separated by a line containing "---". If the line is not present, the 2025-12-04T07:56:46.5548815Z settings are considered to be empty with only the second part, the user 2025-12-04T07:56:46.5549482Z list, defined. 2025-12-04T07:56:46.5549706Z 2025-12-04T07:56:46.5550310Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T07:56:46.5551199Z used to define any settings that are needed to determine which runners to use. 2025-12-04T07:56:46.5551996Z It's fields are defined by the RolloutSettings class below. 2025-12-04T07:56:46.5552435Z 2025-12-04T07:56:46.5552808Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T07:56:46.5553655Z The user list is also a comma separated list of additional features or 2025-12-04T07:56:46.5554387Z experiments which the user could be opted in to. 2025-12-04T07:56:46.5554773Z 2025-12-04T07:56:46.5554976Z The user list has the following rules: 2025-12-04T07:56:46.5555311Z 2025-12-04T07:56:46.5555619Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T07:56:46.5556443Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T07:56:46.5557193Z - A "#" prefix opts the user out of all experiments 2025-12-04T07:56:46.5557574Z 2025-12-04T07:56:46.5557747Z Example config: 2025-12-04T07:56:46.5558204Z # A list of experiments that can be opted into. 2025-12-04T07:56:46.5559014Z # This defines the behavior they'll induce when opted into. 2025-12-04T07:56:46.5559614Z # Expected syntax is: 2025-12-04T07:56:46.5560433Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T07:56:46.5561361Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T07:56:46.5561945Z 2025-12-04T07:56:46.5562113Z experiments: 2025-12-04T07:56:46.5562498Z lf: 2025-12-04T07:56:46.5562861Z rollout_percent: 25 2025-12-04T07:56:46.5563317Z all_branches: false 2025-12-04T07:56:46.5563751Z default: true 2025-12-04T07:56:46.5564160Z --- 2025-12-04T07:56:46.5564346Z 2025-12-04T07:56:46.5564507Z # Opt-ins: 2025-12-04T07:56:46.5565071Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T07:56:46.5565887Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T07:56:46.5566647Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T07:56:46.5567287Z # Experiments should be from the above list. 2025-12-04T07:56:46.5567643Z 2025-12-04T07:56:46.5567825Z @User1,-lf,split_build 2025-12-04T07:56:46.5568248Z @User2,lf 2025-12-04T07:56:46.5568638Z @User3,split_build 2025-12-04T07:56:46.5569046Z """ 2025-12-04T07:56:46.5569242Z 2025-12-04T07:56:46.5569415Z import json 2025-12-04T07:56:46.5569789Z import logging 2025-12-04T07:56:46.5570330Z import os 2025-12-04T07:56:46.5570685Z import random 2025-12-04T07:56:46.5571046Z import re 2025-12-04T07:56:46.5571406Z import sys 2025-12-04T07:56:46.5571820Z from argparse import ArgumentParser 2025-12-04T07:56:46.5572319Z from collections.abc import Iterable 2025-12-04T07:56:46.5572816Z from functools import cache 2025-12-04T07:56:46.5573293Z from logging import LogRecord 2025-12-04T07:56:46.5573765Z from typing import Any, NamedTuple 2025-12-04T07:56:46.5574286Z from urllib.request import Request, urlopen 2025-12-04T07:56:46.5574639Z 2025-12-04T07:56:46.5574800Z import yaml 2025-12-04T07:56:46.5575171Z from github import Auth, Github 2025-12-04T07:56:46.5575683Z from github.Issue import Issue 2025-12-04T07:56:46.5575968Z 2025-12-04T07:56:46.5575975Z 2025-12-04T07:56:46.5576200Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T07:56:46.5576846Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T07:56:46.5577658Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T07:56:46.5578180Z 2025-12-04T07:56:46.5578402Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T07:56:46.5579075Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T07:56:46.5579601Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T07:56:46.5580317Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T07:56:46.5580657Z 2025-12-04T07:56:46.5580855Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T07:56:46.5581162Z 2025-12-04T07:56:46.5581361Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T07:56:46.5581829Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T07:56:46.5582096Z 2025-12-04T07:56:46.5582103Z 2025-12-04T07:56:46.5582287Z class Experiment(NamedTuple): 2025-12-04T07:56:46.5582756Z rollout_perc: float = ( 2025-12-04T07:56:46.5583356Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T07:56:46.5584001Z ) 2025-12-04T07:56:46.5584378Z all_branches: bool = ( 2025-12-04T07:56:46.5584965Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T07:56:46.5585608Z ) 2025-12-04T07:56:46.5585946Z default: bool = ( 2025-12-04T07:56:46.5586488Z True # If True, the experiment is enabled by default for all queries 2025-12-04T07:56:46.5587087Z ) 2025-12-04T07:56:46.5587292Z 2025-12-04T07:56:46.5587483Z # Add more fields as needed 2025-12-04T07:56:46.5587765Z 2025-12-04T07:56:46.5587771Z 2025-12-04T07:56:46.5587959Z class Settings(NamedTuple): 2025-12-04T07:56:46.5588518Z """ 2025-12-04T07:56:46.5588976Z Settings for the experiments that can be opted into. 2025-12-04T07:56:46.5589521Z """ 2025-12-04T07:56:46.5589715Z 2025-12-04T07:56:46.5589926Z experiments: dict[str, Experiment] = {} 2025-12-04T07:56:46.5590503Z 2025-12-04T07:56:46.5590512Z 2025-12-04T07:56:46.5590727Z class ColorFormatter(logging.Formatter): 2025-12-04T07:56:46.5591340Z """Color codes the log messages based on the log level""" 2025-12-04T07:56:46.5591746Z 2025-12-04T07:56:46.5591917Z COLORS = { 2025-12-04T07:56:46.5592303Z "WARNING": "\033[33m", # Yellow 2025-12-04T07:56:46.5592808Z "ERROR": "\033[31m", # Red 2025-12-04T07:56:46.5593276Z "CRITICAL": "\033[31m", # Red 2025-12-04T07:56:46.5593757Z "INFO": "\033[0m", # Reset 2025-12-04T07:56:46.5594219Z "DEBUG": "\033[0m", # Reset 2025-12-04T07:56:46.5594695Z } 2025-12-04T07:56:46.5594883Z 2025-12-04T07:56:46.5595093Z def format(self, record: LogRecord) -> str: 2025-12-04T07:56:46.5595810Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T07:56:46.5596569Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T07:56:46.5597120Z return super().format(record) 2025-12-04T07:56:46.5597431Z 2025-12-04T07:56:46.5597437Z 2025-12-04T07:56:46.5597633Z handler = logging.StreamHandler() 2025-12-04T07:56:46.5598320Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T07:56:46.5598859Z 2025-12-04T07:56:46.5599115Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T07:56:46.5599662Z log.addHandler(handler) 2025-12-04T07:56:46.5600318Z log.setLevel(logging.INFO) 2025-12-04T07:56:46.5600614Z 2025-12-04T07:56:46.5600621Z 2025-12-04T07:56:46.5600878Z def set_github_output(key: str, value: str) -> None: 2025-12-04T07:56:46.5601404Z """ 2025-12-04T07:56:46.5601909Z Defines outputs of the github action that invokes this script 2025-12-04T07:56:46.5602502Z """ 2025-12-04T07:56:46.5602886Z if not GITHUB_OUTPUT: 2025-12-04T07:56:46.5603929Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T07:56:46.5604995Z log.warning( 2025-12-04T07:56:46.5605799Z "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:46.5606683Z ) 2025-12-04T07:56:46.5616162Z print(f"::set-output name={key}::{value}") 2025-12-04T07:56:46.5616761Z return 2025-12-04T07:56:46.5617002Z 2025-12-04T07:56:46.5617426Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T07:56:46.5618012Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T07:56:46.5618580Z f.write(f"{key}={value}\n") 2025-12-04T07:56:46.5618896Z 2025-12-04T07:56:46.5618902Z 2025-12-04T07:56:46.5619212Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T07:56:46.5619824Z return frozenset( 2025-12-04T07:56:46.5620744Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T07:56:46.5621419Z ) 2025-12-04T07:56:46.5621616Z 2025-12-04T07:56:46.5621623Z 2025-12-04T07:56:46.5621802Z def parse_args() -> Any: 2025-12-04T07:56:46.5622345Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T07:56:46.5623182Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T07:56:46.5623921Z parser.add_argument( 2025-12-04T07:56:46.5624361Z "--github-issue-repo", 2025-12-04T07:56:46.5624813Z type=str, 2025-12-04T07:56:46.5625206Z required=False, 2025-12-04T07:56:46.5625639Z default="pytorch/test-infra", 2025-12-04T07:56:46.5626156Z help="GitHub repo to get the issue", 2025-12-04T07:56:46.5626646Z ) 2025-12-04T07:56:46.5627007Z parser.add_argument( 2025-12-04T07:56:46.5627436Z "--github-repo", 2025-12-04T07:56:46.5627991Z type=str, 2025-12-04T07:56:46.5628391Z required=True, 2025-12-04T07:56:46.5628842Z help="GitHub repo where CI is running", 2025-12-04T07:56:46.5629343Z ) 2025-12-04T07:56:46.5629699Z parser.add_argument( 2025-12-04T07:56:46.5630396Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T07:56:46.5631040Z ) 2025-12-04T07:56:46.5631401Z parser.add_argument( 2025-12-04T07:56:46.5631999Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T07:56:46.5632646Z ) 2025-12-04T07:56:46.5633014Z parser.add_argument( 2025-12-04T07:56:46.5633626Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T07:56:46.5634289Z ) 2025-12-04T07:56:46.5634649Z parser.add_argument( 2025-12-04T07:56:46.5635290Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T07:56:46.5635986Z ) 2025-12-04T07:56:46.5636349Z parser.add_argument( 2025-12-04T07:56:46.5636790Z "--github-ref-type", 2025-12-04T07:56:46.5637231Z type=str, 2025-12-04T07:56:46.5637621Z required=True, 2025-12-04T07:56:46.5638089Z help="Current GitHub ref type, branch or tag", 2025-12-04T07:56:46.5638622Z ) 2025-12-04T07:56:46.5638980Z parser.add_argument( 2025-12-04T07:56:46.5639427Z "--eligible-experiments", 2025-12-04T07:56:46.5639919Z type=_str_comma_separated_to_set, 2025-12-04T07:56:46.5640555Z required=False, 2025-12-04T07:56:46.5640964Z default="", 2025-12-04T07:56:46.5641770Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T07:56:46.5642649Z ) 2025-12-04T07:56:46.5643015Z parser.add_argument( 2025-12-04T07:56:46.5643461Z "--opt-out-experiments", 2025-12-04T07:56:46.5643963Z type=_str_comma_separated_to_set, 2025-12-04T07:56:46.5644479Z required=False, 2025-12-04T07:56:46.5644892Z default="", 2025-12-04T07:56:46.5645281Z help=( 2025-12-04T07:56:46.5645934Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T07:56:46.5692428Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T07:56:46.5693483Z ), 2025-12-04T07:56:46.5693854Z ) 2025-12-04T07:56:46.5694242Z parser.add_argument( 2025-12-04T07:56:46.5694681Z "--pr-number", 2025-12-04T07:56:46.5695097Z type=str, 2025-12-04T07:56:46.5695502Z required=False, 2025-12-04T07:56:46.5695924Z default="", 2025-12-04T07:56:46.5696574Z help="the optional PR number where this is run", 2025-12-04T07:56:46.5697138Z ) 2025-12-04T07:56:46.5697335Z 2025-12-04T07:56:46.5697536Z return parser.parse_args() 2025-12-04T07:56:46.5697853Z 2025-12-04T07:56:46.5697859Z 2025-12-04T07:56:46.5698251Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T07:56:46.5699000Z auth = Auth.Token(github_token) 2025-12-04T07:56:46.5699487Z return Github(auth=auth) 2025-12-04T07:56:46.5699787Z 2025-12-04T07:56:46.5699794Z 2025-12-04T07:56:46.5700378Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T07:56:46.5701161Z repo = gh.get_repo(repo) 2025-12-04T07:56:46.5701642Z return repo.get_issue(number=issue_num) 2025-12-04T07:56:46.5702003Z 2025-12-04T07:56:46.5702009Z 2025-12-04T07:56:46.5702203Z def get_potential_pr_author( 2025-12-04T07:56:46.5702839Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T07:56:46.5703492Z ) -> str: 2025-12-04T07:56:46.5704007Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T07:56:46.5704794Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T07:56:46.5705516Z # embedded in the tag name: ciflow// 2025-12-04T07:56:46.5706043Z 2025-12-04T07:56:46.5706232Z gh = get_gh_client(github_token) 2025-12-04T07:56:46.5706553Z 2025-12-04T07:56:46.5706826Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T07:56:46.5707421Z split_tag = ref_name.split("/") 2025-12-04T07:56:46.5707922Z if ( 2025-12-04T07:56:46.5708301Z len(split_tag) == 3 2025-12-04T07:56:46.5708772Z and split_tag[0] == "ciflow" 2025-12-04T07:56:46.5709280Z and split_tag[2].isnumeric() 2025-12-04T07:56:46.5709762Z ): 2025-12-04T07:56:46.5710246Z pr_number = split_tag[2] 2025-12-04T07:56:46.5710725Z try: 2025-12-04T07:56:46.5711173Z repository = gh.get_repo(repo) 2025-12-04T07:56:46.5711768Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T07:56:46.5712355Z except Exception as e: 2025-12-04T07:56:46.5712866Z raise Exception( # noqa: TRY002 2025-12-04T07:56:46.5713525Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T07:56:46.5714155Z ) from e 2025-12-04T07:56:46.5714670Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T07:56:46.5715348Z # In all other cases, return the original input username 2025-12-04T07:56:46.5715921Z return username 2025-12-04T07:56:46.5716152Z 2025-12-04T07:56:46.5716160Z 2025-12-04T07:56:46.5716389Z def is_exception_branch(branch: str) -> bool: 2025-12-04T07:56:46.5716904Z """ 2025-12-04T07:56:46.5717535Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T07:56:46.5718277Z """ 2025-12-04T07:56:46.5718829Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T07:56:46.5719329Z 2025-12-04T07:56:46.5719335Z 2025-12-04T07:56:46.5719535Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T07:56:46.5720110Z try: 2025-12-04T07:56:46.5720490Z data = yaml.safe_load(yaml_text) 2025-12-04T07:56:46.5720986Z return data 2025-12-04T07:56:46.5721395Z except yaml.YAMLError: 2025-12-04T07:56:46.5721874Z log.exception("Error loading YAML") 2025-12-04T07:56:46.5722384Z raise 2025-12-04T07:56:46.5722597Z 2025-12-04T07:56:46.5722604Z 2025-12-04T07:56:46.5723007Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T07:56:46.5723732Z """ 2025-12-04T07:56:46.5724321Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T07:56:46.5724891Z 2025-12-04T07:56:46.5725349Z If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:46.5726078Z and the text below is the list of opted in users. 2025-12-04T07:56:46.5726466Z 2025-12-04T07:56:46.5726831Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T07:56:46.5727510Z """ 2025-12-04T07:56:46.5727946Z rollout_state_parts = rollout_state.split("---") 2025-12-04T07:56:46.5728520Z if len(rollout_state_parts) >= 2: 2025-12-04T07:56:46.5729100Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T07:56:46.5729664Z else: 2025-12-04T07:56:46.5730156Z return "", rollout_state 2025-12-04T07:56:46.5730458Z 2025-12-04T07:56:46.5730465Z 2025-12-04T07:56:46.5730664Z class UserOptins(dict[str, list[str]]): 2025-12-04T07:56:46.5731169Z """ 2025-12-04T07:56:46.5731665Z Dictionary of users with a list of features they have opted into 2025-12-04T07:56:46.5732304Z """ 2025-12-04T07:56:46.5732492Z 2025-12-04T07:56:46.5732498Z 2025-12-04T07:56:46.5732833Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T07:56:46.5733457Z """ 2025-12-04T07:56:46.5734148Z 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:46.5734799Z 2025-12-04T07:56:46.5735391Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T07:56:46.5736516Z - Example line: "@User1,lf,split_build" 2025-12-04T07:56:46.5737196Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T07:56:46.5737659Z 2025-12-04T07:56:46.5737665Z 2025-12-04T07:56:46.5737823Z """ 2025-12-04T07:56:46.5738184Z optins = UserOptins() 2025-12-04T07:56:46.5738653Z for user in user_optin_text.split("\n"): 2025-12-04T07:56:46.5739196Z user = user.strip("\r\n\t -") 2025-12-04T07:56:46.5739723Z if not user or not user.startswith("@"): 2025-12-04T07:56:46.5740379Z # Not a valid user. Skip 2025-12-04T07:56:46.5740853Z continue 2025-12-04T07:56:46.5741091Z 2025-12-04T07:56:46.5741247Z if user: 2025-12-04T07:56:46.5741671Z usr_name = user.split(",")[0].strip("@") 2025-12-04T07:56:46.5742347Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T07:56:46.5742847Z 2025-12-04T07:56:46.5743013Z return optins 2025-12-04T07:56:46.5743243Z 2025-12-04T07:56:46.5743250Z 2025-12-04T07:56:46.5743529Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T07:56:46.5744122Z """ 2025-12-04T07:56:46.5744507Z Check if the experiment name is valid. 2025-12-04T07:56:46.5745010Z A valid name: 2025-12-04T07:56:46.5745623Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T07:56:46.5746524Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T07:56:46.5747229Z - Cannot contain spaces 2025-12-04T07:56:46.5747679Z """ 2025-12-04T07:56:46.5747879Z 2025-12-04T07:56:46.5748129Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T07:56:46.5748791Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T07:56:46.5749220Z 2025-12-04T07:56:46.5749382Z if valid: 2025-12-04T07:56:46.5749759Z return True 2025-12-04T07:56:46.5750078Z 2025-12-04T07:56:46.5750247Z log.error( 2025-12-04T07:56:46.5751633Z 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:46.5753152Z ) 2025-12-04T07:56:46.5753495Z return False 2025-12-04T07:56:46.5753717Z 2025-12-04T07:56:46.5753723Z 2025-12-04T07:56:46.5754018Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T07:56:46.5754609Z """ 2025-12-04T07:56:46.5755297Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T07:56:46.5755997Z """ 2025-12-04T07:56:46.5756344Z try: 2025-12-04T07:56:46.5756694Z if settings_text: 2025-12-04T07:56:46.5757387Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T07:56:46.5758172Z # for easy reading 2025-12-04T07:56:46.5758917Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T07:56:46.5759763Z # the backtick character in shell commands. 2025-12-04T07:56:46.5760447Z backtick = chr(96) # backtick character 2025-12-04T07:56:46.5761093Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T07:56:46.5761747Z settings = load_yaml(settings_text) 2025-12-04T07:56:46.5762112Z 2025-12-04T07:56:46.5762499Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T07:56:46.5763239Z experiments = {} 2025-12-04T07:56:46.5763522Z 2025-12-04T07:56:46.5763884Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T07:56:46.5764622Z if not is_valid_experiment_name(exp_name): 2025-12-04T07:56:46.5765674Z # 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:46.5766809Z continue 2025-12-04T07:56:46.5767084Z 2025-12-04T07:56:46.5767269Z valid_settings = {} 2025-12-04T07:56:46.5767766Z for setting in exp_settings: 2025-12-04T07:56:46.5768320Z if setting not in Experiment._fields: 2025-12-04T07:56:46.5768861Z log.warning( 2025-12-04T07:56:46.5769545Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T07:56:46.5770646Z ) 2025-12-04T07:56:46.5771080Z else: 2025-12-04T07:56:46.5771572Z valid_settings[setting] = exp_settings[setting] 2025-12-04T07:56:46.5771986Z 2025-12-04T07:56:46.5772257Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T07:56:46.5772876Z return Settings(experiments) 2025-12-04T07:56:46.5773213Z 2025-12-04T07:56:46.5773387Z except Exception: 2025-12-04T07:56:46.5773867Z log.exception("Failed to parse settings") 2025-12-04T07:56:46.5774233Z 2025-12-04T07:56:46.5774407Z return Settings() 2025-12-04T07:56:46.5774658Z 2025-12-04T07:56:46.5774665Z 2025-12-04T07:56:46.5774909Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T07:56:46.5775460Z """ 2025-12-04T07:56:46.5775871Z Parse settings, if any, from the rollout state. 2025-12-04T07:56:46.5776245Z 2025-12-04T07:56:46.5776591Z If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:46.5777343Z and the text below is the list of opted in users. 2025-12-04T07:56:46.5777728Z 2025-12-04T07:56:46.5778122Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T07:56:46.5778829Z """ 2025-12-04T07:56:46.5779367Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:46.5780208Z return parse_settings_from_text(settings_text) 2025-12-04T07:56:46.5780651Z 2025-12-04T07:56:46.5780658Z 2025-12-04T07:56:46.5780904Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T07:56:46.5781454Z """ 2025-12-04T07:56:46.5781829Z Parse users from the rollout state. 2025-12-04T07:56:46.5782164Z 2025-12-04T07:56:46.5782319Z """ 2025-12-04T07:56:46.5782830Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:46.5783544Z return parse_user_opt_in_from_text(users_text) 2025-12-04T07:56:46.5783920Z 2025-12-04T07:56:46.5783926Z 2025-12-04T07:56:46.5784449Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:46.5785186Z """ 2025-12-04T07:56:46.5785581Z Check if a user is opted into an experiment 2025-12-04T07:56:46.5786109Z """ 2025-12-04T07:56:46.5786552Z return experiment_name in user_optins.get(user, []) 2025-12-04T07:56:46.5786950Z 2025-12-04T07:56:46.5786957Z 2025-12-04T07:56:46.5787364Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:46.5788069Z """ 2025-12-04T07:56:46.5788516Z Check if a user explicitly opted out of an experiment 2025-12-04T07:56:46.5789065Z """ 2025-12-04T07:56:46.5789550Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T07:56:46.5790291Z experiment_optout = "-" + experiment_name 2025-12-04T07:56:46.5790905Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T07:56:46.5791476Z return False 2025-12-04T07:56:46.5791718Z 2025-12-04T07:56:46.5791977Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T07:56:46.5792548Z log.warning( 2025-12-04T07:56:46.5793324Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T07:56:46.5794165Z ) 2025-12-04T07:56:46.5794479Z 2025-12-04T07:56:46.5794639Z return True 2025-12-04T07:56:46.5794868Z 2025-12-04T07:56:46.5794874Z 2025-12-04T07:56:46.5795052Z def get_runner_prefix( 2025-12-04T07:56:46.5795469Z rollout_state: str, 2025-12-04T07:56:46.5795911Z workflow_requestors: Iterable[str], 2025-12-04T07:56:46.5796413Z branch: str, 2025-12-04T07:56:46.5796873Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:46.5797509Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:46.5798078Z is_canary: bool = False, 2025-12-04T07:56:46.5798509Z ) -> str: 2025-12-04T07:56:46.5798911Z settings = parse_settings(rollout_state) 2025-12-04T07:56:46.5799473Z user_optins = parse_users(rollout_state) 2025-12-04T07:56:46.5799828Z 2025-12-04T07:56:46.5800101Z fleet_prefix = "" 2025-12-04T07:56:46.5800514Z prefixes = [] 2025-12-04T07:56:46.5801116Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T07:56:46.5802018Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T07:56:46.5802701Z log.info( 2025-12-04T07:56:46.5803339Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T07:56:46.5804077Z ) 2025-12-04T07:56:46.5804445Z continue 2025-12-04T07:56:46.5804681Z 2025-12-04T07:56:46.5804864Z if opt_out_experiments: 2025-12-04T07:56:46.5805365Z if experiment_name in opt_out_experiments: 2025-12-04T07:56:46.5805980Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T07:56:46.5806548Z log.info( 2025-12-04T07:56:46.5807433Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T07:56:46.5808381Z ) 2025-12-04T07:56:46.5808757Z continue 2025-12-04T07:56:46.5809017Z 2025-12-04T07:56:46.5809204Z if eligible_experiments: 2025-12-04T07:56:46.5809739Z if experiment_name not in eligible_experiments: 2025-12-04T07:56:46.5810487Z exp_list = ", ".join(eligible_experiments) 2025-12-04T07:56:46.5811028Z log.info( 2025-12-04T07:56:46.5811766Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T07:56:46.5812574Z ) 2025-12-04T07:56:46.5812941Z continue 2025-12-04T07:56:46.5813394Z elif not experiment_settings.default: 2025-12-04T07:56:46.5813898Z log.info( 2025-12-04T07:56:46.5814640Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T07:56:46.5815347Z ) 2025-12-04T07:56:46.5815700Z continue 2025-12-04T07:56:46.5815948Z 2025-12-04T07:56:46.5816220Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T07:56:46.5816798Z opted_out_users = [ 2025-12-04T07:56:46.5817233Z requestor 2025-12-04T07:56:46.5817666Z for requestor in workflow_requestors 2025-12-04T07:56:46.5818300Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T07:56:46.5818902Z ] 2025-12-04T07:56:46.5819099Z 2025-12-04T07:56:46.5819272Z if opted_out_users: 2025-12-04T07:56:46.5819706Z log.info( 2025-12-04T07:56:46.5820390Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T07:56:46.5821072Z ) 2025-12-04T07:56:46.5821419Z continue 2025-12-04T07:56:46.5821668Z 2025-12-04T07:56:46.5821942Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T07:56:46.5822537Z opted_in_users = [ 2025-12-04T07:56:46.5822961Z requestor 2025-12-04T07:56:46.5823394Z for requestor in workflow_requestors 2025-12-04T07:56:46.5824019Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T07:56:46.5824725Z ] 2025-12-04T07:56:46.5824918Z 2025-12-04T07:56:46.5825083Z enabled = False 2025-12-04T07:56:46.5825514Z if opted_in_users: 2025-12-04T07:56:46.5825928Z log.info( 2025-12-04T07:56:46.5826495Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T07:56:46.5827148Z ) 2025-12-04T07:56:46.5827529Z enabled = True 2025-12-04T07:56:46.5827794Z 2025-12-04T07:56:46.5828002Z elif experiment_settings.rollout_perc: 2025-12-04T07:56:46.5828785Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T07:56:46.5829689Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T07:56:46.5830713Z log.info( 2025-12-04T07:56:46.5831664Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T07:56:46.5832549Z ) 2025-12-04T07:56:46.5832949Z enabled = True 2025-12-04T07:56:46.5833243Z 2025-12-04T07:56:46.5833404Z if enabled: 2025-12-04T07:56:46.5833807Z label = experiment_name 2025-12-04T07:56:46.5834330Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T07:56:46.5835103Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T07:56:46.5835953Z # - If it's enabled, then we always list it's prefix first 2025-12-04T07:56:46.5836702Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T07:56:46.5837349Z if is_canary: 2025-12-04T07:56:46.5837832Z label += CANARY_FLEET_SUFFIX 2025-12-04T07:56:46.5838364Z fleet_prefix = label 2025-12-04T07:56:46.5838830Z else: 2025-12-04T07:56:46.5839240Z prefixes.append(label) 2025-12-04T07:56:46.5839568Z 2025-12-04T07:56:46.5839750Z if len(prefixes) > 1: 2025-12-04T07:56:46.5840291Z log.error( 2025-12-04T07:56:46.5841277Z 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:46.5842337Z ) 2025-12-04T07:56:46.5842719Z prefixes = prefixes[:1] 2025-12-04T07:56:46.5843015Z 2025-12-04T07:56:46.5843202Z # Fleet always comes first 2025-12-04T07:56:46.5843650Z if fleet_prefix: 2025-12-04T07:56:46.5844087Z prefixes.insert(0, fleet_prefix) 2025-12-04T07:56:46.5844420Z 2025-12-04T07:56:46.5844820Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T07:56:46.5845222Z 2025-12-04T07:56:46.5845228Z 2025-12-04T07:56:46.5845640Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T07:56:46.5846372Z """ 2025-12-04T07:56:46.5846924Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T07:56:46.5847463Z 2025-12-04T07:56:46.5847834Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T07:56:46.5848505Z """ 2025-12-04T07:56:46.5848879Z gh = get_gh_client(github_token) 2025-12-04T07:56:46.5849386Z issue = get_issue(gh, repo, issue_num) 2025-12-04T07:56:46.5850085Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T07:56:46.5850509Z 2025-12-04T07:56:46.5850516Z 2025-12-04T07:56:46.5850892Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T07:56:46.5851608Z for _ in range(num_retries): 2025-12-04T07:56:46.5852067Z try: 2025-12-04T07:56:46.5852471Z req = Request(url=url, headers=headers) 2025-12-04T07:56:46.5853102Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T07:56:46.5853722Z return json.loads(content) 2025-12-04T07:56:46.5854237Z except Exception as e: 2025-12-04T07:56:46.5854879Z log.warning(f"Could not download {url}: {e}") 2025-12-04T07:56:46.5855260Z 2025-12-04T07:56:46.5855616Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T07:56:46.5856287Z return {} 2025-12-04T07:56:46.5856496Z 2025-12-04T07:56:46.5856502Z 2025-12-04T07:56:46.5856656Z @cache 2025-12-04T07:56:46.5857244Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T07:56:46.5857947Z """ 2025-12-04T07:56:46.5858324Z Dynamically get PR information 2025-12-04T07:56:46.5858800Z """ 2025-12-04T07:56:46.5859264Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T07:56:46.5859850Z headers = { 2025-12-04T07:56:46.5860411Z "Accept": "application/vnd.github.v3+json", 2025-12-04T07:56:46.5860994Z "Authorization": f"token {github_token}", 2025-12-04T07:56:46.5861502Z } 2025-12-04T07:56:46.5861904Z json_response: dict[str, Any] = download_json( 2025-12-04T07:56:46.5862480Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T07:56:46.5863025Z headers=headers, 2025-12-04T07:56:46.5863446Z ) 2025-12-04T07:56:46.5863639Z 2025-12-04T07:56:46.5863818Z if not json_response: 2025-12-04T07:56:46.5864358Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T07:56:46.5864948Z return {} 2025-12-04T07:56:46.5865181Z 2025-12-04T07:56:46.5865372Z return json_response 2025-12-04T07:56:46.5865631Z 2025-12-04T07:56:46.5865638Z 2025-12-04T07:56:46.5866015Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T07:56:46.5866698Z """ 2025-12-04T07:56:46.5867186Z Dynamically get the latest list of labels from the pull request 2025-12-04T07:56:46.5867800Z """ 2025-12-04T07:56:46.5868252Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T07:56:46.5868841Z return { 2025-12-04T07:56:46.5869405Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T07:56:46.5870165Z } 2025-12-04T07:56:46.5870356Z 2025-12-04T07:56:46.5870363Z 2025-12-04T07:56:46.5870533Z def main() -> None: 2025-12-04T07:56:46.5870928Z args = parse_args() 2025-12-04T07:56:46.5871184Z 2025-12-04T07:56:46.5871404Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T07:56:46.5871767Z 2025-12-04T07:56:46.5871953Z # Check if the PR is opt-out 2025-12-04T07:56:46.5872431Z if args.pr_number: 2025-12-04T07:56:46.5873047Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T07:56:46.5873883Z if OPT_OUT_LABEL in labels: 2025-12-04T07:56:46.5874357Z log.info( 2025-12-04T07:56:46.5875002Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T07:56:46.5875738Z ) 2025-12-04T07:56:46.5876256Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:46.5876903Z sys.exit() 2025-12-04T07:56:46.5877153Z 2025-12-04T07:56:46.5877314Z try: 2025-12-04T07:56:46.5877724Z rollout_state = get_rollout_state_from_issue( 2025-12-04T07:56:46.5878408Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T07:56:46.5879015Z ) 2025-12-04T07:56:46.5879206Z 2025-12-04T07:56:46.5879407Z username = get_potential_pr_author( 2025-12-04T07:56:46.5879922Z args.github_token, 2025-12-04T07:56:46.5880471Z args.github_repo, 2025-12-04T07:56:46.5880958Z args.github_actor, 2025-12-04T07:56:46.5881413Z args.github_ref_type, 2025-12-04T07:56:46.5881895Z args.github_branch, 2025-12-04T07:56:46.5882333Z ) 2025-12-04T07:56:46.5882523Z 2025-12-04T07:56:46.5882793Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T07:56:46.5883222Z 2025-12-04T07:56:46.5883428Z runner_label_prefix = get_runner_prefix( 2025-12-04T07:56:46.5884041Z rollout_state, 2025-12-04T07:56:46.5884457Z (args.github_issue_owner, username), 2025-12-04T07:56:46.5884937Z args.github_branch, 2025-12-04T07:56:46.5885373Z args.eligible_experiments, 2025-12-04T07:56:46.5885861Z args.opt_out_experiments, 2025-12-04T07:56:46.5886296Z is_canary, 2025-12-04T07:56:46.5886660Z ) 2025-12-04T07:56:46.5886837Z 2025-12-04T07:56:46.5887002Z except Exception as e: 2025-12-04T07:56:46.5887394Z log.error( 2025-12-04T07:56:46.5887982Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T07:56:46.5888645Z ) 2025-12-04T07:56:46.5888825Z 2025-12-04T07:56:46.5889120Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:46.5889551Z 2025-12-04T07:56:46.5889557Z 2025-12-04T07:56:46.5889724Z if __name__ == "__main__": 2025-12-04T07:56:46.5890217Z main() 2025-12-04T07:56:46.5890411Z 2025-12-04T07:56:46.5971786Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T07:56:46.5972546Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T07:56:46.6001811Z shell: /usr/bin/bash -e {0} 2025-12-04T07:56:46.6002226Z env: 2025-12-04T07:56:46.6002745Z GITHUB_TOKEN: *** 2025-12-04T07:56:46.6003118Z ISSUE_NUMBER: 5132 2025-12-04T07:56:46.6003513Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T07:56:46.6003957Z ISSUE_OWNER: 2025-12-04T07:56:46.6004315Z CHECK_EXPERIMENTS: 2025-12-04T07:56:46.6004723Z OPT_OUT_EXPERIMENTS: 2025-12-04T07:56:46.6005110Z PR_NUMBER: 2025-12-04T07:56:46.6005448Z ##[endgroup] 2025-12-04T07:56:46.9814555Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T07:56:47.4285482Z Collecting urllib3==1.26.18 2025-12-04T07:56:47.4982058Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T07:56:47.5244120Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.5 MB/s eta 0:00:00 2025-12-04T07:56:47.5599222Z Collecting PyGithub==2.3.0 2025-12-04T07:56:47.5749114Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T07:56:47.6338477Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T07:56:47.6490374Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T07:56:47.6534168Z 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:47.6550821Z 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:47.6565017Z 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:47.6930518Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T07:56:47.7086336Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T07:56:47.7308791Z 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:47.8844821Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T07:56:47.8996705Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T07:56:48.0612964Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T07:56:48.0767675Z 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:48.1083373Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T07:56:48.1233530Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T07:56:48.1601372Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T07:56:48.1788278Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 8.1 MB/s eta 0:00:00 2025-12-04T07:56:48.1965573Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T07:56:48.2157480Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 19.6 MB/s eta 0:00:00 2025-12-04T07:56:48.2308659Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T07:56:48.2554456Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 61.4 MB/s eta 0:00:00 2025-12-04T07:56:48.2707945Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T07:56:48.2890781Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T07:56:48.2943717Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 56.6 MB/s eta 0:00:00 2025-12-04T07:56:48.3098497Z 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:48.3141395Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 45.0 MB/s eta 0:00:00 2025-12-04T07:56:48.3291614Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T07:56:48.3332616Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 43.2 MB/s eta 0:00:00 2025-12-04T07:56:48.6059576Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T07:56:49.1125350Z 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:49.1857033Z ##[group]Run curr_branch="main" 2025-12-04T07:56:49.1857369Z curr_branch="main" 2025-12-04T07:56:49.1857617Z curr_ref_type="branch" 2025-12-04T07:56:49.1857894Z echo "Current branch is '$curr_branch'" 2025-12-04T07:56:49.1858164Z  2025-12-04T07:56:49.1858386Z python3 runner_determinator.py \ 2025-12-04T07:56:49.1858686Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T07:56:49.1858982Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T07:56:49.1859266Z  --github-branch "$curr_branch" \ 2025-12-04T07:56:49.1859550Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T07:56:49.1859885Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T07:56:49.1860420Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T07:56:49.1860730Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T07:56:49.1861056Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T07:56:49.1861448Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T07:56:49.1861761Z  --pr-number "${PR_NUMBER}" 2025-12-04T07:56:49.1893069Z shell: /usr/bin/bash -e {0} 2025-12-04T07:56:49.1893326Z env: 2025-12-04T07:56:49.1893946Z GITHUB_TOKEN: *** 2025-12-04T07:56:49.1894167Z ISSUE_NUMBER: 5132 2025-12-04T07:56:49.1894403Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T07:56:49.1894659Z ISSUE_OWNER: 2025-12-04T07:56:49.1894872Z CHECK_EXPERIMENTS: 2025-12-04T07:56:49.1895091Z OPT_OUT_EXPERIMENTS: 2025-12-04T07:56:49.1895315Z PR_NUMBER: 2025-12-04T07:56:49.1895514Z ##[endgroup] 2025-12-04T07:56:49.1944194Z Current branch is 'main' 2025-12-04T07:56:50.6951640Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-12-04T07:56:50.6953366Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T07:56:50.6954508Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T07:56:50.6955412Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T07:56:50.6956139Z INFO : Setting output: label-type='lf.' 2025-12-04T07:56:50.7268454Z Evaluate and set job outputs 2025-12-04T07:56:50.7274847Z Set output 'label-type' 2025-12-04T07:56:50.7277026Z Cleaning up orphan processes