2025-12-04T09:01:04.8423472Z Current runner version: '2.329.0' 2025-12-04T09:01:04.8456652Z ##[group]Runner Image Provisioner 2025-12-04T09:01:04.8457760Z Hosted Compute Agent 2025-12-04T09:01:04.8458970Z Version: 20251124.448 2025-12-04T09:01:04.8459934Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T09:01:04.8461019Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T09:01:04.8462085Z ##[endgroup] 2025-12-04T09:01:04.8462925Z ##[group]Operating System 2025-12-04T09:01:04.8463804Z Ubuntu 2025-12-04T09:01:04.8464677Z 24.04.3 2025-12-04T09:01:04.8465417Z LTS 2025-12-04T09:01:04.8466094Z ##[endgroup] 2025-12-04T09:01:04.8467033Z ##[group]Runner Image 2025-12-04T09:01:04.8467919Z Image: ubuntu-24.04 2025-12-04T09:01:04.8468968Z Version: 20251126.144.1 2025-12-04T09:01:04.8470940Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T09:01:04.8473674Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T09:01:04.8475595Z ##[endgroup] 2025-12-04T09:01:04.8477529Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T09:01:04.8480773Z Contents: read 2025-12-04T09:01:04.8481669Z Metadata: read 2025-12-04T09:01:04.8482666Z ##[endgroup] 2025-12-04T09:01:04.8486189Z Secret source: Actions 2025-12-04T09:01:04.8487321Z Prepare workflow directory 2025-12-04T09:01:04.9370634Z Prepare all required actions 2025-12-04T09:01:04.9455372Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T09:01:04.9463402Z ##[group] Inputs 2025-12-04T09:01:04.9464333Z check_experiments: 2025-12-04T09:01:04.9465518Z opt_out_experiments: 2025-12-04T09:01:04.9466519Z triggering_actor: pytorchmergebot 2025-12-04T09:01:04.9467649Z issue_owner: 2025-12-04T09:01:04.9468740Z curr_branch: main 2025-12-04T09:01:04.9469672Z curr_ref_type: branch 2025-12-04T09:01:04.9470815Z issue_number: 5132 2025-12-04T09:01:04.9471759Z ##[endgroup] 2025-12-04T09:01:04.9472981Z Complete job name: before-test / get-label-type / runner-determinator 2025-12-04T09:01:05.4392563Z ##[group]Run cat < runner_determinator.py 2025-12-04T09:01:05.4394985Z cat < runner_determinator.py 2025-12-04T09:01:05.4395771Z # flake8: noqa: G004 2025-12-04T09:01:05.4396358Z  2025-12-04T09:01:05.4397182Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T09:01:05.4398662Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T09:01:05.4399794Z # python .github/scripts/update_runner_determinator.py 2025-12-04T09:01:05.4400557Z  2025-12-04T09:01:05.4400983Z """ 2025-12-04T09:01:05.4401813Z This runner determinator is used to determine which set of runners to run a 2025-12-04T09:01:05.4402884Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T09:01:05.4404200Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T09:01:05.4405260Z of which runners should be used to run which job. 2025-12-04T09:01:05.4405990Z  2025-12-04T09:01:05.4406792Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T09:01:05.4407947Z separated by a line containing "---". If the line is not present, the 2025-12-04T09:01:05.4409346Z settings are considered to be empty with only the second part, the user 2025-12-04T09:01:05.4410264Z list, defined. 2025-12-04T09:01:05.4410872Z  2025-12-04T09:01:05.4411548Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T09:01:05.4412729Z used to define any settings that are needed to determine which runners to use. 2025-12-04T09:01:05.4413810Z It's fields are defined by the RolloutSettings class below. 2025-12-04T09:01:05.4414548Z  2025-12-04T09:01:05.4415611Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T09:01:05.4416693Z The user list is also a comma separated list of additional features or 2025-12-04T09:01:05.4417662Z experiments which the user could be opted in to. 2025-12-04T09:01:05.4418569Z  2025-12-04T09:01:05.4419097Z The user list has the following rules: 2025-12-04T09:01:05.4419767Z  2025-12-04T09:01:05.4420444Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T09:01:05.4421593Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T09:01:05.4422537Z - A "#" prefix opts the user out of all experiments 2025-12-04T09:01:05.4423230Z  2025-12-04T09:01:05.4423790Z Example config: 2025-12-04T09:01:05.4424411Z  # A list of experiments that can be opted into. 2025-12-04T09:01:05.4425293Z  # This defines the behavior they'll induce when opted into. 2025-12-04T09:01:05.4426198Z  # Expected syntax is: 2025-12-04T09:01:05.4427054Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T09:01:05.4428388Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T09:01:05.4429384Z  2025-12-04T09:01:05.4429879Z  experiments: 2025-12-04T09:01:05.4430439Z  lf: 2025-12-04T09:01:05.4431032Z  rollout_percent: 25 2025-12-04T09:01:05.4431643Z  all_branches: false 2025-12-04T09:01:05.4432269Z  default: true 2025-12-04T09:01:05.4432898Z  --- 2025-12-04T09:01:05.4433368Z  2025-12-04T09:01:05.4433881Z  # Opt-ins: 2025-12-04T09:01:05.4434666Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T09:01:05.4435984Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T09:01:05.4436980Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T09:01:05.4437886Z  # Experiments should be from the above list. 2025-12-04T09:01:05.4438742Z  2025-12-04T09:01:05.4439264Z  @User1,-lf,split_build 2025-12-04T09:01:05.4440295Z  @User2,lf 2025-12-04T09:01:05.4512191Z  @User3,split_build 2025-12-04T09:01:05.4512790Z """ 2025-12-04T09:01:05.4513201Z  2025-12-04T09:01:05.4513600Z import json 2025-12-04T09:01:05.4514054Z import logging 2025-12-04T09:01:05.4514521Z import os 2025-12-04T09:01:05.4514963Z import random 2025-12-04T09:01:05.4515415Z import re 2025-12-04T09:01:05.4515860Z import sys 2025-12-04T09:01:05.4516360Z from argparse import ArgumentParser 2025-12-04T09:01:05.4517076Z from collections.abc import Iterable 2025-12-04T09:01:05.4517717Z from functools import cache 2025-12-04T09:01:05.4518426Z from logging import LogRecord 2025-12-04T09:01:05.4519040Z from typing import Any, NamedTuple 2025-12-04T09:01:05.4519688Z from urllib.request import Request, urlopen 2025-12-04T09:01:05.4520307Z  2025-12-04T09:01:05.4520706Z import yaml 2025-12-04T09:01:05.4521187Z from github import Auth, Github 2025-12-04T09:01:05.4521768Z from github.Issue import Issue 2025-12-04T09:01:05.4522308Z  2025-12-04T09:01:05.4522682Z  2025-12-04T09:01:05.4523161Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T09:01:05.4523962Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T09:01:05.4524975Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T09:01:05.4525785Z  2025-12-04T09:01:05.4526509Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T09:01:05.4527186Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T09:01:05.4527807Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T09:01:05.4528603Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T09:01:05.4529197Z  2025-12-04T09:01:05.4529638Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T09:01:05.4530223Z  2025-12-04T09:01:05.4530632Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T09:01:05.4531187Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T09:01:05.4531710Z  2025-12-04T09:01:05.4532092Z  2025-12-04T09:01:05.4532525Z class Experiment(NamedTuple): 2025-12-04T09:01:05.4533101Z  rollout_perc: float = ( 2025-12-04T09:01:05.4533870Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T09:01:05.4534653Z  ) 2025-12-04T09:01:05.4535089Z  all_branches: bool = ( 2025-12-04T09:01:05.4535848Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T09:01:05.4536636Z  ) 2025-12-04T09:01:05.4537069Z  default: bool = ( 2025-12-04T09:01:05.4537759Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T09:01:05.4538644Z  ) 2025-12-04T09:01:05.4539041Z  2025-12-04T09:01:05.4539462Z  # Add more fields as needed 2025-12-04T09:01:05.4540002Z  2025-12-04T09:01:05.4540383Z  2025-12-04T09:01:05.4540805Z class Settings(NamedTuple): 2025-12-04T09:01:05.4541344Z  """ 2025-12-04T09:01:05.4541895Z  Settings for the experiments that can be opted into. 2025-12-04T09:01:05.4542578Z  """ 2025-12-04T09:01:05.4542976Z  2025-12-04T09:01:05.4543438Z  experiments: dict[str, Experiment] = {} 2025-12-04T09:01:05.4544038Z  2025-12-04T09:01:05.4544550Z  2025-12-04T09:01:05.4545031Z class ColorFormatter(logging.Formatter): 2025-12-04T09:01:05.4545761Z  """Color codes the log messages based on the log level""" 2025-12-04T09:01:05.4546428Z  2025-12-04T09:01:05.4546820Z  COLORS = { 2025-12-04T09:01:05.4547317Z  "WARNING": "\033[33m", # Yellow 2025-12-04T09:01:05.4547912Z  "ERROR": "\033[31m", # Red 2025-12-04T09:01:05.4548676Z  "CRITICAL": "\033[31m", # Red 2025-12-04T09:01:05.4549273Z  "INFO": "\033[0m", # Reset 2025-12-04T09:01:05.4549847Z  "DEBUG": "\033[0m", # Reset 2025-12-04T09:01:05.4550392Z  } 2025-12-04T09:01:05.4550789Z  2025-12-04T09:01:05.4551269Z  def format(self, record: LogRecord) -> str: 2025-12-04T09:01:05.4552127Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T09:01:05.4553035Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T09:01:05.4553717Z  return super().format(record) 2025-12-04T09:01:05.4554286Z  2025-12-04T09:01:05.4554672Z  2025-12-04T09:01:05.4555109Z handler = logging.StreamHandler() 2025-12-04T09:01:05.4555946Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T09:01:05.4556766Z  2025-12-04T09:01:05.4557274Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T09:01:05.4557951Z log.addHandler(handler) 2025-12-04T09:01:05.4558770Z log.setLevel(logging.INFO) 2025-12-04T09:01:05.4559294Z  2025-12-04T09:01:05.4559674Z  2025-12-04T09:01:05.4560184Z def set_github_output(key: str, value: str) -> None: 2025-12-04T09:01:05.4560876Z  """ 2025-12-04T09:01:05.4561477Z  Defines outputs of the github action that invokes this script 2025-12-04T09:01:05.4562343Z  """ 2025-12-04T09:01:05.4562780Z  if not GITHUB_OUTPUT: 2025-12-04T09:01:05.4563984Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T09:01:05.4565284Z  log.warning( 2025-12-04T09:01:05.4566276Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T09:01:05.4567351Z  ) 2025-12-04T09:01:05.4567871Z  print(f"::set-output name={key}::{value}") 2025-12-04T09:01:05.4568612Z  return 2025-12-04T09:01:05.4569056Z  2025-12-04T09:01:05.4569502Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T09:01:05.4570164Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T09:01:05.4570826Z  f.write(f"{key}={value}\n") 2025-12-04T09:01:05.4571388Z  2025-12-04T09:01:05.4571773Z  2025-12-04T09:01:05.4572367Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T09:01:05.4573132Z  return frozenset( 2025-12-04T09:01:05.4573857Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T09:01:05.4574656Z  ) 2025-12-04T09:01:05.4575075Z  2025-12-04T09:01:05.4575459Z  2025-12-04T09:01:05.4575869Z def parse_args() -> Any: 2025-12-04T09:01:05.4576558Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T09:01:05.4577561Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T09:01:05.4578567Z  parser.add_argument( 2025-12-04T09:01:05.4579149Z  "--github-issue-repo", 2025-12-04T09:01:05.4579717Z  type=str, 2025-12-04T09:01:05.4580219Z  required=False, 2025-12-04T09:01:05.4580912Z  default="pytorch/test-infra", 2025-12-04T09:01:05.4581571Z  help="GitHub repo to get the issue", 2025-12-04T09:01:05.4582166Z  ) 2025-12-04T09:01:05.4582602Z  parser.add_argument( 2025-12-04T09:01:05.4583146Z  "--github-repo", 2025-12-04T09:01:05.4583675Z  type=str, 2025-12-04T09:01:05.4584169Z  required=True, 2025-12-04T09:01:05.4584743Z  help="GitHub repo where CI is running", 2025-12-04T09:01:05.4585325Z  ) 2025-12-04T09:01:05.4585765Z  parser.add_argument( 2025-12-04T09:01:05.4586486Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T09:01:05.4587244Z  ) 2025-12-04T09:01:05.4587679Z  parser.add_argument( 2025-12-04T09:01:05.4588565Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T09:01:05.4589356Z  ) 2025-12-04T09:01:05.4589782Z  parser.add_argument( 2025-12-04T09:01:05.4590540Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T09:01:05.4591333Z  ) 2025-12-04T09:01:05.4591769Z  parser.add_argument( 2025-12-04T09:01:05.4592544Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T09:01:05.4593361Z  ) 2025-12-04T09:01:05.4593818Z  parser.add_argument( 2025-12-04T09:01:05.4594369Z  "--github-ref-type", 2025-12-04T09:01:05.4594924Z  type=str, 2025-12-04T09:01:05.4595422Z  required=True, 2025-12-04T09:01:05.4596038Z  help="Current GitHub ref type, branch or tag", 2025-12-04T09:01:05.4596680Z  ) 2025-12-04T09:01:05.4597109Z  parser.add_argument( 2025-12-04T09:01:05.4597817Z  "--eligible-experiments", 2025-12-04T09:01:05.4598542Z  type=_str_comma_separated_to_set, 2025-12-04T09:01:05.4599147Z  required=False, 2025-12-04T09:01:05.4599664Z  default="", 2025-12-04T09:01:05.4600642Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T09:01:05.4601701Z  ) 2025-12-04T09:01:05.4602141Z  parser.add_argument( 2025-12-04T09:01:05.4602712Z  "--opt-out-experiments", 2025-12-04T09:01:05.4603329Z  type=_str_comma_separated_to_set, 2025-12-04T09:01:05.4603928Z  required=False, 2025-12-04T09:01:05.4604449Z  default="", 2025-12-04T09:01:05.4604944Z  help=( 2025-12-04T09:01:05.4605745Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T09:01:05.4607040Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T09:01:05.4607995Z  ), 2025-12-04T09:01:05.4608537Z  ) 2025-12-04T09:01:05.4608983Z  parser.add_argument( 2025-12-04T09:01:05.4609537Z  "--pr-number", 2025-12-04T09:01:05.4610057Z  type=str, 2025-12-04T09:01:05.4610560Z  required=False, 2025-12-04T09:01:05.4611075Z  default="", 2025-12-04T09:01:05.4611677Z  help="the optional PR number where this is run", 2025-12-04T09:01:05.4612320Z  ) 2025-12-04T09:01:05.4612731Z  2025-12-04T09:01:05.4613160Z  return parser.parse_args() 2025-12-04T09:01:05.4613708Z  2025-12-04T09:01:05.4614083Z  2025-12-04T09:01:05.4614753Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T09:01:05.4615788Z  auth = Auth.Token(github_token) 2025-12-04T09:01:05.4616429Z  return Github(auth=auth) 2025-12-04T09:01:05.4616967Z  2025-12-04T09:01:05.4617351Z  2025-12-04T09:01:05.4618092Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T09:01:05.4619138Z  repo = gh.get_repo(repo) 2025-12-04T09:01:05.4619755Z  return repo.get_issue(number=issue_num) 2025-12-04T09:01:05.4620366Z  2025-12-04T09:01:05.4620747Z  2025-12-04T09:01:05.4621171Z def get_potential_pr_author( 2025-12-04T09:01:05.4621944Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T09:01:05.4622737Z ) -> str: 2025-12-04T09:01:05.4623356Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T09:01:05.4624277Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T09:01:05.4625169Z  # embedded in the tag name: ciflow// 2025-12-04T09:01:05.4625823Z  2025-12-04T09:01:05.4626261Z  gh = get_gh_client(github_token) 2025-12-04T09:01:05.4626830Z  2025-12-04T09:01:05.4627365Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T09:01:05.4628112Z  split_tag = ref_name.split("/") 2025-12-04T09:01:05.4628833Z  if ( 2025-12-04T09:01:05.4629306Z  len(split_tag) == 3 2025-12-04T09:01:05.4629893Z  and split_tag[0] == "ciflow" 2025-12-04T09:01:05.4630527Z  and split_tag[2].isnumeric() 2025-12-04T09:01:05.4631109Z  ): 2025-12-04T09:01:05.4631592Z  pr_number = split_tag[2] 2025-12-04T09:01:05.4632171Z  try: 2025-12-04T09:01:05.4632706Z  repository = gh.get_repo(repo) 2025-12-04T09:01:05.4633572Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T09:01:05.4634393Z  except Exception as e: 2025-12-04T09:01:05.4635221Z  raise Exception( # noqa: TRY002 2025-12-04T09:01:05.4636000Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T09:01:05.4636751Z  ) from e 2025-12-04T09:01:05.4637433Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T09:01:05.4638813Z  # In all other cases, return the original input username 2025-12-04T09:01:05.4639543Z  return username 2025-12-04T09:01:05.4640031Z  2025-12-04T09:01:05.4640420Z  2025-12-04T09:01:05.4640902Z def is_exception_branch(branch: str) -> bool: 2025-12-04T09:01:05.4641527Z  """ 2025-12-04T09:01:05.4642280Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T09:01:05.4643184Z  """ 2025-12-04T09:01:05.4643817Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T09:01:05.4644584Z  2025-12-04T09:01:05.4644967Z  2025-12-04T09:01:05.4645405Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T09:01:05.4645986Z  try: 2025-12-04T09:01:05.4646455Z  data = yaml.safe_load(yaml_text) 2025-12-04T09:01:05.4647049Z  return data 2025-12-04T09:01:05.4647564Z  except yaml.YAMLError: 2025-12-04T09:01:05.4648266Z  log.exception("Error loading YAML") 2025-12-04T09:01:05.4648871Z  raise 2025-12-04T09:01:05.4649317Z  2025-12-04T09:01:05.4649706Z  2025-12-04T09:01:05.4650397Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T09:01:05.4651254Z  """ 2025-12-04T09:01:05.4652118Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T09:01:05.4652994Z  2025-12-04T09:01:05.4653602Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T09:01:05.4654501Z  and the text below is the list of opted in users. 2025-12-04T09:01:05.4655159Z  2025-12-04T09:01:05.4655807Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T09:01:05.4656612Z  """ 2025-12-04T09:01:05.4657158Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T09:01:05.4657851Z  if len(rollout_state_parts) >= 2: 2025-12-04T09:01:05.4658673Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T09:01:05.4659357Z  else: 2025-12-04T09:01:05.4659814Z  return "", rollout_state 2025-12-04T09:01:05.4660357Z  2025-12-04T09:01:05.4660745Z  2025-12-04T09:01:05.4661192Z class UserOptins(dict[str, list[str]]): 2025-12-04T09:01:05.4661780Z  """ 2025-12-04T09:01:05.4662394Z  Dictionary of users with a list of features they have opted into 2025-12-04T09:01:05.4663120Z  """ 2025-12-04T09:01:05.4663524Z  2025-12-04T09:01:05.4663905Z  2025-12-04T09:01:05.4664530Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T09:01:05.4665296Z  """ 2025-12-04T09:01:05.4666099Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T09:01:05.4667053Z  2025-12-04T09:01:05.4667936Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T09:01:05.4669240Z  - Example line: "@User1,lf,split_build" 2025-12-04T09:01:05.4670163Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T09:01:05.4670902Z  2025-12-04T09:01:05.4671288Z  2025-12-04T09:01:05.4671662Z  """ 2025-12-04T09:01:05.4672097Z  optins = UserOptins() 2025-12-04T09:01:05.4672709Z  for user in user_optin_text.split("\n"): 2025-12-04T09:01:05.4673357Z  user = user.strip("\r\n\t -") 2025-12-04T09:01:05.4674001Z  if not user or not user.startswith("@"): 2025-12-04T09:01:05.4674682Z  # Not a valid user. Skip 2025-12-04T09:01:05.4675248Z  continue 2025-12-04T09:01:05.4675732Z  2025-12-04T09:01:05.4676123Z  if user: 2025-12-04T09:01:05.4676655Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T09:01:05.4677478Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T09:01:05.4678311Z  2025-12-04T09:01:05.4678713Z  return optins 2025-12-04T09:01:05.4679182Z  2025-12-04T09:01:05.4679558Z  2025-12-04T09:01:05.4680107Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T09:01:05.4680816Z  """ 2025-12-04T09:01:05.4681308Z  Check if the experiment name is valid. 2025-12-04T09:01:05.4681914Z  A valid name: 2025-12-04T09:01:05.4682682Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T09:01:05.4683754Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T09:01:05.4684613Z  - Cannot contain spaces 2025-12-04T09:01:05.4685165Z  """ 2025-12-04T09:01:05.4685569Z  2025-12-04T09:01:05.4686083Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T09:01:05.4686906Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T09:01:05.4687727Z  2025-12-04T09:01:05.4688237Z  if valid: 2025-12-04T09:01:05.4688709Z  return True 2025-12-04T09:01:05.4689394Z  2025-12-04T09:01:05.4689834Z  log.error( 2025-12-04T09:01:05.4691426Z  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-04T09:01:05.4693225Z  ) 2025-12-04T09:01:05.4693636Z  return False 2025-12-04T09:01:05.4694093Z  2025-12-04T09:01:05.4694489Z  2025-12-04T09:01:05.4695063Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T09:01:05.4695793Z  """ 2025-12-04T09:01:05.4696475Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T09:01:05.4697299Z  """ 2025-12-04T09:01:05.4697712Z  try: 2025-12-04T09:01:05.4698239Z  if settings_text: 2025-12-04T09:01:05.4699082Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T09:01:05.4699985Z  # for easy reading 2025-12-04T09:01:05.4700909Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T09:01:05.4701935Z  # the backtick character in shell commands. 2025-12-04T09:01:05.4702638Z  backtick = chr(96) # backtick character 2025-12-04T09:01:05.4703414Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T09:01:05.4704191Z  settings = load_yaml(settings_text) 2025-12-04T09:01:05.4704787Z  2025-12-04T09:01:05.4705458Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T09:01:05.4706438Z  experiments = {} 2025-12-04T09:01:05.4706972Z  2025-12-04T09:01:05.4707592Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T09:01:05.4708625Z  if not is_valid_experiment_name(exp_name): 2025-12-04T09:01:05.4709850Z  # 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-04T09:01:05.4711043Z  continue 2025-12-04T09:01:05.4711564Z  2025-12-04T09:01:05.4711982Z  valid_settings = {} 2025-12-04T09:01:05.4712602Z  for setting in exp_settings: 2025-12-04T09:01:05.4713255Z  if setting not in Experiment._fields: 2025-12-04T09:01:05.4713910Z  log.warning( 2025-12-04T09:01:05.4714742Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T09:01:05.4715545Z  ) 2025-12-04T09:01:05.4716064Z  else: 2025-12-04T09:01:05.4716677Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T09:01:05.4717340Z  2025-12-04T09:01:05.4717860Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T09:01:05.4718742Z  return Settings(experiments) 2025-12-04T09:01:05.4719319Z  2025-12-04T09:01:05.4719722Z  except Exception: 2025-12-04T09:01:05.4720308Z  log.exception("Failed to parse settings") 2025-12-04T09:01:05.4720915Z  2025-12-04T09:01:05.4721313Z  return Settings() 2025-12-04T09:01:05.4721795Z  2025-12-04T09:01:05.4722172Z  2025-12-04T09:01:05.4722808Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T09:01:05.4723483Z  """ 2025-12-04T09:01:05.4723995Z  Parse settings, if any, from the rollout state. 2025-12-04T09:01:05.4724616Z  2025-12-04T09:01:05.4725218Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T09:01:05.4726090Z  and the text below is the list of opted in users. 2025-12-04T09:01:05.4726723Z  2025-12-04T09:01:05.4727382Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T09:01:05.4728307Z  """ 2025-12-04T09:01:05.4728953Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T09:01:05.4729835Z  return parse_settings_from_text(settings_text) 2025-12-04T09:01:05.4730463Z  2025-12-04T09:01:05.4730830Z  2025-12-04T09:01:05.4731342Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T09:01:05.4731999Z  """ 2025-12-04T09:01:05.4732464Z  Parse users from the rollout state. 2025-12-04T09:01:05.4733042Z  2025-12-04T09:01:05.4733418Z  """ 2025-12-04T09:01:05.4734055Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T09:01:05.4734929Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T09:01:05.4735557Z  2025-12-04T09:01:05.4735923Z  2025-12-04T09:01:05.4736610Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T09:01:05.4737460Z  """ 2025-12-04T09:01:05.4737955Z  Check if a user is opted into an experiment 2025-12-04T09:01:05.4738713Z  """ 2025-12-04T09:01:05.4739249Z  return experiment_name in user_optins.get(user, []) 2025-12-04T09:01:05.4740058Z  2025-12-04T09:01:05.4740429Z  2025-12-04T09:01:05.4741138Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T09:01:05.4742001Z  """ 2025-12-04T09:01:05.4742547Z  Check if a user explicitly opted out of an experiment 2025-12-04T09:01:05.4743213Z  """ 2025-12-04T09:01:05.4743795Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T09:01:05.4744601Z  experiment_optout = "-" + experiment_name 2025-12-04T09:01:05.4745341Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T09:01:05.4746039Z  return False 2025-12-04T09:01:05.4746510Z  2025-12-04T09:01:05.4747028Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T09:01:05.4747713Z  log.warning( 2025-12-04T09:01:05.4748746Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T09:01:05.4749748Z  ) 2025-12-04T09:01:05.4750158Z  2025-12-04T09:01:05.4750552Z  return True 2025-12-04T09:01:05.4751010Z  2025-12-04T09:01:05.4751392Z  2025-12-04T09:01:05.4751789Z def get_runner_prefix( 2025-12-04T09:01:05.4752321Z  rollout_state: str, 2025-12-04T09:01:05.4752886Z  workflow_requestors: Iterable[str], 2025-12-04T09:01:05.4753467Z  branch: str, 2025-12-04T09:01:05.4754068Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T09:01:05.4754848Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T09:01:05.4755525Z  is_canary: bool = False, 2025-12-04T09:01:05.4756055Z ) -> str: 2025-12-04T09:01:05.4756564Z  settings = parse_settings(rollout_state) 2025-12-04T09:01:05.4757249Z  user_optins = parse_users(rollout_state) 2025-12-04T09:01:05.4757845Z  2025-12-04T09:01:05.4758473Z  fleet_prefix = "" 2025-12-04T09:01:05.4758993Z  prefixes = [] 2025-12-04T09:01:05.4759739Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T09:01:05.4760812Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T09:01:05.4761639Z  log.info( 2025-12-04T09:01:05.4762429Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T09:01:05.4763274Z  ) 2025-12-04T09:01:05.4763748Z  continue 2025-12-04T09:01:05.4764219Z  2025-12-04T09:01:05.4764640Z  if opt_out_experiments: 2025-12-04T09:01:05.4765272Z  if experiment_name in opt_out_experiments: 2025-12-04T09:01:05.4766034Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T09:01:05.4766720Z  log.info( 2025-12-04T09:01:05.4767769Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T09:01:05.4768985Z  ) 2025-12-04T09:01:05.4769467Z  continue 2025-12-04T09:01:05.4769969Z  2025-12-04T09:01:05.4770382Z  if eligible_experiments: 2025-12-04T09:01:05.4771053Z  if experiment_name not in eligible_experiments: 2025-12-04T09:01:05.4771780Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T09:01:05.4772406Z  log.info( 2025-12-04T09:01:05.4773292Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T09:01:05.4774225Z  ) 2025-12-04T09:01:05.4774872Z  continue 2025-12-04T09:01:05.4775457Z  elif not experiment_settings.default: 2025-12-04T09:01:05.4776074Z  log.info( 2025-12-04T09:01:05.4776844Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T09:01:05.4777684Z  ) 2025-12-04T09:01:05.4778233Z  continue 2025-12-04T09:01:05.4778708Z  2025-12-04T09:01:05.4779244Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T09:01:05.4779947Z  opted_out_users = [ 2025-12-04T09:01:05.4780519Z  requestor 2025-12-04T09:01:05.4781085Z  for requestor in workflow_requestors 2025-12-04T09:01:05.4781854Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T09:01:05.4782577Z  ] 2025-12-04T09:01:05.4782992Z  2025-12-04T09:01:05.4783412Z  if opted_out_users: 2025-12-04T09:01:05.4783967Z  log.info( 2025-12-04T09:01:05.4784704Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T09:01:05.4785501Z  ) 2025-12-04T09:01:05.4785951Z  continue 2025-12-04T09:01:05.4786428Z  2025-12-04T09:01:05.4786953Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T09:01:05.4787655Z  opted_in_users = [ 2025-12-04T09:01:05.4788327Z  requestor 2025-12-04T09:01:05.4788894Z  for requestor in workflow_requestors 2025-12-04T09:01:05.4789662Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T09:01:05.4790371Z  ] 2025-12-04T09:01:05.4790793Z  2025-12-04T09:01:05.4791194Z  enabled = False 2025-12-04T09:01:05.4791719Z  if opted_in_users: 2025-12-04T09:01:05.4792372Z  log.info( 2025-12-04T09:01:05.4793099Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T09:01:05.4793872Z  ) 2025-12-04T09:01:05.4794341Z  enabled = True 2025-12-04T09:01:05.4794853Z  2025-12-04T09:01:05.4795316Z  elif experiment_settings.rollout_perc: 2025-12-04T09:01:05.4796256Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T09:01:05.4797322Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T09:01:05.4798066Z  log.info( 2025-12-04T09:01:05.4799161Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T09:01:05.4800205Z  ) 2025-12-04T09:01:05.4800713Z  enabled = True 2025-12-04T09:01:05.4801244Z  2025-12-04T09:01:05.4801644Z  if enabled: 2025-12-04T09:01:05.4802171Z  label = experiment_name 2025-12-04T09:01:05.4802821Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T09:01:05.4803756Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T09:01:05.4804748Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T09:01:05.4805615Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T09:01:05.4806363Z  if is_canary: 2025-12-04T09:01:05.4806952Z  label += CANARY_FLEET_SUFFIX 2025-12-04T09:01:05.4807581Z  fleet_prefix = label 2025-12-04T09:01:05.4808254Z  else: 2025-12-04T09:01:05.4808929Z  prefixes.append(label) 2025-12-04T09:01:05.4809512Z  2025-12-04T09:01:05.4809925Z  if len(prefixes) > 1: 2025-12-04T09:01:05.4810452Z  log.error( 2025-12-04T09:01:05.4811625Z  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-04T09:01:05.4812900Z  ) 2025-12-04T09:01:05.4813363Z  prefixes = prefixes[:1] 2025-12-04T09:01:05.4813908Z  2025-12-04T09:01:05.4814319Z  # Fleet always comes first 2025-12-04T09:01:05.4814887Z  if fleet_prefix: 2025-12-04T09:01:05.4815427Z  prefixes.insert(0, fleet_prefix) 2025-12-04T09:01:05.4816007Z  2025-12-04T09:01:05.4816506Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T09:01:05.4817163Z  2025-12-04T09:01:05.4817533Z  2025-12-04T09:01:05.4818338Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T09:01:05.4819217Z  """ 2025-12-04T09:01:05.4819884Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T09:01:05.4820697Z  2025-12-04T09:01:05.4821330Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T09:01:05.4822124Z  """ 2025-12-04T09:01:05.4822595Z  gh = get_gh_client(github_token) 2025-12-04T09:01:05.4823235Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T09:01:05.4823977Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T09:01:05.4824647Z  2025-12-04T09:01:05.4825048Z  2025-12-04T09:01:05.4825708Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T09:01:05.4826705Z  for _ in range(num_retries): 2025-12-04T09:01:05.4827272Z  try: 2025-12-04T09:01:05.4827788Z  req = Request(url=url, headers=headers) 2025-12-04T09:01:05.4828647Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T09:01:05.4829379Z  return json.loads(content) 2025-12-04T09:01:05.4829993Z  except Exception as e: 2025-12-04T09:01:05.4830644Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T09:01:05.4831274Z  2025-12-04T09:01:05.4831912Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T09:01:05.4832728Z  return {} 2025-12-04T09:01:05.4833178Z  2025-12-04T09:01:05.4833550Z  2025-12-04T09:01:05.4833936Z @cache 2025-12-04T09:01:05.4834647Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T09:01:05.4835520Z  """ 2025-12-04T09:01:05.4835986Z  Dynamically get PR information 2025-12-04T09:01:05.4836565Z  """ 2025-12-04T09:01:05.4837151Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T09:01:05.4837862Z  headers = { 2025-12-04T09:01:05.4838523Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T09:01:05.4839216Z  "Authorization": f"token {github_token}", 2025-12-04T09:01:05.4839824Z  } 2025-12-04T09:01:05.4840325Z  json_response: dict[str, Any] = download_json( 2025-12-04T09:01:05.4841025Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T09:01:05.4841651Z  headers=headers, 2025-12-04T09:01:05.4842159Z  ) 2025-12-04T09:01:05.4842556Z  2025-12-04T09:01:05.4842961Z  if not json_response: 2025-12-04T09:01:05.4843642Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T09:01:05.4844494Z  return {} 2025-12-04T09:01:05.4844972Z  2025-12-04T09:01:05.4845370Z  return json_response 2025-12-04T09:01:05.4845884Z  2025-12-04T09:01:05.4846256Z  2025-12-04T09:01:05.4846916Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T09:01:05.4847743Z  """ 2025-12-04T09:01:05.4848452Z  Dynamically get the latest list of labels from the pull request 2025-12-04T09:01:05.4849200Z  """ 2025-12-04T09:01:05.4849759Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T09:01:05.4850451Z  return { 2025-12-04T09:01:05.4851120Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T09:01:05.4851903Z  } 2025-12-04T09:01:05.4852310Z  2025-12-04T09:01:05.4852687Z  2025-12-04T09:01:05.4853093Z def main() -> None: 2025-12-04T09:01:05.4853599Z  args = parse_args() 2025-12-04T09:01:05.4854102Z  2025-12-04T09:01:05.4854573Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T09:01:05.4855183Z  2025-12-04T09:01:05.4855606Z  # Check if the PR is opt-out 2025-12-04T09:01:05.4856182Z  if args.pr_number: 2025-12-04T09:01:05.4856951Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T09:01:05.4857820Z  if OPT_OUT_LABEL in labels: 2025-12-04T09:01:05.4858492Z  log.info( 2025-12-04T09:01:05.4859293Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T09:01:05.4860164Z  ) 2025-12-04T09:01:05.4860821Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T09:01:05.4861603Z  sys.exit() 2025-12-04T09:01:05.4862218Z  2025-12-04T09:01:05.4862605Z  try: 2025-12-04T09:01:05.4863126Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T09:01:05.4863933Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T09:01:05.4864664Z  ) 2025-12-04T09:01:05.4865077Z  2025-12-04T09:01:05.4865523Z  username = get_potential_pr_author( 2025-12-04T09:01:05.4866139Z  args.github_token, 2025-12-04T09:01:05.4866702Z  args.github_repo, 2025-12-04T09:01:05.4867268Z  args.github_actor, 2025-12-04T09:01:05.4867839Z  args.github_ref_type, 2025-12-04T09:01:05.4868524Z  args.github_branch, 2025-12-04T09:01:05.4869060Z  ) 2025-12-04T09:01:05.4869552Z  2025-12-04T09:01:05.4870090Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T09:01:05.4870776Z  2025-12-04T09:01:05.4871243Z  runner_label_prefix = get_runner_prefix( 2025-12-04T09:01:05.4871864Z  rollout_state, 2025-12-04T09:01:05.4872449Z  (args.github_issue_owner, username), 2025-12-04T09:01:05.4873073Z  args.github_branch, 2025-12-04T09:01:05.4873674Z  args.eligible_experiments, 2025-12-04T09:01:05.4874293Z  args.opt_out_experiments, 2025-12-04T09:01:05.4874911Z  is_canary, 2025-12-04T09:01:05.4875406Z  ) 2025-12-04T09:01:05.4875814Z  2025-12-04T09:01:05.4876231Z  except Exception as e: 2025-12-04T09:01:05.4876770Z  log.error( 2025-12-04T09:01:05.4877560Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T09:01:05.4878662Z  ) 2025-12-04T09:01:05.4879101Z  2025-12-04T09:01:05.4879687Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T09:01:05.4880433Z  2025-12-04T09:01:05.4880814Z  2025-12-04T09:01:05.4881216Z if __name__ == "__main__": 2025-12-04T09:01:05.4881747Z  main() 2025-12-04T09:01:05.4882169Z  2025-12-04T09:01:05.4882553Z EOF 2025-12-04T09:01:05.4882934Z  2025-12-04T09:01:05.4883364Z cat runner_determinator.py 2025-12-04T09:01:05.5357375Z shell: /usr/bin/bash -e {0} 2025-12-04T09:01:05.5358455Z env: 2025-12-04T09:01:05.5359241Z GITHUB_TOKEN: *** 2025-12-04T09:01:05.5359704Z ISSUE_NUMBER: 5132 2025-12-04T09:01:05.5360192Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T09:01:05.5360748Z ISSUE_OWNER: 2025-12-04T09:01:05.5361180Z CHECK_EXPERIMENTS: 2025-12-04T09:01:05.5361714Z OPT_OUT_EXPERIMENTS: 2025-12-04T09:01:05.5362188Z PR_NUMBER: 2025-12-04T09:01:05.5362621Z ##[endgroup] 2025-12-04T09:01:05.5581068Z # flake8: noqa: G004 2025-12-04T09:01:05.5581425Z 2025-12-04T09:01:05.5581871Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T09:01:05.5582833Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T09:01:05.5583629Z # python .github/scripts/update_runner_determinator.py 2025-12-04T09:01:05.5584070Z 2025-12-04T09:01:05.5584226Z """ 2025-12-04T09:01:05.5584804Z This runner determinator is used to determine which set of runners to run a 2025-12-04T09:01:05.5585676Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T09:01:05.5586586Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T09:01:05.5587419Z of which runners should be used to run which job. 2025-12-04T09:01:05.5587829Z 2025-12-04T09:01:05.5588484Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T09:01:05.5589822Z separated by a line containing "---". If the line is not present, the 2025-12-04T09:01:05.5590845Z settings are considered to be empty with only the second part, the user 2025-12-04T09:01:05.5591562Z list, defined. 2025-12-04T09:01:05.5591788Z 2025-12-04T09:01:05.5592153Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T09:01:05.5593132Z used to define any settings that are needed to determine which runners to use. 2025-12-04T09:01:05.5593968Z It's fields are defined by the RolloutSettings class below. 2025-12-04T09:01:05.5594419Z 2025-12-04T09:01:05.5594794Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T09:01:05.5595673Z The user list is also a comma separated list of additional features or 2025-12-04T09:01:05.5596407Z experiments which the user could be opted in to. 2025-12-04T09:01:05.5596811Z 2025-12-04T09:01:05.5597012Z The user list has the following rules: 2025-12-04T09:01:05.5597365Z 2025-12-04T09:01:05.5597680Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T09:01:05.5599190Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T09:01:05.5600014Z - A "#" prefix opts the user out of all experiments 2025-12-04T09:01:05.5600411Z 2025-12-04T09:01:05.5600589Z Example config: 2025-12-04T09:01:05.5601041Z # A list of experiments that can be opted into. 2025-12-04T09:01:05.5601712Z # This defines the behavior they'll induce when opted into. 2025-12-04T09:01:05.5602337Z # Expected syntax is: 2025-12-04T09:01:05.5602981Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T09:01:05.5603969Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T09:01:05.5604573Z 2025-12-04T09:01:05.5604753Z experiments: 2025-12-04T09:01:05.5605144Z lf: 2025-12-04T09:01:05.5605563Z rollout_percent: 25 2025-12-04T09:01:05.5606189Z all_branches: false 2025-12-04T09:01:05.5606645Z default: true 2025-12-04T09:01:05.5607054Z --- 2025-12-04T09:01:05.5607265Z 2025-12-04T09:01:05.5607433Z # Opt-ins: 2025-12-04T09:01:05.5608014Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T09:01:05.5609374Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T09:01:05.5610168Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T09:01:05.5610831Z # Experiments should be from the above list. 2025-12-04T09:01:05.5611213Z 2025-12-04T09:01:05.5611405Z @User1,-lf,split_build 2025-12-04T09:01:05.5611840Z @User2,lf 2025-12-04T09:01:05.5612238Z @User3,split_build 2025-12-04T09:01:05.5612651Z """ 2025-12-04T09:01:05.5612856Z 2025-12-04T09:01:05.5613022Z import json 2025-12-04T09:01:05.5613393Z import logging 2025-12-04T09:01:05.5613782Z import os 2025-12-04T09:01:05.5614142Z import random 2025-12-04T09:01:05.5614529Z import re 2025-12-04T09:01:05.5614897Z import sys 2025-12-04T09:01:05.5615299Z from argparse import ArgumentParser 2025-12-04T09:01:05.5615843Z from collections.abc import Iterable 2025-12-04T09:01:05.5616367Z from functools import cache 2025-12-04T09:01:05.5616842Z from logging import LogRecord 2025-12-04T09:01:05.5617333Z from typing import Any, NamedTuple 2025-12-04T09:01:05.5617878Z from urllib.request import Request, urlopen 2025-12-04T09:01:05.5618513Z 2025-12-04T09:01:05.5618781Z import yaml 2025-12-04T09:01:05.5619200Z from github import Auth, Github 2025-12-04T09:01:05.5619691Z from github.Issue import Issue 2025-12-04T09:01:05.5619998Z 2025-12-04T09:01:05.5620005Z 2025-12-04T09:01:05.5620225Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T09:01:05.5620914Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T09:01:05.5621787Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T09:01:05.5622351Z 2025-12-04T09:01:05.5622587Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T09:01:05.5623300Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T09:01:05.5623838Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T09:01:05.5624389Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T09:01:05.5624746Z 2025-12-04T09:01:05.5624946Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T09:01:05.5625277Z 2025-12-04T09:01:05.5625476Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T09:01:05.5625939Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T09:01:05.5626222Z 2025-12-04T09:01:05.5626228Z 2025-12-04T09:01:05.5626420Z class Experiment(NamedTuple): 2025-12-04T09:01:05.5626905Z rollout_perc: float = ( 2025-12-04T09:01:05.5627551Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T09:01:05.5628462Z ) 2025-12-04T09:01:05.5628991Z all_branches: bool = ( 2025-12-04T09:01:05.5629622Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T09:01:05.5630296Z ) 2025-12-04T09:01:05.5630672Z default: bool = ( 2025-12-04T09:01:05.5631242Z True # If True, the experiment is enabled by default for all queries 2025-12-04T09:01:05.5631884Z ) 2025-12-04T09:01:05.5632077Z 2025-12-04T09:01:05.5632263Z # Add more fields as needed 2025-12-04T09:01:05.5632569Z 2025-12-04T09:01:05.5632576Z 2025-12-04T09:01:05.5632768Z class Settings(NamedTuple): 2025-12-04T09:01:05.5633215Z """ 2025-12-04T09:01:05.5633670Z Settings for the experiments that can be opted into. 2025-12-04T09:01:05.5634242Z """ 2025-12-04T09:01:05.5634439Z 2025-12-04T09:01:05.5634650Z experiments: dict[str, Experiment] = {} 2025-12-04T09:01:05.5635015Z 2025-12-04T09:01:05.5635022Z 2025-12-04T09:01:05.5635232Z class ColorFormatter(logging.Formatter): 2025-12-04T09:01:05.5635857Z """Color codes the log messages based on the log level""" 2025-12-04T09:01:05.5636294Z 2025-12-04T09:01:05.5636465Z COLORS = { 2025-12-04T09:01:05.5636869Z "WARNING": "\033[33m", # Yellow 2025-12-04T09:01:05.5637523Z "ERROR": "\033[31m", # Red 2025-12-04T09:01:05.5638043Z "CRITICAL": "\033[31m", # Red 2025-12-04T09:01:05.5638974Z "INFO": "\033[0m", # Reset 2025-12-04T09:01:05.5639474Z "DEBUG": "\033[0m", # Reset 2025-12-04T09:01:05.5639943Z } 2025-12-04T09:01:05.5640148Z 2025-12-04T09:01:05.5640371Z def format(self, record: LogRecord) -> str: 2025-12-04T09:01:05.5641116Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T09:01:05.5641897Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T09:01:05.5642485Z return super().format(record) 2025-12-04T09:01:05.5642817Z 2025-12-04T09:01:05.5642823Z 2025-12-04T09:01:05.5643017Z handler = logging.StreamHandler() 2025-12-04T09:01:05.5643718Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T09:01:05.5644273Z 2025-12-04T09:01:05.5644516Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T09:01:05.5645101Z log.addHandler(handler) 2025-12-04T09:01:05.5645547Z log.setLevel(logging.INFO) 2025-12-04T09:01:05.5645832Z 2025-12-04T09:01:05.5645840Z 2025-12-04T09:01:05.5646089Z def set_github_output(key: str, value: str) -> None: 2025-12-04T09:01:05.5646646Z """ 2025-12-04T09:01:05.5647144Z Defines outputs of the github action that invokes this script 2025-12-04T09:01:05.5647782Z """ 2025-12-04T09:01:05.5648345Z if not GITHUB_OUTPUT: 2025-12-04T09:01:05.5649547Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T09:01:05.5650659Z log.warning( 2025-12-04T09:01:05.5651519Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T09:01:05.5652474Z ) 2025-12-04T09:01:05.5662641Z print(f"::set-output name={key}::{value}") 2025-12-04T09:01:05.5663257Z return 2025-12-04T09:01:05.5663508Z 2025-12-04T09:01:05.5663893Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T09:01:05.5664493Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T09:01:05.5665074Z f.write(f"{key}={value}\n") 2025-12-04T09:01:05.5665399Z 2025-12-04T09:01:05.5665405Z 2025-12-04T09:01:05.5665708Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T09:01:05.5666340Z return frozenset( 2025-12-04T09:01:05.5666946Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T09:01:05.5667634Z ) 2025-12-04T09:01:05.5667835Z 2025-12-04T09:01:05.5667842Z 2025-12-04T09:01:05.5668027Z def parse_args() -> Any: 2025-12-04T09:01:05.5669016Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T09:01:05.5669907Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T09:01:05.5670733Z parser.add_argument( 2025-12-04T09:01:05.5671206Z "--github-issue-repo", 2025-12-04T09:01:05.5671682Z type=str, 2025-12-04T09:01:05.5672091Z required=False, 2025-12-04T09:01:05.5672538Z default="pytorch/test-infra", 2025-12-04T09:01:05.5673084Z help="GitHub repo to get the issue", 2025-12-04T09:01:05.5673593Z ) 2025-12-04T09:01:05.5673972Z parser.add_argument( 2025-12-04T09:01:05.5674422Z "--github-repo", 2025-12-04T09:01:05.5674861Z type=str, 2025-12-04T09:01:05.5675259Z required=True, 2025-12-04T09:01:05.5675726Z help="GitHub repo where CI is running", 2025-12-04T09:01:05.5676249Z ) 2025-12-04T09:01:05.5676621Z parser.add_argument( 2025-12-04T09:01:05.5677231Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T09:01:05.5677886Z ) 2025-12-04T09:01:05.5678501Z parser.add_argument( 2025-12-04T09:01:05.5679268Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T09:01:05.5679952Z ) 2025-12-04T09:01:05.5680316Z parser.add_argument( 2025-12-04T09:01:05.5681124Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T09:01:05.5681815Z ) 2025-12-04T09:01:05.5682191Z parser.add_argument( 2025-12-04T09:01:05.5682840Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T09:01:05.5683561Z ) 2025-12-04T09:01:05.5683934Z parser.add_argument( 2025-12-04T09:01:05.5684386Z "--github-ref-type", 2025-12-04T09:01:05.5684837Z type=str, 2025-12-04T09:01:05.5685240Z required=True, 2025-12-04T09:01:05.5685729Z help="Current GitHub ref type, branch or tag", 2025-12-04T09:01:05.5686278Z ) 2025-12-04T09:01:05.5686655Z parser.add_argument( 2025-12-04T09:01:05.5687105Z "--eligible-experiments", 2025-12-04T09:01:05.5737079Z type=_str_comma_separated_to_set, 2025-12-04T09:01:05.5737741Z required=False, 2025-12-04T09:01:05.5738315Z default="", 2025-12-04T09:01:05.5739182Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T09:01:05.5740107Z ) 2025-12-04T09:01:05.5740480Z parser.add_argument( 2025-12-04T09:01:05.5740947Z "--opt-out-experiments", 2025-12-04T09:01:05.5741464Z type=_str_comma_separated_to_set, 2025-12-04T09:01:05.5741996Z required=False, 2025-12-04T09:01:05.5742412Z default="", 2025-12-04T09:01:05.5742804Z help=( 2025-12-04T09:01:05.5743468Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T09:01:05.5744597Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T09:01:05.5745425Z ), 2025-12-04T09:01:05.5745780Z ) 2025-12-04T09:01:05.5746144Z parser.add_argument( 2025-12-04T09:01:05.5746590Z "--pr-number", 2025-12-04T09:01:05.5747007Z type=str, 2025-12-04T09:01:05.5747410Z required=False, 2025-12-04T09:01:05.5747828Z default="", 2025-12-04T09:01:05.5748604Z help="the optional PR number where this is run", 2025-12-04T09:01:05.5749276Z ) 2025-12-04T09:01:05.5749476Z 2025-12-04T09:01:05.5749669Z return parser.parse_args() 2025-12-04T09:01:05.5749983Z 2025-12-04T09:01:05.5749991Z 2025-12-04T09:01:05.5750396Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T09:01:05.5751147Z auth = Auth.Token(github_token) 2025-12-04T09:01:05.5751654Z return Github(auth=auth) 2025-12-04T09:01:05.5751943Z 2025-12-04T09:01:05.5751951Z 2025-12-04T09:01:05.5752409Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T09:01:05.5753209Z repo = gh.get_repo(repo) 2025-12-04T09:01:05.5753713Z return repo.get_issue(number=issue_num) 2025-12-04T09:01:05.5754075Z 2025-12-04T09:01:05.5754083Z 2025-12-04T09:01:05.5754269Z def get_potential_pr_author( 2025-12-04T09:01:05.5754924Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T09:01:05.5755591Z ) -> str: 2025-12-04T09:01:05.5756111Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T09:01:05.5756916Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T09:01:05.5757653Z # embedded in the tag name: ciflow// 2025-12-04T09:01:05.5758063Z 2025-12-04T09:01:05.5758571Z gh = get_gh_client(github_token) 2025-12-04T09:01:05.5759057Z 2025-12-04T09:01:05.5759333Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T09:01:05.5759956Z split_tag = ref_name.split("/") 2025-12-04T09:01:05.5760452Z if ( 2025-12-04T09:01:05.5760840Z len(split_tag) == 3 2025-12-04T09:01:05.5761323Z and split_tag[0] == "ciflow" 2025-12-04T09:01:05.5761848Z and split_tag[2].isnumeric() 2025-12-04T09:01:05.5762345Z ): 2025-12-04T09:01:05.5762724Z pr_number = split_tag[2] 2025-12-04T09:01:05.5763372Z try: 2025-12-04T09:01:05.5763808Z repository = gh.get_repo(repo) 2025-12-04T09:01:05.5764427Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T09:01:05.5765024Z except Exception as e: 2025-12-04T09:01:05.5765542Z raise Exception( # noqa: TRY002 2025-12-04T09:01:05.5766207Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T09:01:05.5766840Z ) from e 2025-12-04T09:01:05.5767380Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T09:01:05.5768063Z # In all other cases, return the original input username 2025-12-04T09:01:05.5768776Z return username 2025-12-04T09:01:05.5769019Z 2025-12-04T09:01:05.5769027Z 2025-12-04T09:01:05.5769252Z def is_exception_branch(branch: str) -> bool: 2025-12-04T09:01:05.5769783Z """ 2025-12-04T09:01:05.5770414Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T09:01:05.5771185Z """ 2025-12-04T09:01:05.5771735Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T09:01:05.5772247Z 2025-12-04T09:01:05.5772255Z 2025-12-04T09:01:05.5772452Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T09:01:05.5772945Z try: 2025-12-04T09:01:05.5773329Z data = yaml.safe_load(yaml_text) 2025-12-04T09:01:05.5773836Z return data 2025-12-04T09:01:05.5774246Z except yaml.YAMLError: 2025-12-04T09:01:05.5774737Z log.exception("Error loading YAML") 2025-12-04T09:01:05.5775251Z raise 2025-12-04T09:01:05.5775465Z 2025-12-04T09:01:05.5775472Z 2025-12-04T09:01:05.5775898Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T09:01:05.5776639Z """ 2025-12-04T09:01:05.5777255Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T09:01:05.5777852Z 2025-12-04T09:01:05.5778503Z If the issue body contains "---" then the text above that is the settings 2025-12-04T09:01:05.5779278Z and the text below is the list of opted in users. 2025-12-04T09:01:05.5779687Z 2025-12-04T09:01:05.5780059Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T09:01:05.5780756Z """ 2025-12-04T09:01:05.5781191Z rollout_state_parts = rollout_state.split("---") 2025-12-04T09:01:05.5781809Z if len(rollout_state_parts) >= 2: 2025-12-04T09:01:05.5782411Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T09:01:05.5783005Z else: 2025-12-04T09:01:05.5783385Z return "", rollout_state 2025-12-04T09:01:05.5783697Z 2025-12-04T09:01:05.5783704Z 2025-12-04T09:01:05.5783907Z class UserOptins(dict[str, list[str]]): 2025-12-04T09:01:05.5784410Z """ 2025-12-04T09:01:05.5784929Z Dictionary of users with a list of features they have opted into 2025-12-04T09:01:05.5785573Z """ 2025-12-04T09:01:05.5785775Z 2025-12-04T09:01:05.5785782Z 2025-12-04T09:01:05.5786120Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T09:01:05.5786767Z """ 2025-12-04T09:01:05.5787467Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T09:01:05.5788270Z 2025-12-04T09:01:05.5788888Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T09:01:05.5789871Z - Example line: "@User1,lf,split_build" 2025-12-04T09:01:05.5790548Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T09:01:05.5791028Z 2025-12-04T09:01:05.5791035Z 2025-12-04T09:01:05.5791190Z """ 2025-12-04T09:01:05.5791562Z optins = UserOptins() 2025-12-04T09:01:05.5792055Z for user in user_optin_text.split("\n"): 2025-12-04T09:01:05.5792633Z user = user.strip("\r\n\t -") 2025-12-04T09:01:05.5793182Z if not user or not user.startswith("@"): 2025-12-04T09:01:05.5793876Z # Not a valid user. Skip 2025-12-04T09:01:05.5794356Z continue 2025-12-04T09:01:05.5794598Z 2025-12-04T09:01:05.5794766Z if user: 2025-12-04T09:01:05.5795203Z usr_name = user.split(",")[0].strip("@") 2025-12-04T09:01:05.5795888Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T09:01:05.5796375Z 2025-12-04T09:01:05.5796545Z return optins 2025-12-04T09:01:05.5796786Z 2025-12-04T09:01:05.5796793Z 2025-12-04T09:01:05.5797078Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T09:01:05.5797679Z """ 2025-12-04T09:01:05.5798074Z Check if the experiment name is valid. 2025-12-04T09:01:05.5799053Z A valid name: 2025-12-04T09:01:05.5799697Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T09:01:05.5800663Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T09:01:05.5801393Z - Cannot contain spaces 2025-12-04T09:01:05.5801860Z """ 2025-12-04T09:01:05.5802057Z 2025-12-04T09:01:05.5802323Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T09:01:05.5803016Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T09:01:05.5803461Z 2025-12-04T09:01:05.5803631Z if valid: 2025-12-04T09:01:05.5804004Z return True 2025-12-04T09:01:05.5804248Z 2025-12-04T09:01:05.5804411Z log.error( 2025-12-04T09:01:05.5805869Z 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-04T09:01:05.5807423Z ) 2025-12-04T09:01:05.5807781Z return False 2025-12-04T09:01:05.5808014Z 2025-12-04T09:01:05.5808022Z 2025-12-04T09:01:05.5808459Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T09:01:05.5809106Z """ 2025-12-04T09:01:05.5809820Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T09:01:05.5810562Z """ 2025-12-04T09:01:05.5810911Z try: 2025-12-04T09:01:05.5811281Z if settings_text: 2025-12-04T09:01:05.5811997Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T09:01:05.5812784Z # for easy reading 2025-12-04T09:01:05.5813565Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T09:01:05.5814450Z # the backtick character in shell commands. 2025-12-04T09:01:05.5815057Z backtick = chr(96) # backtick character 2025-12-04T09:01:05.5815716Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T09:01:05.5816403Z settings = load_yaml(settings_text) 2025-12-04T09:01:05.5816776Z 2025-12-04T09:01:05.5817191Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T09:01:05.5817955Z experiments = {} 2025-12-04T09:01:05.5818403Z 2025-12-04T09:01:05.5818805Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T09:01:05.5819585Z if not is_valid_experiment_name(exp_name): 2025-12-04T09:01:05.5820692Z # 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-04T09:01:05.5821734Z continue 2025-12-04T09:01:05.5822022Z 2025-12-04T09:01:05.5822207Z valid_settings = {} 2025-12-04T09:01:05.5822734Z for setting in exp_settings: 2025-12-04T09:01:05.5823301Z if setting not in Experiment._fields: 2025-12-04T09:01:05.5823860Z log.warning( 2025-12-04T09:01:05.5824562Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T09:01:05.5825433Z ) 2025-12-04T09:01:05.5825863Z else: 2025-12-04T09:01:05.5826381Z valid_settings[setting] = exp_settings[setting] 2025-12-04T09:01:05.5826803Z 2025-12-04T09:01:05.5827084Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T09:01:05.5827711Z return Settings(experiments) 2025-12-04T09:01:05.5828058Z 2025-12-04T09:01:05.5828352Z except Exception: 2025-12-04T09:01:05.5828830Z log.exception("Failed to parse settings") 2025-12-04T09:01:05.5829221Z 2025-12-04T09:01:05.5829395Z return Settings() 2025-12-04T09:01:05.5829645Z 2025-12-04T09:01:05.5829651Z 2025-12-04T09:01:05.5829904Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T09:01:05.5830482Z """ 2025-12-04T09:01:05.5830923Z Parse settings, if any, from the rollout state. 2025-12-04T09:01:05.5831326Z 2025-12-04T09:01:05.5831676Z If the issue body contains "---" then the text above that is the settings 2025-12-04T09:01:05.5832448Z and the text below is the list of opted in users. 2025-12-04T09:01:05.5832848Z 2025-12-04T09:01:05.5833254Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T09:01:05.5833987Z """ 2025-12-04T09:01:05.5834529Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T09:01:05.5835285Z return parse_settings_from_text(settings_text) 2025-12-04T09:01:05.5835683Z 2025-12-04T09:01:05.5835691Z 2025-12-04T09:01:05.5835943Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T09:01:05.5836495Z """ 2025-12-04T09:01:05.5836886Z Parse users from the rollout state. 2025-12-04T09:01:05.5837236Z 2025-12-04T09:01:05.5837396Z """ 2025-12-04T09:01:05.5837920Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T09:01:05.5839091Z return parse_user_opt_in_from_text(users_text) 2025-12-04T09:01:05.5839506Z 2025-12-04T09:01:05.5839514Z 2025-12-04T09:01:05.5840066Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T09:01:05.5840824Z """ 2025-12-04T09:01:05.5841234Z Check if a user is opted into an experiment 2025-12-04T09:01:05.5841771Z """ 2025-12-04T09:01:05.5842224Z return experiment_name in user_optins.get(user, []) 2025-12-04T09:01:05.5842651Z 2025-12-04T09:01:05.5842657Z 2025-12-04T09:01:05.5843078Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T09:01:05.5843824Z """ 2025-12-04T09:01:05.5844279Z Check if a user explicitly opted out of an experiment 2025-12-04T09:01:05.5844861Z """ 2025-12-04T09:01:05.5845359Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T09:01:05.5846044Z experiment_optout = "-" + experiment_name 2025-12-04T09:01:05.5846678Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T09:01:05.5847287Z return False 2025-12-04T09:01:05.5847537Z 2025-12-04T09:01:05.5847815Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T09:01:05.5848537Z log.warning( 2025-12-04T09:01:05.5849341Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T09:01:05.5850216Z ) 2025-12-04T09:01:05.5850425Z 2025-12-04T09:01:05.5850602Z return True 2025-12-04T09:01:05.5850834Z 2025-12-04T09:01:05.5850841Z 2025-12-04T09:01:05.5851021Z def get_runner_prefix( 2025-12-04T09:01:05.5851462Z rollout_state: str, 2025-12-04T09:01:05.5851923Z workflow_requestors: Iterable[str], 2025-12-04T09:01:05.5852445Z branch: str, 2025-12-04T09:01:05.5852938Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T09:01:05.5853600Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T09:01:05.5854195Z is_canary: bool = False, 2025-12-04T09:01:05.5854648Z ) -> str: 2025-12-04T09:01:05.5855203Z settings = parse_settings(rollout_state) 2025-12-04T09:01:05.5855794Z user_optins = parse_users(rollout_state) 2025-12-04T09:01:05.5856165Z 2025-12-04T09:01:05.5856344Z fleet_prefix = "" 2025-12-04T09:01:05.5856773Z prefixes = [] 2025-12-04T09:01:05.5857405Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T09:01:05.5858497Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T09:01:05.5859210Z log.info( 2025-12-04T09:01:05.5859889Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T09:01:05.5860642Z ) 2025-12-04T09:01:05.5861030Z continue 2025-12-04T09:01:05.5861279Z 2025-12-04T09:01:05.5861474Z if opt_out_experiments: 2025-12-04T09:01:05.5862014Z if experiment_name in opt_out_experiments: 2025-12-04T09:01:05.5862659Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T09:01:05.5863249Z log.info( 2025-12-04T09:01:05.5864184Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T09:01:05.5865158Z ) 2025-12-04T09:01:05.5865558Z continue 2025-12-04T09:01:05.5865822Z 2025-12-04T09:01:05.5866014Z if eligible_experiments: 2025-12-04T09:01:05.5866603Z if experiment_name not in eligible_experiments: 2025-12-04T09:01:05.5867233Z exp_list = ", ".join(eligible_experiments) 2025-12-04T09:01:05.5867782Z log.info( 2025-12-04T09:01:05.5868677Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T09:01:05.5869514Z ) 2025-12-04T09:01:05.5869912Z continue 2025-12-04T09:01:05.5870378Z elif not experiment_settings.default: 2025-12-04T09:01:05.5870912Z log.info( 2025-12-04T09:01:05.5871686Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T09:01:05.5872459Z ) 2025-12-04T09:01:05.5872843Z continue 2025-12-04T09:01:05.5873121Z 2025-12-04T09:01:05.5873405Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T09:01:05.5874028Z opted_out_users = [ 2025-12-04T09:01:05.5874474Z requestor 2025-12-04T09:01:05.5874924Z for requestor in workflow_requestors 2025-12-04T09:01:05.5875608Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T09:01:05.5876242Z ] 2025-12-04T09:01:05.5876445Z 2025-12-04T09:01:05.5876626Z if opted_out_users: 2025-12-04T09:01:05.5877077Z log.info( 2025-12-04T09:01:05.5877698Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T09:01:05.5878779Z ) 2025-12-04T09:01:05.5879224Z continue 2025-12-04T09:01:05.5879488Z 2025-12-04T09:01:05.5879772Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T09:01:05.5880399Z opted_in_users = [ 2025-12-04T09:01:05.5880836Z requestor 2025-12-04T09:01:05.5881294Z for requestor in workflow_requestors 2025-12-04T09:01:05.5881960Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T09:01:05.5882580Z ] 2025-12-04T09:01:05.5882784Z 2025-12-04T09:01:05.5882959Z enabled = False 2025-12-04T09:01:05.5883388Z if opted_in_users: 2025-12-04T09:01:05.5883832Z log.info( 2025-12-04T09:01:05.5884425Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T09:01:05.5885103Z ) 2025-12-04T09:01:05.5885484Z enabled = True 2025-12-04T09:01:05.5885767Z 2025-12-04T09:01:05.5885983Z elif experiment_settings.rollout_perc: 2025-12-04T09:01:05.5886817Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T09:01:05.5887896Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T09:01:05.5888923Z log.info( 2025-12-04T09:01:05.5889783Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T09:01:05.5890704Z ) 2025-12-04T09:01:05.5891108Z enabled = True 2025-12-04T09:01:05.5891410Z 2025-12-04T09:01:05.5891577Z if enabled: 2025-12-04T09:01:05.5892002Z label = experiment_name 2025-12-04T09:01:05.5892586Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T09:01:05.5893427Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T09:01:05.5894306Z # - If it's enabled, then we always list it's prefix first 2025-12-04T09:01:05.5895069Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T09:01:05.5895732Z if is_canary: 2025-12-04T09:01:05.5896222Z label += CANARY_FLEET_SUFFIX 2025-12-04T09:01:05.5896774Z fleet_prefix = label 2025-12-04T09:01:05.5897264Z else: 2025-12-04T09:01:05.5897691Z prefixes.append(label) 2025-12-04T09:01:05.5898040Z 2025-12-04T09:01:05.5898744Z if len(prefixes) > 1: 2025-12-04T09:01:05.5899338Z log.error( 2025-12-04T09:01:05.5900357Z 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-04T09:01:05.5901454Z ) 2025-12-04T09:01:05.5901840Z prefixes = prefixes[:1] 2025-12-04T09:01:05.5902150Z 2025-12-04T09:01:05.5902340Z # Fleet always comes first 2025-12-04T09:01:05.5902803Z if fleet_prefix: 2025-12-04T09:01:05.5903232Z prefixes.insert(0, fleet_prefix) 2025-12-04T09:01:05.5903600Z 2025-12-04T09:01:05.5904022Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T09:01:05.5904441Z 2025-12-04T09:01:05.5904448Z 2025-12-04T09:01:05.5904894Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T09:01:05.5905662Z """ 2025-12-04T09:01:05.5906237Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T09:01:05.5906795Z 2025-12-04T09:01:05.5907178Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T09:01:05.5907874Z """ 2025-12-04T09:01:05.5908411Z gh = get_gh_client(github_token) 2025-12-04T09:01:05.5908953Z issue = get_issue(gh, repo, issue_num) 2025-12-04T09:01:05.5909574Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T09:01:05.5910012Z 2025-12-04T09:01:05.5910020Z 2025-12-04T09:01:05.5910412Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T09:01:05.5911161Z for _ in range(num_retries): 2025-12-04T09:01:05.5911630Z try: 2025-12-04T09:01:05.5912054Z req = Request(url=url, headers=headers) 2025-12-04T09:01:05.5912698Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T09:01:05.5913331Z return json.loads(content) 2025-12-04T09:01:05.5913844Z except Exception as e: 2025-12-04T09:01:05.5914376Z log.warning(f"Could not download {url}: {e}") 2025-12-04T09:01:05.5914767Z 2025-12-04T09:01:05.5915139Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T09:01:05.5915829Z return {} 2025-12-04T09:01:05.5916045Z 2025-12-04T09:01:05.5916052Z 2025-12-04T09:01:05.5916211Z @cache 2025-12-04T09:01:05.5916808Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T09:01:05.5917540Z """ 2025-12-04T09:01:05.5917917Z Dynamically get PR information 2025-12-04T09:01:05.5918649Z """ 2025-12-04T09:01:05.5919133Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T09:01:05.5919751Z headers = { 2025-12-04T09:01:05.5920202Z "Accept": "application/vnd.github.v3+json", 2025-12-04T09:01:05.5920797Z "Authorization": f"token {github_token}", 2025-12-04T09:01:05.5921320Z } 2025-12-04T09:01:05.5921734Z json_response: dict[str, Any] = download_json( 2025-12-04T09:01:05.5922326Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T09:01:05.5922864Z headers=headers, 2025-12-04T09:01:05.5923282Z ) 2025-12-04T09:01:05.5923479Z 2025-12-04T09:01:05.5923662Z if not json_response: 2025-12-04T09:01:05.5924236Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T09:01:05.5924845Z return {} 2025-12-04T09:01:05.5925088Z 2025-12-04T09:01:05.5925269Z return json_response 2025-12-04T09:01:05.5925543Z 2025-12-04T09:01:05.5925550Z 2025-12-04T09:01:05.5925956Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T09:01:05.5926684Z """ 2025-12-04T09:01:05.5927204Z Dynamically get the latest list of labels from the pull request 2025-12-04T09:01:05.5927855Z """ 2025-12-04T09:01:05.5928440Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T09:01:05.5929042Z return { 2025-12-04T09:01:05.5929626Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T09:01:05.5930306Z } 2025-12-04T09:01:05.5930508Z 2025-12-04T09:01:05.5930516Z 2025-12-04T09:01:05.5930685Z def main() -> None: 2025-12-04T09:01:05.5931104Z args = parse_args() 2025-12-04T09:01:05.5931366Z 2025-12-04T09:01:05.5931587Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T09:01:05.5931969Z 2025-12-04T09:01:05.5932162Z # Check if the PR is opt-out 2025-12-04T09:01:05.5932646Z if args.pr_number: 2025-12-04T09:01:05.5933293Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T09:01:05.5934176Z if OPT_OUT_LABEL in labels: 2025-12-04T09:01:05.5934689Z log.info( 2025-12-04T09:01:05.5935373Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T09:01:05.5936118Z ) 2025-12-04T09:01:05.5936657Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T09:01:05.5937312Z sys.exit() 2025-12-04T09:01:05.5937570Z 2025-12-04T09:01:05.5937730Z try: 2025-12-04T09:01:05.5938261Z rollout_state = get_rollout_state_from_issue( 2025-12-04T09:01:05.5938962Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T09:01:05.5939591Z ) 2025-12-04T09:01:05.5939788Z 2025-12-04T09:01:05.5939994Z username = get_potential_pr_author( 2025-12-04T09:01:05.5940524Z args.github_token, 2025-12-04T09:01:05.5940995Z args.github_repo, 2025-12-04T09:01:05.5941463Z args.github_actor, 2025-12-04T09:01:05.5941938Z args.github_ref_type, 2025-12-04T09:01:05.5942436Z args.github_branch, 2025-12-04T09:01:05.5942893Z ) 2025-12-04T09:01:05.5943102Z 2025-12-04T09:01:05.5943390Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T09:01:05.5943832Z 2025-12-04T09:01:05.5944053Z runner_label_prefix = get_runner_prefix( 2025-12-04T09:01:05.5944595Z rollout_state, 2025-12-04T09:01:05.5945070Z (args.github_issue_owner, username), 2025-12-04T09:01:05.5945617Z args.github_branch, 2025-12-04T09:01:05.5946108Z args.eligible_experiments, 2025-12-04T09:01:05.5946627Z args.opt_out_experiments, 2025-12-04T09:01:05.5947125Z is_canary, 2025-12-04T09:01:05.5947528Z ) 2025-12-04T09:01:05.5947736Z 2025-12-04T09:01:05.5947918Z except Exception as e: 2025-12-04T09:01:05.5948462Z log.error( 2025-12-04T09:01:05.5949121Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T09:01:05.5950016Z ) 2025-12-04T09:01:05.5950218Z 2025-12-04T09:01:05.5950569Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T09:01:05.5951059Z 2025-12-04T09:01:05.5951067Z 2025-12-04T09:01:05.5951245Z if __name__ == "__main__": 2025-12-04T09:01:05.5951677Z main() 2025-12-04T09:01:05.5951898Z 2025-12-04T09:01:05.6043288Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T09:01:05.6044191Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T09:01:05.6076929Z shell: /usr/bin/bash -e {0} 2025-12-04T09:01:05.6077407Z env: 2025-12-04T09:01:05.6078019Z GITHUB_TOKEN: *** 2025-12-04T09:01:05.6078633Z ISSUE_NUMBER: 5132 2025-12-04T09:01:05.6079078Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T09:01:05.6079590Z ISSUE_OWNER: 2025-12-04T09:01:05.6079994Z CHECK_EXPERIMENTS: 2025-12-04T09:01:05.6080433Z OPT_OUT_EXPERIMENTS: 2025-12-04T09:01:05.6080871Z PR_NUMBER: 2025-12-04T09:01:05.6081250Z ##[endgroup] 2025-12-04T09:01:06.7027403Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T09:01:07.4236653Z Collecting urllib3==1.26.18 2025-12-04T09:01:07.4562735Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T09:01:07.4768724Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.2 MB/s eta 0:00:00 2025-12-04T09:01:07.5012009Z Collecting PyGithub==2.3.0 2025-12-04T09:01:07.5044105Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T09:01:07.5501433Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T09:01:07.5532912Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T09:01:07.5579535Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T09:01:07.5599073Z 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-04T09:01:07.5614634Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-12-04T09:01:07.5865208Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T09:01:07.5896108Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T09:01:07.6122755Z 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-04T09:01:07.7352675Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T09:01:07.7384361Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T09:01:07.9104443Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T09:01:07.9140726Z 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-04T09:01:07.9347684Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T09:01:07.9377145Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T09:01:07.9606529Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T09:01:07.9668343Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 33.1 MB/s eta 0:00:00 2025-12-04T09:01:07.9701031Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T09:01:07.9758407Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 82.5 MB/s eta 0:00:00 2025-12-04T09:01:07.9791071Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T09:01:07.9911721Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 133.7 MB/s eta 0:00:00 2025-12-04T09:01:07.9943101Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T09:01:08.0012888Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T09:01:08.0060074Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 66.0 MB/s eta 0:00:00 2025-12-04T09:01:08.0093149Z 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-04T09:01:08.0138021Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 40.3 MB/s eta 0:00:00 2025-12-04T09:01:08.0167850Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T09:01:08.0208774Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 44.9 MB/s eta 0:00:00 2025-12-04T09:01:08.3128910Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T09:01:08.8579616Z 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-04T09:01:08.9511206Z ##[group]Run curr_branch="main" 2025-12-04T09:01:08.9511517Z curr_branch="main" 2025-12-04T09:01:08.9511732Z curr_ref_type="branch" 2025-12-04T09:01:08.9511981Z echo "Current branch is '$curr_branch'" 2025-12-04T09:01:08.9512267Z  2025-12-04T09:01:08.9512453Z python3 runner_determinator.py \ 2025-12-04T09:01:08.9512735Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T09:01:08.9513007Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T09:01:08.9513264Z  --github-branch "$curr_branch" \ 2025-12-04T09:01:08.9513531Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T09:01:08.9513811Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T09:01:08.9514083Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T09:01:08.9514353Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T09:01:08.9514643Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T09:01:08.9515005Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T09:01:08.9515290Z  --pr-number "${PR_NUMBER}" 2025-12-04T09:01:08.9549736Z shell: /usr/bin/bash -e {0} 2025-12-04T09:01:08.9549959Z env: 2025-12-04T09:01:08.9550521Z GITHUB_TOKEN: *** 2025-12-04T09:01:08.9550713Z ISSUE_NUMBER: 5132 2025-12-04T09:01:08.9550912Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T09:01:08.9551145Z ISSUE_OWNER: 2025-12-04T09:01:08.9551312Z CHECK_EXPERIMENTS: 2025-12-04T09:01:08.9551501Z OPT_OUT_EXPERIMENTS: 2025-12-04T09:01:08.9551681Z PR_NUMBER: 2025-12-04T09:01:08.9551842Z ##[endgroup] 2025-12-04T09:01:08.9603513Z Current branch is 'main' 2025-12-04T09:01:10.4863330Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-12-04T09:01:10.4864754Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T09:01:10.4865991Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T09:01:10.4867179Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T09:01:10.4868065Z INFO : Setting output: label-type='lf.' 2025-12-04T09:01:10.5197927Z Evaluate and set job outputs 2025-12-04T09:01:10.5204689Z Set output 'label-type' 2025-12-04T09:01:10.5206627Z Cleaning up orphan processes