2025-08-26T19:31:42.8371317Z Current runner version: '2.328.0' 2025-08-26T19:31:42.8397374Z ##[group]Runner Image Provisioner 2025-08-26T19:31:42.8398223Z Hosted Compute Agent 2025-08-26T19:31:42.8398715Z Version: 20250825.382 2025-08-26T19:31:42.8399354Z Commit: 7109f2abf901479dac39397456e363ac0cca0730 2025-08-26T19:31:42.8400023Z Build Date: 2025-08-25T22:55:50Z 2025-08-26T19:31:42.8400605Z ##[endgroup] 2025-08-26T19:31:42.8401201Z ##[group]Operating System 2025-08-26T19:31:42.8401730Z Ubuntu 2025-08-26T19:31:42.8402199Z 24.04.2 2025-08-26T19:31:42.8402597Z LTS 2025-08-26T19:31:42.8403316Z ##[endgroup] 2025-08-26T19:31:42.8403777Z ##[group]Runner Image 2025-08-26T19:31:42.8404339Z Image: ubuntu-24.04 2025-08-26T19:31:42.8404913Z Version: 20250818.1.0 2025-08-26T19:31:42.8405904Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250818.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-26T19:31:42.8407623Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250818.1 2025-08-26T19:31:42.8408573Z ##[endgroup] 2025-08-26T19:31:42.8410955Z ##[group]GITHUB_TOKEN Permissions 2025-08-26T19:31:42.8413418Z Actions: read 2025-08-26T19:31:42.8413908Z Attestations: read 2025-08-26T19:31:42.8414524Z Checks: read 2025-08-26T19:31:42.8414969Z Contents: read 2025-08-26T19:31:42.8415424Z Deployments: read 2025-08-26T19:31:42.8416395Z Discussions: read 2025-08-26T19:31:42.8417237Z Issues: read 2025-08-26T19:31:42.8417695Z Metadata: read 2025-08-26T19:31:42.8418212Z Models: read 2025-08-26T19:31:42.8418691Z Packages: read 2025-08-26T19:31:42.8419173Z Pages: read 2025-08-26T19:31:42.8419702Z PullRequests: read 2025-08-26T19:31:42.8420188Z RepositoryProjects: read 2025-08-26T19:31:42.8420745Z SecurityEvents: read 2025-08-26T19:31:42.8421423Z Statuses: read 2025-08-26T19:31:42.8421873Z ##[endgroup] 2025-08-26T19:31:42.8424112Z Secret source: Actions 2025-08-26T19:31:42.8425265Z Prepare workflow directory 2025-08-26T19:31:42.8935223Z Prepare all required actions 2025-08-26T19:31:42.8991736Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (262640fd220236042fbf4443cc163c8838c84c3d) 2025-08-26T19:31:42.8996830Z ##[group] Inputs 2025-08-26T19:31:42.8997509Z check_experiments: 2025-08-26T19:31:42.8998121Z opt_out_experiments: 2025-08-26T19:31:42.8998648Z triggering_actor: pytorchmergebot 2025-08-26T19:31:42.8999288Z issue_owner: 2025-08-26T19:31:42.8999800Z curr_branch: main 2025-08-26T19:31:42.9000280Z curr_ref_type: branch 2025-08-26T19:31:42.9000908Z issue_number: 5132 2025-08-26T19:31:42.9001440Z ##[endgroup] 2025-08-26T19:31:42.9002023Z Complete job name: get-label-type / runner-determinator 2025-08-26T19:31:42.9594981Z ##[group]Run cat < runner_determinator.py 2025-08-26T19:31:42.9597524Z cat < runner_determinator.py 2025-08-26T19:31:42.9598180Z # flake8: noqa: G004 2025-08-26T19:31:42.9598721Z  2025-08-26T19:31:42.9599396Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:42.9600467Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:42.9601410Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:42.9602110Z  2025-08-26T19:31:42.9602562Z """ 2025-08-26T19:31:42.9603221Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:42.9604256Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:42.9605389Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:42.9606315Z of which runners should be used to run which job. 2025-08-26T19:31:42.9607329Z  2025-08-26T19:31:42.9608036Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:42.9609098Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:42.9610336Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:42.9611173Z list, defined. 2025-08-26T19:31:42.9611619Z  2025-08-26T19:31:42.9612357Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:42.9613381Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:42.9614299Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:42.9615080Z  2025-08-26T19:31:42.9615757Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:42.9616890Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:42.9617850Z experiments which the user could be opted in to. 2025-08-26T19:31:42.9618482Z  2025-08-26T19:31:42.9619023Z The user list has the following rules: 2025-08-26T19:31:42.9619623Z  2025-08-26T19:31:42.9620277Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:42.9621185Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:42.9622135Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:42.9622774Z  2025-08-26T19:31:42.9623167Z Example config: 2025-08-26T19:31:42.9623831Z  # A list of experiments that can be opted into. 2025-08-26T19:31:42.9624618Z  # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:42.9625333Z  # Expected syntax is: 2025-08-26T19:31:42.9626174Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:42.9627461Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:42.9628364Z  2025-08-26T19:31:42.9628811Z  experiments: 2025-08-26T19:31:42.9629359Z  lf: 2025-08-26T19:31:42.9629813Z  rollout_percent: 25 2025-08-26T19:31:42.9630475Z  all_branches: false 2025-08-26T19:31:42.9631065Z  default: true 2025-08-26T19:31:42.9631564Z  --- 2025-08-26T19:31:42.9632103Z  2025-08-26T19:31:42.9632561Z  # Opt-ins: 2025-08-26T19:31:42.9633356Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:42.9634610Z  # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:42.9635503Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:42.9636344Z  # Experiments should be from the above list. 2025-08-26T19:31:42.9637129Z  2025-08-26T19:31:42.9637635Z  @User1,-lf,split_build 2025-08-26T19:31:42.9638264Z  @User2,lf 2025-08-26T19:31:42.9638777Z  @User3,split_build 2025-08-26T19:31:42.9639324Z """ 2025-08-26T19:31:42.9639719Z  2025-08-26T19:31:42.9640234Z import json 2025-08-26T19:31:42.9640739Z import logging 2025-08-26T19:31:42.9641241Z import os 2025-08-26T19:31:42.9641756Z import random 2025-08-26T19:31:42.9642262Z import re 2025-08-26T19:31:42.9642734Z import sys 2025-08-26T19:31:42.9643302Z from argparse import ArgumentParser 2025-08-26T19:31:42.9644014Z from collections.abc import Iterable 2025-08-26T19:31:42.9644629Z from functools import cache 2025-08-26T19:31:42.9645286Z from logging import LogRecord 2025-08-26T19:31:42.9645887Z from typing import Any, NamedTuple 2025-08-26T19:31:42.9646724Z from urllib.request import Request, urlopen 2025-08-26T19:31:42.9647642Z  2025-08-26T19:31:42.9648097Z import yaml 2025-08-26T19:31:42.9648814Z from github import Auth, Github 2025-08-26T19:31:42.9649491Z from github.Issue import Issue 2025-08-26T19:31:42.9650079Z  2025-08-26T19:31:42.9650481Z  2025-08-26T19:31:42.9651098Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:42.9651925Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:42.9652892Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:42.9653767Z  2025-08-26T19:31:42.9654272Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:42.9654944Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:42.9655671Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:42.9656371Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:42.9657168Z  2025-08-26T19:31:42.9657696Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:42.9658303Z  2025-08-26T19:31:42.9658729Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:42.9659396Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:42.9660341Z  2025-08-26T19:31:42.9660780Z  2025-08-26T19:31:42.9661300Z class Experiment(NamedTuple): 2025-08-26T19:31:42.9661871Z  rollout_perc: float = ( 2025-08-26T19:31:42.9662666Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:42.9663438Z  ) 2025-08-26T19:31:42.9663959Z  all_branches: bool = ( 2025-08-26T19:31:42.9664701Z  False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:42.9665524Z  ) 2025-08-26T19:31:42.9666000Z  default: bool = ( 2025-08-26T19:31:42.9666906Z  True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:42.9667775Z  ) 2025-08-26T19:31:42.9668207Z  2025-08-26T19:31:42.9668675Z  # Add more fields as needed 2025-08-26T19:31:42.9669247Z  2025-08-26T19:31:42.9669701Z  2025-08-26T19:31:42.9670165Z class Settings(NamedTuple): 2025-08-26T19:31:42.9670729Z  """ 2025-08-26T19:31:42.9671379Z  Settings for the experiments that can be opted into. 2025-08-26T19:31:42.9672037Z  """ 2025-08-26T19:31:42.9672540Z  2025-08-26T19:31:42.9673018Z  experiments: dict[str, Experiment] = {} 2025-08-26T19:31:42.9673629Z  2025-08-26T19:31:42.9674201Z  2025-08-26T19:31:42.9674787Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:42.9675547Z  """Color codes the log messages based on the log level""" 2025-08-26T19:31:42.9676240Z  2025-08-26T19:31:42.9676827Z  COLORS = { 2025-08-26T19:31:42.9677342Z  "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:42.9678054Z  "ERROR": "\033[31m", # Red 2025-08-26T19:31:42.9678655Z  "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:42.9679281Z  "INFO": "\033[0m", # Reset 2025-08-26T19:31:42.9752656Z  "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:42.9753631Z  } 2025-08-26T19:31:42.9754341Z  2025-08-26T19:31:42.9755083Z  def format(self, record: LogRecord) -> str: 2025-08-26T19:31:42.9756453Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:42.9758139Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:42.9759044Z  return super().format(record) 2025-08-26T19:31:42.9759579Z  2025-08-26T19:31:42.9759923Z  2025-08-26T19:31:42.9760317Z handler = logging.StreamHandler() 2025-08-26T19:31:42.9761083Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:42.9762017Z  2025-08-26T19:31:42.9762501Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:42.9763102Z log.addHandler(handler) 2025-08-26T19:31:42.9763586Z log.setLevel(logging.INFO) 2025-08-26T19:31:42.9764050Z  2025-08-26T19:31:42.9764390Z  2025-08-26T19:31:42.9764857Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:42.9765436Z  """ 2025-08-26T19:31:42.9765976Z  Defines outputs of the github action that invokes this script 2025-08-26T19:31:42.9767152Z  """ 2025-08-26T19:31:42.9767575Z  if not GITHUB_OUTPUT: 2025-08-26T19:31:42.9768658Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:42.9769754Z  log.warning( 2025-08-26T19:31:42.9770639Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:42.9771546Z  ) 2025-08-26T19:31:42.9772012Z  print(f"::set-output name={key}::{value}") 2025-08-26T19:31:42.9772558Z  return 2025-08-26T19:31:42.9772951Z  2025-08-26T19:31:42.9773340Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:42.9773942Z  log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:42.9774523Z  f.write(f"{key}={value}\n") 2025-08-26T19:31:42.9775014Z  2025-08-26T19:31:42.9775360Z  2025-08-26T19:31:42.9775873Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:42.9776527Z  return frozenset( 2025-08-26T19:31:42.9777456Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:42.9778132Z  ) 2025-08-26T19:31:42.9778501Z  2025-08-26T19:31:42.9778835Z  2025-08-26T19:31:42.9779211Z def parse_args() -> Any: 2025-08-26T19:31:42.9779819Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:42.9780702Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:42.9781462Z  parser.add_argument( 2025-08-26T19:31:42.9781965Z  "--github-issue-repo", 2025-08-26T19:31:42.9782478Z  type=str, 2025-08-26T19:31:42.9782926Z  required=False, 2025-08-26T19:31:42.9783613Z  default="pytorch/test-infra", 2025-08-26T19:31:42.9784188Z  help="GitHub repo to get the issue", 2025-08-26T19:31:42.9784701Z  ) 2025-08-26T19:31:42.9785092Z  parser.add_argument( 2025-08-26T19:31:42.9785570Z  "--github-repo", 2025-08-26T19:31:42.9786027Z  type=str, 2025-08-26T19:31:42.9786470Z  required=True, 2025-08-26T19:31:42.9787606Z  help="GitHub repo where CI is running", 2025-08-26T19:31:42.9788158Z  ) 2025-08-26T19:31:42.9788541Z  parser.add_argument( 2025-08-26T19:31:42.9789190Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:42.9789849Z  ) 2025-08-26T19:31:42.9790238Z  parser.add_argument( 2025-08-26T19:31:42.9790902Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:42.9791574Z  ) 2025-08-26T19:31:42.9791963Z  parser.add_argument( 2025-08-26T19:31:42.9792644Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:42.9793323Z  ) 2025-08-26T19:31:42.9793708Z  parser.add_argument( 2025-08-26T19:31:42.9794407Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:42.9795256Z  ) 2025-08-26T19:31:42.9795647Z  parser.add_argument( 2025-08-26T19:31:42.9796128Z  "--github-ref-type", 2025-08-26T19:31:42.9796773Z  type=str, 2025-08-26T19:31:42.9797224Z  required=True, 2025-08-26T19:31:42.9797758Z  help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:42.9798310Z  ) 2025-08-26T19:31:42.9798689Z  parser.add_argument( 2025-08-26T19:31:42.9799194Z  "--eligible-experiments", 2025-08-26T19:31:42.9799769Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:42.9800300Z  required=False, 2025-08-26T19:31:42.9800758Z  default="", 2025-08-26T19:31:42.9801628Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:42.9802554Z  ) 2025-08-26T19:31:42.9802939Z  parser.add_argument( 2025-08-26T19:31:42.9803441Z  "--opt-out-experiments", 2025-08-26T19:31:42.9803980Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:42.9804511Z  required=False, 2025-08-26T19:31:42.9804972Z  default="", 2025-08-26T19:31:42.9805399Z  help=( 2025-08-26T19:31:42.9806117Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:42.9807500Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:42.9808342Z  ), 2025-08-26T19:31:42.9808722Z  ) 2025-08-26T19:31:42.9809106Z  parser.add_argument( 2025-08-26T19:31:42.9809580Z  "--pr-number", 2025-08-26T19:31:42.9810024Z  type=str, 2025-08-26T19:31:42.9810477Z  required=False, 2025-08-26T19:31:42.9810942Z  default="", 2025-08-26T19:31:42.9811475Z  help="the optional PR number where this is run", 2025-08-26T19:31:42.9812031Z  ) 2025-08-26T19:31:42.9812395Z  2025-08-26T19:31:42.9812769Z  return parser.parse_args() 2025-08-26T19:31:42.9813249Z  2025-08-26T19:31:42.9813583Z  2025-08-26T19:31:42.9814180Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:42.9815084Z  auth = Auth.Token(github_token) 2025-08-26T19:31:42.9815615Z  return Github(auth=auth) 2025-08-26T19:31:42.9816081Z  2025-08-26T19:31:42.9816414Z  2025-08-26T19:31:42.9817284Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:42.9818091Z  repo = gh.get_repo(repo) 2025-08-26T19:31:42.9818633Z  return repo.get_issue(number=issue_num) 2025-08-26T19:31:42.9819155Z  2025-08-26T19:31:42.9819491Z  2025-08-26T19:31:42.9819863Z def get_potential_pr_author( 2025-08-26T19:31:42.9820545Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:42.9821226Z ) -> str: 2025-08-26T19:31:42.9821770Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:42.9822593Z  # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:42.9823361Z  # embedded in the tag name: ciflow// 2025-08-26T19:31:42.9823926Z  2025-08-26T19:31:42.9824311Z  gh = get_gh_client(github_token) 2025-08-26T19:31:42.9824800Z  2025-08-26T19:31:42.9825274Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:42.9825937Z  split_tag = ref_name.split("/") 2025-08-26T19:31:42.9826805Z  if ( 2025-08-26T19:31:42.9827254Z  len(split_tag) == 3 2025-08-26T19:31:42.9827767Z  and split_tag[0] == "ciflow" 2025-08-26T19:31:42.9828311Z  and split_tag[2].isnumeric() 2025-08-26T19:31:42.9828816Z  ): 2025-08-26T19:31:42.9829244Z  pr_number = split_tag[2] 2025-08-26T19:31:42.9829741Z  try: 2025-08-26T19:31:42.9830213Z  repository = gh.get_repo(repo) 2025-08-26T19:31:42.9830855Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:42.9831466Z  except Exception as e: 2025-08-26T19:31:42.9832018Z  raise Exception( # noqa: TRY002 2025-08-26T19:31:42.9832693Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:42.9833336Z  ) from e 2025-08-26T19:31:42.9833918Z  return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:42.9834638Z  # In all other cases, return the original input username 2025-08-26T19:31:42.9835236Z  return username 2025-08-26T19:31:42.9835653Z  2025-08-26T19:31:42.9835990Z  2025-08-26T19:31:42.9836409Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:42.9837178Z  """ 2025-08-26T19:31:42.9837852Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:42.9838637Z  """ 2025-08-26T19:31:42.9839236Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:42.9839897Z  2025-08-26T19:31:42.9840230Z  2025-08-26T19:31:42.9840609Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:42.9841117Z  try: 2025-08-26T19:31:42.9841534Z  data = yaml.safe_load(yaml_text) 2025-08-26T19:31:42.9842052Z  return data 2025-08-26T19:31:42.9842506Z  except yaml.YAMLError: 2025-08-26T19:31:42.9843042Z  log.exception("Error loading YAML") 2025-08-26T19:31:42.9843557Z  raise 2025-08-26T19:31:42.9843941Z  2025-08-26T19:31:42.9844276Z  2025-08-26T19:31:42.9844884Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:42.9845618Z  """ 2025-08-26T19:31:42.9846392Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:42.9847260Z  2025-08-26T19:31:42.9847787Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:42.9848550Z  and the text below is the list of opted in users. 2025-08-26T19:31:42.9849104Z  2025-08-26T19:31:42.9849669Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:42.9850360Z  """ 2025-08-26T19:31:42.9850817Z  rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:42.9851416Z  if len(rollout_state_parts) >= 2: 2025-08-26T19:31:42.9852038Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:42.9852627Z  else: 2025-08-26T19:31:42.9853029Z  return "", rollout_state 2025-08-26T19:31:42.9853492Z  2025-08-26T19:31:42.9853817Z  2025-08-26T19:31:42.9854210Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:42.9854711Z  """ 2025-08-26T19:31:42.9855245Z  Dictionary of users with a list of features they have opted into 2025-08-26T19:31:42.9855888Z  """ 2025-08-26T19:31:42.9856239Z  2025-08-26T19:31:42.9856670Z  2025-08-26T19:31:42.9857325Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:42.9857972Z  """ 2025-08-26T19:31:42.9858693Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:42.9859506Z  2025-08-26T19:31:42.9860314Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:42.9861291Z  - Example line: "@User1,lf,split_build" 2025-08-26T19:31:42.9861977Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:42.9862597Z  2025-08-26T19:31:42.9862923Z  2025-08-26T19:31:42.9863245Z  """ 2025-08-26T19:31:42.9863623Z  optins = UserOptins() 2025-08-26T19:31:42.9864143Z  for user in user_optin_text.split("\n"): 2025-08-26T19:31:42.9864699Z  user = user.strip("\r\n\t -") 2025-08-26T19:31:42.9865258Z  if not user or not user.startswith("@"): 2025-08-26T19:31:42.9865832Z  # Not a valid user. Skip 2025-08-26T19:31:42.9866327Z  continue 2025-08-26T19:31:42.9867035Z  2025-08-26T19:31:42.9867400Z  if user: 2025-08-26T19:31:42.9867883Z  usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:42.9868584Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:42.9869223Z  2025-08-26T19:31:42.9869580Z  return optins 2025-08-26T19:31:42.9869986Z  2025-08-26T19:31:42.9870317Z  2025-08-26T19:31:42.9870809Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:42.9871427Z  """ 2025-08-26T19:31:42.9871850Z  Check if the experiment name is valid. 2025-08-26T19:31:42.9872370Z  A valid name: 2025-08-26T19:31:42.9873044Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:42.9873966Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:42.9874675Z  - Cannot contain spaces 2025-08-26T19:31:42.9875145Z  """ 2025-08-26T19:31:42.9875498Z  2025-08-26T19:31:42.9875959Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:42.9876917Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:42.9877698Z  2025-08-26T19:31:42.9878050Z  if valid: 2025-08-26T19:31:42.9878494Z  return True 2025-08-26T19:31:42.9878903Z  2025-08-26T19:31:42.9879448Z  log.error( 2025-08-26T19:31:42.9880995Z  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-08-26T19:31:42.9882507Z  ) 2025-08-26T19:31:42.9882885Z  return False 2025-08-26T19:31:42.9883311Z  2025-08-26T19:31:42.9883647Z  2025-08-26T19:31:42.9884158Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:42.9884798Z  """ 2025-08-26T19:31:42.9885402Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:42.9886115Z  """ 2025-08-26T19:31:42.9886482Z  try: 2025-08-26T19:31:42.9887088Z  if settings_text: 2025-08-26T19:31:42.9887833Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:42.9888618Z  # for easy reading 2025-08-26T19:31:42.9889435Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:42.9890468Z  # the backtick character in shell commands. 2025-08-26T19:31:42.9891078Z  backtick = chr(96) # backtick character 2025-08-26T19:31:42.9891755Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:42.9892420Z  settings = load_yaml(settings_text) 2025-08-26T19:31:42.9892940Z  2025-08-26T19:31:42.9893531Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:42.9894267Z  experiments = {} 2025-08-26T19:31:42.9894726Z  2025-08-26T19:31:42.9895278Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:42.9896041Z  if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:42.9897248Z  # 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-08-26T19:31:42.9898271Z  continue 2025-08-26T19:31:42.9898729Z  2025-08-26T19:31:42.9899095Z  valid_settings = {} 2025-08-26T19:31:42.9899631Z  for setting in exp_settings: 2025-08-26T19:31:42.9900203Z  if setting not in Experiment._fields: 2025-08-26T19:31:42.9900770Z  log.warning( 2025-08-26T19:31:42.9901488Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:42.9902187Z  ) 2025-08-26T19:31:42.9902631Z  else: 2025-08-26T19:31:42.9903168Z  valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:42.9903740Z  2025-08-26T19:31:42.9904204Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:42.9904844Z  return Settings(experiments) 2025-08-26T19:31:42.9905334Z  2025-08-26T19:31:42.9905683Z  except Exception: 2025-08-26T19:31:42.9906195Z  log.exception("Failed to parse settings") 2025-08-26T19:31:42.9906823Z  2025-08-26T19:31:42.9907172Z  return Settings() 2025-08-26T19:31:42.9907590Z  2025-08-26T19:31:42.9907915Z  2025-08-26T19:31:42.9908472Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:42.9909049Z  """ 2025-08-26T19:31:42.9909499Z  Parse settings, if any, from the rollout state. 2025-08-26T19:31:42.9910046Z  2025-08-26T19:31:42.9910582Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:42.9911347Z  and the text below is the list of opted in users. 2025-08-26T19:31:42.9911906Z  2025-08-26T19:31:42.9912488Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:42.9913201Z  """ 2025-08-26T19:31:42.9913765Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:42.9914540Z  return parse_settings_from_text(settings_text) 2025-08-26T19:31:42.9915085Z  2025-08-26T19:31:42.9915406Z  2025-08-26T19:31:42.9915860Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:42.9916416Z  """ 2025-08-26T19:31:42.9917095Z  Parse users from the rollout state. 2025-08-26T19:31:42.9917594Z  2025-08-26T19:31:42.9917922Z  """ 2025-08-26T19:31:42.9918471Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:42.9919213Z  return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:42.9919910Z  2025-08-26T19:31:42.9920235Z  2025-08-26T19:31:42.9920856Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:42.9921592Z  """ 2025-08-26T19:31:42.9922032Z  Check if a user is opted into an experiment 2025-08-26T19:31:42.9922552Z  """ 2025-08-26T19:31:42.9923034Z  return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:42.9923601Z  2025-08-26T19:31:42.9923927Z  2025-08-26T19:31:42.9924553Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:42.9925296Z  """ 2025-08-26T19:31:42.9925781Z  Check if a user explicitly opted out of an experiment 2025-08-26T19:31:42.9926349Z  """ 2025-08-26T19:31:42.9927108Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:42.9927830Z  experiment_optout = "-" + experiment_name 2025-08-26T19:31:42.9928481Z  if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:42.9929075Z  return False 2025-08-26T19:31:42.9929488Z  2025-08-26T19:31:42.9929947Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:42.9930532Z  log.warning( 2025-08-26T19:31:42.9931348Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:42.9932203Z  ) 2025-08-26T19:31:42.9932564Z  2025-08-26T19:31:42.9932916Z  return True 2025-08-26T19:31:42.9933309Z  2025-08-26T19:31:42.9933643Z  2025-08-26T19:31:42.9933997Z def get_runner_prefix( 2025-08-26T19:31:42.9934480Z  rollout_state: str, 2025-08-26T19:31:42.9934976Z  workflow_requestors: Iterable[str], 2025-08-26T19:31:42.9935503Z  branch: str, 2025-08-26T19:31:42.9936030Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:42.9936819Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:42.9937409Z  is_canary: bool = False, 2025-08-26T19:31:42.9937864Z ) -> str: 2025-08-26T19:31:42.9938313Z  settings = parse_settings(rollout_state) 2025-08-26T19:31:42.9938889Z  user_optins = parse_users(rollout_state) 2025-08-26T19:31:42.9939403Z  2025-08-26T19:31:42.9939882Z  fleet_prefix = "" 2025-08-26T19:31:42.9940333Z  prefixes = [] 2025-08-26T19:31:42.9940996Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:42.9941933Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:42.9942648Z  log.info( 2025-08-26T19:31:42.9943345Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:42.9944088Z  ) 2025-08-26T19:31:42.9944492Z  continue 2025-08-26T19:31:42.9944901Z  2025-08-26T19:31:42.9945275Z  if opt_out_experiments: 2025-08-26T19:31:42.9945832Z  if experiment_name in opt_out_experiments: 2025-08-26T19:31:42.9946482Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:42.9947172Z  log.info( 2025-08-26T19:31:42.9948103Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:42.9949049Z  ) 2025-08-26T19:31:42.9949464Z  continue 2025-08-26T19:31:42.9949907Z  2025-08-26T19:31:42.9950437Z  if eligible_experiments: 2025-08-26T19:31:42.9951021Z  if experiment_name not in eligible_experiments: 2025-08-26T19:31:42.9951664Z  exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:42.9952219Z  log.info( 2025-08-26T19:31:42.9953027Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:42.9953843Z  ) 2025-08-26T19:31:42.9954268Z  continue 2025-08-26T19:31:42.9954775Z  elif not experiment_settings.default: 2025-08-26T19:31:42.9955312Z  log.info( 2025-08-26T19:31:42.9956000Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:42.9956973Z  ) 2025-08-26T19:31:42.9957383Z  continue 2025-08-26T19:31:42.9957798Z  2025-08-26T19:31:42.9958256Z  # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:42.9958865Z  opted_out_users = [ 2025-08-26T19:31:42.9959331Z  requestor 2025-08-26T19:31:42.9959815Z  for requestor in workflow_requestors 2025-08-26T19:31:42.9960489Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:42.9961109Z  ] 2025-08-26T19:31:42.9961472Z  2025-08-26T19:31:42.9961824Z  if opted_out_users: 2025-08-26T19:31:42.9962299Z  log.info( 2025-08-26T19:31:42.9962951Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:42.9963630Z  ) 2025-08-26T19:31:42.9964027Z  continue 2025-08-26T19:31:42.9964446Z  2025-08-26T19:31:42.9964901Z  # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:42.9965513Z  opted_in_users = [ 2025-08-26T19:31:42.9965971Z  requestor 2025-08-26T19:31:42.9966459Z  for requestor in workflow_requestors 2025-08-26T19:31:42.9967331Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:42.9967941Z  ] 2025-08-26T19:31:42.9968311Z  2025-08-26T19:31:42.9968654Z  enabled = False 2025-08-26T19:31:42.9969111Z  if opted_in_users: 2025-08-26T19:31:42.9969702Z  log.info( 2025-08-26T19:31:42.9970347Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:42.9971010Z  ) 2025-08-26T19:31:42.9971416Z  enabled = True 2025-08-26T19:31:42.9971859Z  2025-08-26T19:31:42.9972267Z  elif experiment_settings.rollout_perc: 2025-08-26T19:31:42.9973098Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:42.9974013Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:42.9974657Z  log.info( 2025-08-26T19:31:42.9975527Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:42.9976425Z  ) 2025-08-26T19:31:42.9976990Z  enabled = True 2025-08-26T19:31:42.9977456Z  2025-08-26T19:31:42.9977816Z  if enabled: 2025-08-26T19:31:42.9978275Z  label = experiment_name 2025-08-26T19:31:42.9978844Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:42.9979654Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:42.9980646Z  # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:42.9981411Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:42.9982062Z  if is_canary: 2025-08-26T19:31:42.9982580Z  label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:42.9983136Z  fleet_prefix = label 2025-08-26T19:31:42.9983668Z  else: 2025-08-26T19:31:42.9984138Z  prefixes.append(label) 2025-08-26T19:31:42.9984632Z  2025-08-26T19:31:42.9984991Z  if len(prefixes) > 1: 2025-08-26T19:31:42.9985451Z  log.error( 2025-08-26T19:31:42.9986496Z  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-08-26T19:31:42.9987670Z  ) 2025-08-26T19:31:42.9988075Z  prefixes = prefixes[:1] 2025-08-26T19:31:42.9988554Z  2025-08-26T19:31:42.9988910Z  # Fleet always comes first 2025-08-26T19:31:42.9989400Z  if fleet_prefix: 2025-08-26T19:31:42.9989868Z  prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:42.9990368Z  2025-08-26T19:31:42.9990805Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:42.9991361Z  2025-08-26T19:31:42.9991679Z  2025-08-26T19:31:42.9992306Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:42.9993062Z  """ 2025-08-26T19:31:42.9993657Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:42.9994353Z  2025-08-26T19:31:42.9994911Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:42.9995603Z  """ 2025-08-26T19:31:42.9995999Z  gh = get_gh_client(github_token) 2025-08-26T19:31:42.9996561Z  issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:42.9997488Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:42.9998069Z  2025-08-26T19:31:42.9998440Z  2025-08-26T19:31:42.9999023Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:42.9999906Z  for _ in range(num_retries): 2025-08-26T19:31:43.0000394Z  try: 2025-08-26T19:31:43.0000849Z  req = Request(url=url, headers=headers) 2025-08-26T19:31:43.0001512Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:43.0002154Z  return json.loads(content) 2025-08-26T19:31:43.0002686Z  except Exception as e: 2025-08-26T19:31:43.0003247Z  log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:43.0003784Z  2025-08-26T19:31:43.0004344Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:43.0005053Z  return {} 2025-08-26T19:31:43.0005439Z  2025-08-26T19:31:43.0005758Z  2025-08-26T19:31:43.0006085Z @cache 2025-08-26T19:31:43.0006934Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:43.0007692Z  """ 2025-08-26T19:31:43.0008096Z  Dynamically get PR information 2025-08-26T19:31:43.0008594Z  """ 2025-08-26T19:31:43.0009107Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:43.0009738Z  headers = { 2025-08-26T19:31:43.0010232Z  "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:43.0010972Z  "Authorization": f"token {github_token}", 2025-08-26T19:31:43.0011492Z  } 2025-08-26T19:31:43.0011933Z  json_response: dict[str, Any] = download_json( 2025-08-26T19:31:43.0012542Z  url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:43.0013074Z  headers=headers, 2025-08-26T19:31:43.0013521Z  ) 2025-08-26T19:31:43.0013869Z  2025-08-26T19:31:43.0014219Z  if not json_response: 2025-08-26T19:31:43.0014810Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:43.0015426Z  return {} 2025-08-26T19:31:43.0015825Z  2025-08-26T19:31:43.0016172Z  return json_response 2025-08-26T19:31:43.0016722Z  2025-08-26T19:31:43.0017054Z  2025-08-26T19:31:43.0017636Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:43.0018351Z  """ 2025-08-26T19:31:43.0018896Z  Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:43.0019530Z  """ 2025-08-26T19:31:43.0020023Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:43.0020629Z  return { 2025-08-26T19:31:43.0021223Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:43.0021892Z  } 2025-08-26T19:31:43.0022241Z  2025-08-26T19:31:43.0022591Z  2025-08-26T19:31:43.0022947Z def main() -> None: 2025-08-26T19:31:43.0023390Z  args = parse_args() 2025-08-26T19:31:43.0023835Z  2025-08-26T19:31:43.0024249Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:43.0024778Z  2025-08-26T19:31:43.0025143Z  # Check if the PR is opt-out 2025-08-26T19:31:43.0025646Z  if args.pr_number: 2025-08-26T19:31:43.0026339Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:43.0027190Z  if OPT_OUT_LABEL in labels: 2025-08-26T19:31:43.0027693Z  log.info( 2025-08-26T19:31:43.0028400Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:43.0029143Z  ) 2025-08-26T19:31:43.0029711Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.0030379Z  sys.exit() 2025-08-26T19:31:43.0031042Z  2025-08-26T19:31:43.0031392Z  try: 2025-08-26T19:31:43.0031851Z  rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:43.0032558Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:43.0033190Z  ) 2025-08-26T19:31:43.0033554Z  2025-08-26T19:31:43.0033953Z  username = get_potential_pr_author( 2025-08-26T19:31:43.0034483Z  args.github_token, 2025-08-26T19:31:43.0034984Z  args.github_repo, 2025-08-26T19:31:43.0035480Z  args.github_actor, 2025-08-26T19:31:43.0035975Z  args.github_ref_type, 2025-08-26T19:31:43.0036477Z  args.github_branch, 2025-08-26T19:31:43.0037402Z  ) 2025-08-26T19:31:43.0037778Z  2025-08-26T19:31:43.0038260Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:43.0038860Z  2025-08-26T19:31:43.0039274Z  runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:43.0039818Z  rollout_state, 2025-08-26T19:31:43.0040330Z  (args.github_issue_owner, username), 2025-08-26T19:31:43.0040873Z  args.github_branch, 2025-08-26T19:31:43.0041545Z  args.eligible_experiments, 2025-08-26T19:31:43.0042081Z  args.opt_out_experiments, 2025-08-26T19:31:43.0042596Z  is_canary, 2025-08-26T19:31:43.0043028Z  ) 2025-08-26T19:31:43.0043395Z  2025-08-26T19:31:43.0043760Z  except Exception as e: 2025-08-26T19:31:43.0044224Z  log.error( 2025-08-26T19:31:43.0044916Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:43.0045652Z  ) 2025-08-26T19:31:43.0046023Z  2025-08-26T19:31:43.0046853Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.0047507Z  2025-08-26T19:31:43.0047837Z  2025-08-26T19:31:43.0048178Z if __name__ == "__main__": 2025-08-26T19:31:43.0048628Z  main() 2025-08-26T19:31:43.0048997Z  2025-08-26T19:31:43.0049332Z EOF 2025-08-26T19:31:43.0049675Z  2025-08-26T19:31:43.0050036Z cat runner_determinator.py 2025-08-26T19:31:43.0332202Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:43.0333020Z env: 2025-08-26T19:31:43.0333697Z GITHUB_TOKEN: *** 2025-08-26T19:31:43.0334082Z ISSUE_NUMBER: 5132 2025-08-26T19:31:43.0334504Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:43.0334983Z ISSUE_OWNER: 2025-08-26T19:31:43.0335360Z CHECK_EXPERIMENTS: 2025-08-26T19:31:43.0335762Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:43.0336151Z PR_NUMBER: 2025-08-26T19:31:43.0336504Z ##[endgroup] 2025-08-26T19:31:43.0597236Z # flake8: noqa: G004 2025-08-26T19:31:43.0597733Z 2025-08-26T19:31:43.0598418Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:43.0599990Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:43.0601322Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:43.0602082Z 2025-08-26T19:31:43.0602396Z """ 2025-08-26T19:31:43.0603400Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:43.0604997Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:43.0606775Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:43.0608260Z of which runners should be used to run which job. 2025-08-26T19:31:43.0608976Z 2025-08-26T19:31:43.0609653Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:43.0611563Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:43.0613180Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:43.0614399Z list, defined. 2025-08-26T19:31:43.0614782Z 2025-08-26T19:31:43.0616516Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:43.0618340Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:43.0619725Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:43.0620418Z 2025-08-26T19:31:43.0620864Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:43.0621684Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:43.0622376Z experiments which the user could be opted in to. 2025-08-26T19:31:43.0622761Z 2025-08-26T19:31:43.0622946Z The user list has the following rules: 2025-08-26T19:31:43.0623285Z 2025-08-26T19:31:43.0623589Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:43.0624400Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:43.0625111Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:43.0625481Z 2025-08-26T19:31:43.0625646Z Example config: 2025-08-26T19:31:43.0626074Z # A list of experiments that can be opted into. 2025-08-26T19:31:43.0627537Z # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:43.0628123Z # Expected syntax is: 2025-08-26T19:31:43.0628738Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:43.0629639Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:43.0630215Z 2025-08-26T19:31:43.0630368Z experiments: 2025-08-26T19:31:43.0630737Z lf: 2025-08-26T19:31:43.0631080Z rollout_percent: 25 2025-08-26T19:31:43.0631508Z all_branches: false 2025-08-26T19:31:43.0631933Z default: true 2025-08-26T19:31:43.0632309Z --- 2025-08-26T19:31:43.0632502Z 2025-08-26T19:31:43.0632651Z # Opt-ins: 2025-08-26T19:31:43.0633199Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:43.0634009Z # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:43.0634738Z # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:43.0635356Z # Experiments should be from the above list. 2025-08-26T19:31:43.0635710Z 2025-08-26T19:31:43.0635875Z @User1,-lf,split_build 2025-08-26T19:31:43.0636278Z @User2,lf 2025-08-26T19:31:43.0636807Z @User3,split_build 2025-08-26T19:31:43.0637279Z """ 2025-08-26T19:31:43.0637458Z 2025-08-26T19:31:43.0637609Z import json 2025-08-26T19:31:43.0637958Z import logging 2025-08-26T19:31:43.0638308Z import os 2025-08-26T19:31:43.0638644Z import random 2025-08-26T19:31:43.0638993Z import re 2025-08-26T19:31:43.0639322Z import sys 2025-08-26T19:31:43.0639703Z from argparse import ArgumentParser 2025-08-26T19:31:43.0640200Z from collections.abc import Iterable 2025-08-26T19:31:43.0640686Z from functools import cache 2025-08-26T19:31:43.0641130Z from logging import LogRecord 2025-08-26T19:31:43.0641599Z from typing import Any, NamedTuple 2025-08-26T19:31:43.0642107Z from urllib.request import Request, urlopen 2025-08-26T19:31:43.0642473Z 2025-08-26T19:31:43.0642620Z import yaml 2025-08-26T19:31:43.0642981Z from github import Auth, Github 2025-08-26T19:31:43.0643444Z from github.Issue import Issue 2025-08-26T19:31:43.0643728Z 2025-08-26T19:31:43.0643734Z 2025-08-26T19:31:43.0643942Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:43.0644582Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:43.0645396Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:43.0645919Z 2025-08-26T19:31:43.0646132Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:43.0647060Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:43.0647578Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:43.0648095Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:43.0648424Z 2025-08-26T19:31:43.0648606Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:43.0648917Z 2025-08-26T19:31:43.0649091Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:43.0649529Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:43.0649791Z 2025-08-26T19:31:43.0649797Z 2025-08-26T19:31:43.0649970Z class Experiment(NamedTuple): 2025-08-26T19:31:43.0650419Z rollout_perc: float = ( 2025-08-26T19:31:43.0651008Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:43.0651648Z ) 2025-08-26T19:31:43.0651985Z all_branches: bool = ( 2025-08-26T19:31:43.0652564Z False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:43.0653196Z ) 2025-08-26T19:31:43.0653521Z default: bool = ( 2025-08-26T19:31:43.0654060Z True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:43.0654660Z ) 2025-08-26T19:31:43.0654847Z 2025-08-26T19:31:43.0655014Z # Add more fields as needed 2025-08-26T19:31:43.0655293Z 2025-08-26T19:31:43.0655299Z 2025-08-26T19:31:43.0655476Z class Settings(NamedTuple): 2025-08-26T19:31:43.0655889Z """ 2025-08-26T19:31:43.0656434Z Settings for the experiments that can be opted into. 2025-08-26T19:31:43.0657166Z """ 2025-08-26T19:31:43.0657346Z 2025-08-26T19:31:43.0657545Z experiments: dict[str, Experiment] = {} 2025-08-26T19:31:43.0657891Z 2025-08-26T19:31:43.0657897Z 2025-08-26T19:31:43.0658091Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:43.0658718Z """Color codes the log messages based on the log level""" 2025-08-26T19:31:43.0659122Z 2025-08-26T19:31:43.0659279Z COLORS = { 2025-08-26T19:31:43.0659643Z "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:43.0660120Z "ERROR": "\033[31m", # Red 2025-08-26T19:31:43.0660573Z "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:43.0661033Z "INFO": "\033[0m", # Reset 2025-08-26T19:31:43.0661486Z "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:43.0661921Z } 2025-08-26T19:31:43.0662099Z 2025-08-26T19:31:43.0662305Z def format(self, record: LogRecord) -> str: 2025-08-26T19:31:43.0663008Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:43.0663744Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:43.0664281Z return super().format(record) 2025-08-26T19:31:43.0664599Z 2025-08-26T19:31:43.0664606Z 2025-08-26T19:31:43.0664792Z handler = logging.StreamHandler() 2025-08-26T19:31:43.0665455Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:43.0665983Z 2025-08-26T19:31:43.0666215Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:43.0667028Z log.addHandler(handler) 2025-08-26T19:31:43.0667470Z log.setLevel(logging.INFO) 2025-08-26T19:31:43.0667738Z 2025-08-26T19:31:43.0667745Z 2025-08-26T19:31:43.0667983Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:43.0668502Z """ 2025-08-26T19:31:43.0668970Z Defines outputs of the github action that invokes this script 2025-08-26T19:31:43.0669550Z """ 2025-08-26T19:31:43.0669888Z if not GITHUB_OUTPUT: 2025-08-26T19:31:43.0670892Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:43.0671930Z log.warning( 2025-08-26T19:31:43.0672733Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:43.0673622Z ) 2025-08-26T19:31:43.0683711Z print(f"::set-output name={key}::{value}") 2025-08-26T19:31:43.0684281Z return 2025-08-26T19:31:43.0684495Z 2025-08-26T19:31:43.0684874Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:43.0685431Z log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:43.0685969Z f.write(f"{key}={value}\n") 2025-08-26T19:31:43.0686268Z 2025-08-26T19:31:43.0686275Z 2025-08-26T19:31:43.0686560Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:43.0687412Z return frozenset( 2025-08-26T19:31:43.0688001Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:43.0688639Z ) 2025-08-26T19:31:43.0688826Z 2025-08-26T19:31:43.0688832Z 2025-08-26T19:31:43.0688997Z def parse_args() -> Any: 2025-08-26T19:31:43.0689508Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:43.0690312Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:43.0691033Z parser.add_argument( 2025-08-26T19:31:43.0691448Z "--github-issue-repo", 2025-08-26T19:31:43.0691872Z type=str, 2025-08-26T19:31:43.0692252Z required=False, 2025-08-26T19:31:43.0692670Z default="pytorch/test-infra", 2025-08-26T19:31:43.0693171Z help="GitHub repo to get the issue", 2025-08-26T19:31:43.0693646Z ) 2025-08-26T19:31:43.0693977Z parser.add_argument( 2025-08-26T19:31:43.0694386Z "--github-repo", 2025-08-26T19:31:43.0694768Z type=str, 2025-08-26T19:31:43.0695128Z required=True, 2025-08-26T19:31:43.0695697Z help="GitHub repo where CI is running", 2025-08-26T19:31:43.0696180Z ) 2025-08-26T19:31:43.0696522Z parser.add_argument( 2025-08-26T19:31:43.0697274Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:43.0697892Z ) 2025-08-26T19:31:43.0698227Z parser.add_argument( 2025-08-26T19:31:43.0698807Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:43.0699431Z ) 2025-08-26T19:31:43.0699764Z parser.add_argument( 2025-08-26T19:31:43.0700352Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:43.0700997Z ) 2025-08-26T19:31:43.0701446Z parser.add_argument( 2025-08-26T19:31:43.0702060Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:43.0702725Z ) 2025-08-26T19:31:43.0703060Z parser.add_argument( 2025-08-26T19:31:43.0703475Z "--github-ref-type", 2025-08-26T19:31:43.0703891Z type=str, 2025-08-26T19:31:43.0704258Z required=True, 2025-08-26T19:31:43.0704700Z help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:43.0705210Z ) 2025-08-26T19:31:43.0705545Z parser.add_argument( 2025-08-26T19:31:43.0705969Z "--eligible-experiments", 2025-08-26T19:31:43.0706441Z type=_str_comma_separated_to_set, 2025-08-26T19:31:43.0707199Z required=False, 2025-08-26T19:31:43.0707578Z default="", 2025-08-26T19:31:43.0708366Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:43.0709219Z ) 2025-08-26T19:31:43.0709543Z parser.add_argument( 2025-08-26T19:31:43.0709954Z "--opt-out-experiments", 2025-08-26T19:31:43.0710413Z type=_str_comma_separated_to_set, 2025-08-26T19:31:43.0710888Z required=False, 2025-08-26T19:31:43.0711260Z default="", 2025-08-26T19:31:43.0711622Z help=( 2025-08-26T19:31:43.0712235Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:43.0713284Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:43.0714054Z ), 2025-08-26T19:31:43.0714367Z ) 2025-08-26T19:31:43.0714697Z parser.add_argument( 2025-08-26T19:31:43.0715083Z "--pr-number", 2025-08-26T19:31:43.0715452Z type=str, 2025-08-26T19:31:43.0715805Z required=False, 2025-08-26T19:31:43.0716182Z default="", 2025-08-26T19:31:43.0716957Z help="the optional PR number where this is run", 2025-08-26T19:31:43.0717511Z ) 2025-08-26T19:31:43.0717695Z 2025-08-26T19:31:43.0717875Z return parser.parse_args() 2025-08-26T19:31:43.0718158Z 2025-08-26T19:31:43.0718164Z 2025-08-26T19:31:43.0718544Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.0719255Z auth = Auth.Token(github_token) 2025-08-26T19:31:43.0719714Z return Github(auth=auth) 2025-08-26T19:31:43.0719988Z 2025-08-26T19:31:43.0719995Z 2025-08-26T19:31:43.0720415Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.0721164Z repo = gh.get_repo(repo) 2025-08-26T19:31:43.0721613Z return repo.get_issue(number=issue_num) 2025-08-26T19:31:43.0721948Z 2025-08-26T19:31:43.0721959Z 2025-08-26T19:31:43.0722125Z def get_potential_pr_author( 2025-08-26T19:31:43.0722715Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:43.0723334Z ) -> str: 2025-08-26T19:31:43.0723803Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:43.0724550Z # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:43.0725231Z # embedded in the tag name: ciflow// 2025-08-26T19:31:43.0725616Z 2025-08-26T19:31:43.0725943Z gh = get_gh_client(github_token) 2025-08-26T19:31:43.0726262Z 2025-08-26T19:31:43.0726514Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:43.0778310Z split_tag = ref_name.split("/") 2025-08-26T19:31:43.0779357Z if ( 2025-08-26T19:31:43.0779951Z len(split_tag) == 3 2025-08-26T19:31:43.0780555Z and split_tag[0] == "ciflow" 2025-08-26T19:31:43.0781063Z and split_tag[2].isnumeric() 2025-08-26T19:31:43.0781529Z ): 2025-08-26T19:31:43.0781893Z pr_number = split_tag[2] 2025-08-26T19:31:43.0782345Z try: 2025-08-26T19:31:43.0782758Z repository = gh.get_repo(repo) 2025-08-26T19:31:43.0783334Z pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:43.0783899Z except Exception as e: 2025-08-26T19:31:43.0784373Z raise Exception( # noqa: TRY002 2025-08-26T19:31:43.0785010Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:43.0785630Z ) from e 2025-08-26T19:31:43.0786127Z return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:43.0787062Z # In all other cases, return the original input username 2025-08-26T19:31:43.0787624Z return username 2025-08-26T19:31:43.0787851Z 2025-08-26T19:31:43.0787864Z 2025-08-26T19:31:43.0788070Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:43.0788566Z """ 2025-08-26T19:31:43.0789169Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:43.0789893Z """ 2025-08-26T19:31:43.0790409Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:43.0790897Z 2025-08-26T19:31:43.0790904Z 2025-08-26T19:31:43.0791091Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:43.0791546Z try: 2025-08-26T19:31:43.0791904Z data = yaml.safe_load(yaml_text) 2025-08-26T19:31:43.0792378Z return data 2025-08-26T19:31:43.0792762Z except yaml.YAMLError: 2025-08-26T19:31:43.0793206Z log.exception("Error loading YAML") 2025-08-26T19:31:43.0793688Z raise 2025-08-26T19:31:43.0793885Z 2025-08-26T19:31:43.0793892Z 2025-08-26T19:31:43.0794283Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:43.0794968Z """ 2025-08-26T19:31:43.0795542Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:43.0796100Z 2025-08-26T19:31:43.0796836Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.0797666Z and the text below is the list of opted in users. 2025-08-26T19:31:43.0798044Z 2025-08-26T19:31:43.0798386Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:43.0799044Z """ 2025-08-26T19:31:43.0799446Z rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:43.0800005Z if len(rollout_state_parts) >= 2: 2025-08-26T19:31:43.0800560Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:43.0801092Z else: 2025-08-26T19:31:43.0801439Z return "", rollout_state 2025-08-26T19:31:43.0801722Z 2025-08-26T19:31:43.0801729Z 2025-08-26T19:31:43.0801912Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:43.0802382Z """ 2025-08-26T19:31:43.0802865Z Dictionary of users with a list of features they have opted into 2025-08-26T19:31:43.0803463Z """ 2025-08-26T19:31:43.0803639Z 2025-08-26T19:31:43.0803645Z 2025-08-26T19:31:43.0803966Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:43.0804566Z """ 2025-08-26T19:31:43.0805223Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:43.0805868Z 2025-08-26T19:31:43.0806450Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:43.0807741Z - Example line: "@User1,lf,split_build" 2025-08-26T19:31:43.0808378Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:43.0808818Z 2025-08-26T19:31:43.0808825Z 2025-08-26T19:31:43.0808971Z """ 2025-08-26T19:31:43.0809318Z optins = UserOptins() 2025-08-26T19:31:43.0809762Z for user in user_optin_text.split("\n"): 2025-08-26T19:31:43.0810280Z user = user.strip("\r\n\t -") 2025-08-26T19:31:43.0810777Z if not user or not user.startswith("@"): 2025-08-26T19:31:43.0811296Z # Not a valid user. Skip 2025-08-26T19:31:43.0811767Z continue 2025-08-26T19:31:43.0811986Z 2025-08-26T19:31:43.0812129Z if user: 2025-08-26T19:31:43.0812525Z usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:43.0813168Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:43.0813636Z 2025-08-26T19:31:43.0813796Z return optins 2025-08-26T19:31:43.0814012Z 2025-08-26T19:31:43.0814018Z 2025-08-26T19:31:43.0814286Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:43.0814839Z """ 2025-08-26T19:31:43.0815203Z Check if the experiment name is valid. 2025-08-26T19:31:43.0815678Z A valid name: 2025-08-26T19:31:43.0816263Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:43.0817328Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:43.0817994Z - Cannot contain spaces 2025-08-26T19:31:43.0818407Z """ 2025-08-26T19:31:43.0818593Z 2025-08-26T19:31:43.0818831Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:43.0819474Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:43.0819885Z 2025-08-26T19:31:43.0820031Z if valid: 2025-08-26T19:31:43.0820376Z return True 2025-08-26T19:31:43.0820601Z 2025-08-26T19:31:43.0820749Z log.error( 2025-08-26T19:31:43.0822108Z 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-08-26T19:31:43.0823641Z ) 2025-08-26T19:31:43.0823959Z return False 2025-08-26T19:31:43.0824169Z 2025-08-26T19:31:43.0824184Z 2025-08-26T19:31:43.0824467Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:43.0825030Z """ 2025-08-26T19:31:43.0825713Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:43.0826379Z """ 2025-08-26T19:31:43.0826993Z try: 2025-08-26T19:31:43.0827345Z if settings_text: 2025-08-26T19:31:43.0828011Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:43.0828740Z # for easy reading 2025-08-26T19:31:43.0829473Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:43.0830303Z # the backtick character in shell commands. 2025-08-26T19:31:43.0830857Z backtick = chr(96) # backtick character 2025-08-26T19:31:43.0831472Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:43.0832084Z settings = load_yaml(settings_text) 2025-08-26T19:31:43.0832428Z 2025-08-26T19:31:43.0832807Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:43.0833509Z experiments = {} 2025-08-26T19:31:43.0833790Z 2025-08-26T19:31:43.0834154Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:43.0834864Z if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:43.0835903Z # 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-08-26T19:31:43.0837702Z continue 2025-08-26T19:31:43.0837979Z 2025-08-26T19:31:43.0838152Z valid_settings = {} 2025-08-26T19:31:43.0838628Z for setting in exp_settings: 2025-08-26T19:31:43.0839170Z if setting not in Experiment._fields: 2025-08-26T19:31:43.0839680Z log.warning( 2025-08-26T19:31:43.0840343Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:43.0841017Z ) 2025-08-26T19:31:43.0841411Z else: 2025-08-26T19:31:43.0841880Z valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:43.0842274Z 2025-08-26T19:31:43.0842522Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:43.0843108Z return Settings(experiments) 2025-08-26T19:31:43.0843443Z 2025-08-26T19:31:43.0843602Z except Exception: 2025-08-26T19:31:43.0844035Z log.exception("Failed to parse settings") 2025-08-26T19:31:43.0844386Z 2025-08-26T19:31:43.0844540Z return Settings() 2025-08-26T19:31:43.0844780Z 2025-08-26T19:31:43.0844786Z 2025-08-26T19:31:43.0845012Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:43.0845538Z """ 2025-08-26T19:31:43.0845933Z Parse settings, if any, from the rollout state. 2025-08-26T19:31:43.0846306Z 2025-08-26T19:31:43.0846739Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.0847450Z and the text below is the list of opted in users. 2025-08-26T19:31:43.0847832Z 2025-08-26T19:31:43.0848206Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:43.0848897Z """ 2025-08-26T19:31:43.0849397Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.0850106Z return parse_settings_from_text(settings_text) 2025-08-26T19:31:43.0850478Z 2025-08-26T19:31:43.0850485Z 2025-08-26T19:31:43.0850703Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:43.0851253Z """ 2025-08-26T19:31:43.0851603Z Parse users from the rollout state. 2025-08-26T19:31:43.0851927Z 2025-08-26T19:31:43.0852069Z """ 2025-08-26T19:31:43.0852551Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.0853222Z return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:43.0853581Z 2025-08-26T19:31:43.0853587Z 2025-08-26T19:31:43.0854160Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.0854865Z """ 2025-08-26T19:31:43.0855244Z Check if a user is opted into an experiment 2025-08-26T19:31:43.0855726Z """ 2025-08-26T19:31:43.0856138Z return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:43.0856695Z 2025-08-26T19:31:43.0856713Z 2025-08-26T19:31:43.0857261Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.0857959Z """ 2025-08-26T19:31:43.0858378Z Check if a user explicitly opted out of an experiment 2025-08-26T19:31:43.0858911Z """ 2025-08-26T19:31:43.0859366Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:43.0859986Z experiment_optout = "-" + experiment_name 2025-08-26T19:31:43.0860576Z if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:43.0861127Z return False 2025-08-26T19:31:43.0861354Z 2025-08-26T19:31:43.0861606Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:43.0862157Z log.warning( 2025-08-26T19:31:43.0862886Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:43.0863705Z ) 2025-08-26T19:31:43.0863891Z 2025-08-26T19:31:43.0864033Z return True 2025-08-26T19:31:43.0864428Z 2025-08-26T19:31:43.0864434Z 2025-08-26T19:31:43.0864596Z def get_runner_prefix( 2025-08-26T19:31:43.0864998Z rollout_state: str, 2025-08-26T19:31:43.0865414Z workflow_requestors: Iterable[str], 2025-08-26T19:31:43.0865884Z branch: str, 2025-08-26T19:31:43.0866320Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.0867171Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.0867716Z is_canary: bool = False, 2025-08-26T19:31:43.0868135Z ) -> str: 2025-08-26T19:31:43.0868504Z settings = parse_settings(rollout_state) 2025-08-26T19:31:43.0869046Z user_optins = parse_users(rollout_state) 2025-08-26T19:31:43.0869386Z 2025-08-26T19:31:43.0869547Z fleet_prefix = "" 2025-08-26T19:31:43.0869925Z prefixes = [] 2025-08-26T19:31:43.0870496Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:43.0871350Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:43.0872010Z log.info( 2025-08-26T19:31:43.0872622Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:43.0873353Z ) 2025-08-26T19:31:43.0873688Z continue 2025-08-26T19:31:43.0873917Z 2025-08-26T19:31:43.0874085Z if opt_out_experiments: 2025-08-26T19:31:43.0874564Z if experiment_name in opt_out_experiments: 2025-08-26T19:31:43.0875150Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:43.0875682Z log.info( 2025-08-26T19:31:43.0876537Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:43.0877547Z ) 2025-08-26T19:31:43.0877922Z continue 2025-08-26T19:31:43.0878169Z 2025-08-26T19:31:43.0878335Z if eligible_experiments: 2025-08-26T19:31:43.0878843Z if experiment_name not in eligible_experiments: 2025-08-26T19:31:43.0879427Z exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:43.0879964Z log.info( 2025-08-26T19:31:43.0880668Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:43.0881446Z ) 2025-08-26T19:31:43.0881797Z continue 2025-08-26T19:31:43.0882223Z elif not experiment_settings.default: 2025-08-26T19:31:43.0882709Z log.info( 2025-08-26T19:31:43.0883441Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:43.0884129Z ) 2025-08-26T19:31:43.0884461Z continue 2025-08-26T19:31:43.0884684Z 2025-08-26T19:31:43.0884960Z # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:43.0885542Z opted_out_users = [ 2025-08-26T19:31:43.0885950Z requestor 2025-08-26T19:31:43.0886366Z for requestor in workflow_requestors 2025-08-26T19:31:43.0887084Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.0887651Z ] 2025-08-26T19:31:43.0887838Z 2025-08-26T19:31:43.0888001Z if opted_out_users: 2025-08-26T19:31:43.0888417Z log.info( 2025-08-26T19:31:43.0888974Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:43.0889631Z ) 2025-08-26T19:31:43.0889969Z continue 2025-08-26T19:31:43.0890202Z 2025-08-26T19:31:43.0890454Z # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:43.0891011Z opted_in_users = [ 2025-08-26T19:31:43.0891428Z requestor 2025-08-26T19:31:43.0891838Z for requestor in workflow_requestors 2025-08-26T19:31:43.0892442Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.0893010Z ] 2025-08-26T19:31:43.0893323Z 2025-08-26T19:31:43.0893479Z enabled = False 2025-08-26T19:31:43.0893879Z if opted_in_users: 2025-08-26T19:31:43.0894277Z log.info( 2025-08-26T19:31:43.0894814Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:43.0895447Z ) 2025-08-26T19:31:43.0895798Z enabled = True 2025-08-26T19:31:43.0896052Z 2025-08-26T19:31:43.0896252Z elif experiment_settings.rollout_perc: 2025-08-26T19:31:43.0897251Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:43.0898124Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:43.0898741Z log.info( 2025-08-26T19:31:43.0899531Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:43.0900373Z ) 2025-08-26T19:31:43.0900743Z enabled = True 2025-08-26T19:31:43.0901014Z 2025-08-26T19:31:43.0901166Z if enabled: 2025-08-26T19:31:43.0901550Z label = experiment_name 2025-08-26T19:31:43.0902050Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:43.0902804Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:43.0903615Z # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:43.0904306Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:43.0904910Z if is_canary: 2025-08-26T19:31:43.0905359Z label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:43.0905856Z fleet_prefix = label 2025-08-26T19:31:43.0906303Z else: 2025-08-26T19:31:43.0906892Z prefixes.append(label) 2025-08-26T19:31:43.0907216Z 2025-08-26T19:31:43.0907382Z if len(prefixes) > 1: 2025-08-26T19:31:43.0907783Z log.error( 2025-08-26T19:31:43.0908718Z 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-08-26T19:31:43.0909741Z ) 2025-08-26T19:31:43.0910096Z prefixes = prefixes[:1] 2025-08-26T19:31:43.0910379Z 2025-08-26T19:31:43.0910551Z # Fleet always comes first 2025-08-26T19:31:43.0910967Z if fleet_prefix: 2025-08-26T19:31:43.0911379Z prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:43.0911712Z 2025-08-26T19:31:43.0912078Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:43.0912476Z 2025-08-26T19:31:43.0912483Z 2025-08-26T19:31:43.0912881Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:43.0913589Z """ 2025-08-26T19:31:43.0914113Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:43.0914636Z 2025-08-26T19:31:43.0915004Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:43.0915656Z """ 2025-08-26T19:31:43.0916009Z gh = get_gh_client(github_token) 2025-08-26T19:31:43.0916494Z issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:43.0917188Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:43.0917596Z 2025-08-26T19:31:43.0917604Z 2025-08-26T19:31:43.0917974Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:43.0918669Z for _ in range(num_retries): 2025-08-26T19:31:43.0919125Z try: 2025-08-26T19:31:43.0919509Z req = Request(url=url, headers=headers) 2025-08-26T19:31:43.0920120Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:43.0920701Z return json.loads(content) 2025-08-26T19:31:43.0921182Z except Exception as e: 2025-08-26T19:31:43.0921667Z log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:43.0922165Z 2025-08-26T19:31:43.0922510Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:43.0923169Z return {} 2025-08-26T19:31:43.0923365Z 2025-08-26T19:31:43.0923371Z 2025-08-26T19:31:43.0923516Z @cache 2025-08-26T19:31:43.0924085Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:43.0924770Z """ 2025-08-26T19:31:43.0925123Z Dynamically get PR information 2025-08-26T19:31:43.0925561Z """ 2025-08-26T19:31:43.0926057Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:43.0926717Z headers = { 2025-08-26T19:31:43.0927127Z "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:43.0927680Z "Authorization": f"token {github_token}", 2025-08-26T19:31:43.0928161Z } 2025-08-26T19:31:43.0928551Z json_response: dict[str, Any] = download_json( 2025-08-26T19:31:43.0929104Z url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:43.0929596Z headers=headers, 2025-08-26T19:31:43.0929978Z ) 2025-08-26T19:31:43.0930158Z 2025-08-26T19:31:43.0930320Z if not json_response: 2025-08-26T19:31:43.0930827Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:43.0931391Z return {} 2025-08-26T19:31:43.0931623Z 2025-08-26T19:31:43.0931791Z return json_response 2025-08-26T19:31:43.0932045Z 2025-08-26T19:31:43.0932051Z 2025-08-26T19:31:43.0932417Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:43.0933087Z """ 2025-08-26T19:31:43.0933557Z Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:43.0934146Z """ 2025-08-26T19:31:43.0934572Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:43.0935143Z return { 2025-08-26T19:31:43.0935662Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:43.0936297Z } 2025-08-26T19:31:43.0936477Z 2025-08-26T19:31:43.0936482Z 2025-08-26T19:31:43.0936733Z def main() -> None: 2025-08-26T19:31:43.0937231Z args = parse_args() 2025-08-26T19:31:43.0937478Z 2025-08-26T19:31:43.0937673Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:43.0938018Z 2025-08-26T19:31:43.0938190Z # Check if the PR is opt-out 2025-08-26T19:31:43.0938629Z if args.pr_number: 2025-08-26T19:31:43.0939221Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:43.0940046Z if OPT_OUT_LABEL in labels: 2025-08-26T19:31:43.0940500Z log.info( 2025-08-26T19:31:43.0941128Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:43.0941836Z ) 2025-08-26T19:31:43.0942327Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.0942935Z sys.exit() 2025-08-26T19:31:43.0943181Z 2025-08-26T19:31:43.0943323Z try: 2025-08-26T19:31:43.0943721Z rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:43.0944370Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:43.0944963Z ) 2025-08-26T19:31:43.0945147Z 2025-08-26T19:31:43.0945336Z username = get_potential_pr_author( 2025-08-26T19:31:43.0945824Z args.github_token, 2025-08-26T19:31:43.0946262Z args.github_repo, 2025-08-26T19:31:43.0946916Z args.github_actor, 2025-08-26T19:31:43.0947373Z args.github_ref_type, 2025-08-26T19:31:43.0947829Z args.github_branch, 2025-08-26T19:31:43.0948239Z ) 2025-08-26T19:31:43.0948502Z 2025-08-26T19:31:43.0948927Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:43.0949607Z 2025-08-26T19:31:43.0949932Z runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:43.0950887Z rollout_state, 2025-08-26T19:31:43.0951917Z (args.github_issue_owner, username), 2025-08-26T19:31:43.0952894Z args.github_branch, 2025-08-26T19:31:43.0953661Z args.eligible_experiments, 2025-08-26T19:31:43.0954593Z args.opt_out_experiments, 2025-08-26T19:31:43.0955516Z is_canary, 2025-08-26T19:31:43.0956244Z ) 2025-08-26T19:31:43.0956789Z 2025-08-26T19:31:43.0957125Z except Exception as e: 2025-08-26T19:31:43.0957888Z log.error( 2025-08-26T19:31:43.0958988Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:43.0960343Z ) 2025-08-26T19:31:43.0960710Z 2025-08-26T19:31:43.0961243Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.0962106Z 2025-08-26T19:31:43.0962116Z 2025-08-26T19:31:43.0962432Z if __name__ == "__main__": 2025-08-26T19:31:43.0963133Z main() 2025-08-26T19:31:43.0963468Z 2025-08-26T19:31:43.1068895Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:43.1070393Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:43.1131868Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:43.1132681Z env: 2025-08-26T19:31:43.1133503Z GITHUB_TOKEN: *** 2025-08-26T19:31:43.1134095Z ISSUE_NUMBER: 5132 2025-08-26T19:31:43.1134828Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:43.1135684Z ISSUE_OWNER: 2025-08-26T19:31:43.1136304Z CHECK_EXPERIMENTS: 2025-08-26T19:31:43.1137245Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:43.1137969Z PR_NUMBER: 2025-08-26T19:31:43.1138609Z ##[endgroup] 2025-08-26T19:31:44.1993894Z Defaulting to user installation because normal site-packages is not writeable 2025-08-26T19:31:44.9839951Z Collecting urllib3==1.26.18 2025-08-26T19:31:45.0297855Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-26T19:31:45.0494485Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.3 MB/s eta 0:00:00 2025-08-26T19:31:45.0747965Z Collecting PyGithub==2.3.0 2025-08-26T19:31:45.0830950Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-26T19:31:45.1273315Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-26T19:31:45.1363653Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-26T19:31:45.1407045Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-26T19:31:45.1422724Z 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-08-26T19:31:45.1437274Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-26T19:31:45.1729192Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-26T19:31:45.1800003Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-26T19:31:45.2022113Z 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-08-26T19:31:45.3205815Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:45.3278353Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-26T19:31:45.4483755Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-26T19:31:45.4559605Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-26T19:31:45.4777683Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:45.4848560Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-26T19:31:45.5126328Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-26T19:31:45.5221920Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 17.6 MB/s eta 0:00:00 2025-08-26T19:31:45.5293299Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-26T19:31:45.5392897Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 41.9 MB/s eta 0:00:00 2025-08-26T19:31:45.5472096Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-26T19:31:45.5649307Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 52.3 MB/s eta 0:00:00 2025-08-26T19:31:45.5718960Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-26T19:31:45.5808569Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-26T19:31:45.5877450Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 88.0 MB/s eta 0:00:00 2025-08-26T19:31:45.5971302Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-26T19:31:45.6012329Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 31.1 MB/s eta 0:00:00 2025-08-26T19:31:45.6081610Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-26T19:31:45.6130228Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 32.3 MB/s eta 0:00:00 2025-08-26T19:31:45.8983787Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-26T19:31:46.4217567Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-26T19:31:46.4984826Z ##[group]Run curr_branch="main" 2025-08-26T19:31:46.4985149Z curr_branch="main" 2025-08-26T19:31:46.4985388Z curr_ref_type="branch" 2025-08-26T19:31:46.4985640Z echo "Current branch is '$curr_branch'" 2025-08-26T19:31:46.4985904Z  2025-08-26T19:31:46.4986099Z python3 runner_determinator.py \ 2025-08-26T19:31:46.4986389Z  --github-token "$GITHUB_TOKEN" \ 2025-08-26T19:31:46.4986890Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-26T19:31:46.4987156Z  --github-branch "$curr_branch" \ 2025-08-26T19:31:46.4987449Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-26T19:31:46.4987734Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-26T19:31:46.4988019Z  --github-ref-type "$curr_ref_type" \ 2025-08-26T19:31:46.4988290Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-26T19:31:46.4988622Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-26T19:31:46.4989022Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-26T19:31:46.4989330Z  --pr-number "${PR_NUMBER}" 2025-08-26T19:31:46.5030543Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:46.5030786Z env: 2025-08-26T19:31:46.5031355Z GITHUB_TOKEN: *** 2025-08-26T19:31:46.5031555Z ISSUE_NUMBER: 5132 2025-08-26T19:31:46.5031763Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:46.5032024Z ISSUE_OWNER: 2025-08-26T19:31:46.5032205Z CHECK_EXPERIMENTS: 2025-08-26T19:31:46.5032401Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:46.5032593Z PR_NUMBER: 2025-08-26T19:31:46.5032782Z ##[endgroup] 2025-08-26T19:31:46.5088514Z Current branch is 'main' 2025-08-26T19:31:47.8025374Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-08-26T19:31:47.8026250Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-26T19:31:47.8027123Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-26T19:31:47.8027608Z INFO : Setting output: label-type='lf.' 2025-08-26T19:31:47.8363978Z Evaluate and set job outputs 2025-08-26T19:31:47.8370974Z Set output 'label-type' 2025-08-26T19:31:47.8372987Z Cleaning up orphan processes