2025-07-17T06:33:19.4453786Z Current runner version: '2.326.0' 2025-07-17T06:33:19.4477208Z ##[group]Runner Image Provisioner 2025-07-17T06:33:19.4478113Z Hosted Compute Agent 2025-07-17T06:33:19.4478616Z Version: 20250711.363 2025-07-17T06:33:19.4479178Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:19.4480251Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:19.4480878Z ##[endgroup] 2025-07-17T06:33:19.4481425Z ##[group]Operating System 2025-07-17T06:33:19.4482071Z Ubuntu 2025-07-17T06:33:19.4482587Z 24.04.2 2025-07-17T06:33:19.4483059Z LTS 2025-07-17T06:33:19.4483634Z ##[endgroup] 2025-07-17T06:33:19.4484132Z ##[group]Runner Image 2025-07-17T06:33:19.4484716Z Image: ubuntu-24.04 2025-07-17T06:33:19.4485301Z Version: 20250710.1.0 2025-07-17T06:33:19.4486292Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:19.4487913Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:19.4488873Z ##[endgroup] 2025-07-17T06:33:19.4490023Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:19.4491826Z Metadata: read 2025-07-17T06:33:19.4492378Z ##[endgroup] 2025-07-17T06:33:19.4494450Z Secret source: Actions 2025-07-17T06:33:19.4495107Z Prepare workflow directory 2025-07-17T06:33:19.5001630Z Prepare all required actions 2025-07-17T06:33:19.5057047Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:19.5062201Z ##[group] Inputs 2025-07-17T06:33:19.5062837Z check_experiments: 2025-07-17T06:33:19.5063352Z opt_out_experiments: 2025-07-17T06:33:19.5063967Z triggering_actor: pytorchmergebot 2025-07-17T06:33:19.5064591Z issue_owner: 2025-07-17T06:33:19.5065084Z curr_branch: main 2025-07-17T06:33:19.5065536Z curr_ref_type: branch 2025-07-17T06:33:19.5066125Z issue_number: 5132 2025-07-17T06:33:19.5066755Z ##[endgroup] 2025-07-17T06:33:19.5067329Z Complete job name: get-label-type / runner-determinator 2025-07-17T06:33:20.0297566Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:20.0300228Z cat < runner_determinator.py 2025-07-17T06:33:20.0300951Z # flake8: noqa: G004 2025-07-17T06:33:20.0301491Z  2025-07-17T06:33:20.0302357Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.0303422Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.0304421Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.0305206Z  2025-07-17T06:33:20.0305647Z """ 2025-07-17T06:33:20.0306381Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.0307424Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.0308687Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.0309653Z of which runners should be used to run which job. 2025-07-17T06:33:20.0310661Z  2025-07-17T06:33:20.0311395Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.0312426Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.0313545Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.0314395Z list, defined. 2025-07-17T06:33:20.0314916Z  2025-07-17T06:33:20.0315696Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.0316742Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.0317731Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.0318777Z  2025-07-17T06:33:20.0319526Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.0321311Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.0322305Z experiments which the user could be opted in to. 2025-07-17T06:33:20.0323001Z  2025-07-17T06:33:20.0323490Z The user list has the following rules: 2025-07-17T06:33:20.0324189Z  2025-07-17T06:33:20.0324862Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.0325899Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.0326924Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.0327577Z  2025-07-17T06:33:20.0328057Z Example config: 2025-07-17T06:33:20.0328679Z  # A list of experiments that can be opted into. 2025-07-17T06:33:20.0329554Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.0330794Z  # Expected syntax is: 2025-07-17T06:33:20.0331702Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.0332852Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.0333720Z  2025-07-17T06:33:20.0334228Z  experiments: 2025-07-17T06:33:20.0334784Z  lf: 2025-07-17T06:33:20.0335365Z  rollout_percent: 25 2025-07-17T06:33:20.0336027Z  all_branches: false 2025-07-17T06:33:20.0336614Z  default: true 2025-07-17T06:33:20.0337179Z  --- 2025-07-17T06:33:20.0412508Z  2025-07-17T06:33:20.0413471Z  # Opt-ins: 2025-07-17T06:33:20.0414693Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.0416899Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.0418431Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.0419196Z  # Experiments should be from the above list. 2025-07-17T06:33:20.0420154Z  2025-07-17T06:33:20.0420594Z  @User1,-lf,split_build 2025-07-17T06:33:20.0421111Z  @User2,lf 2025-07-17T06:33:20.0421565Z  @User3,split_build 2025-07-17T06:33:20.0422041Z """ 2025-07-17T06:33:20.0422425Z  2025-07-17T06:33:20.0422801Z import json 2025-07-17T06:33:20.0423241Z import logging 2025-07-17T06:33:20.0423685Z import os 2025-07-17T06:33:20.0424104Z import random 2025-07-17T06:33:20.0424533Z import re 2025-07-17T06:33:20.0424942Z import sys 2025-07-17T06:33:20.0425408Z from argparse import ArgumentParser 2025-07-17T06:33:20.0426067Z from collections.abc import Iterable 2025-07-17T06:33:20.0426707Z from functools import cache 2025-07-17T06:33:20.0427240Z from logging import LogRecord 2025-07-17T06:33:20.0427793Z from typing import Any, NamedTuple 2025-07-17T06:33:20.0428403Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.0428982Z  2025-07-17T06:33:20.0429359Z import yaml 2025-07-17T06:33:20.0429989Z from github import Auth, Github 2025-07-17T06:33:20.0430575Z from github.Issue import Issue 2025-07-17T06:33:20.0431090Z  2025-07-17T06:33:20.0431455Z  2025-07-17T06:33:20.0431908Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.0432674Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.0433635Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.0434398Z  2025-07-17T06:33:20.0434875Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.0435716Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.0436310Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.0436954Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.0437515Z  2025-07-17T06:33:20.0437941Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.0438480Z  2025-07-17T06:33:20.0438875Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.0439390Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.0440065Z  2025-07-17T06:33:20.0440438Z  2025-07-17T06:33:20.0440843Z class Experiment(NamedTuple): 2025-07-17T06:33:20.0441388Z  rollout_perc: float = ( 2025-07-17T06:33:20.0442128Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.0442852Z  ) 2025-07-17T06:33:20.0443260Z  all_branches: bool = ( 2025-07-17T06:33:20.0443982Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.0444690Z  ) 2025-07-17T06:33:20.0445098Z  default: bool = ( 2025-07-17T06:33:20.0445747Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.0446425Z  ) 2025-07-17T06:33:20.0446809Z  2025-07-17T06:33:20.0447200Z  # Add more fields as needed 2025-07-17T06:33:20.0447709Z  2025-07-17T06:33:20.0448064Z  2025-07-17T06:33:20.0448457Z class Settings(NamedTuple): 2025-07-17T06:33:20.0448958Z  """ 2025-07-17T06:33:20.0449480Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:20.0450339Z  """ 2025-07-17T06:33:20.0450739Z  2025-07-17T06:33:20.0451177Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.0451725Z  2025-07-17T06:33:20.0452244Z  2025-07-17T06:33:20.0452699Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.0453389Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.0454006Z  2025-07-17T06:33:20.0454385Z  COLORS = { 2025-07-17T06:33:20.0454852Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.0455412Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.0455965Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.0456536Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.0457123Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.0457682Z  } 2025-07-17T06:33:20.0458112Z  2025-07-17T06:33:20.0458573Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.0459389Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.0460525Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.0461164Z  return super().format(record) 2025-07-17T06:33:20.0461707Z  2025-07-17T06:33:20.0462068Z  2025-07-17T06:33:20.0462483Z handler = logging.StreamHandler() 2025-07-17T06:33:20.0463270Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.0464027Z  2025-07-17T06:33:20.0464514Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.0465164Z log.addHandler(handler) 2025-07-17T06:33:20.0465681Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.0466175Z  2025-07-17T06:33:20.0466540Z  2025-07-17T06:33:20.0467034Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.0467659Z  """ 2025-07-17T06:33:20.0468227Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.0468905Z  """ 2025-07-17T06:33:20.0469463Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:20.0470809Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.0472014Z  log.warning( 2025-07-17T06:33:20.0472966Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.0473955Z  ) 2025-07-17T06:33:20.0474457Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.0475050Z  return 2025-07-17T06:33:20.0475481Z  2025-07-17T06:33:20.0475901Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.0476539Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.0477163Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:20.0477690Z  2025-07-17T06:33:20.0478065Z  2025-07-17T06:33:20.0478614Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.0479320Z  return frozenset( 2025-07-17T06:33:20.0480180Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.0480904Z  ) 2025-07-17T06:33:20.0481299Z  2025-07-17T06:33:20.0481666Z  2025-07-17T06:33:20.0482059Z def parse_args() -> Any: 2025-07-17T06:33:20.0482716Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.0483655Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.0484468Z  parser.add_argument( 2025-07-17T06:33:20.0484995Z  "--github-issue-repo", 2025-07-17T06:33:20.0485516Z  type=str, 2025-07-17T06:33:20.0485987Z  required=False, 2025-07-17T06:33:20.0486649Z  default="pytorch/test-infra", 2025-07-17T06:33:20.0487259Z  help="GitHub repo to get the issue", 2025-07-17T06:33:20.0487807Z  ) 2025-07-17T06:33:20.0488228Z  parser.add_argument( 2025-07-17T06:33:20.0488737Z  "--github-repo", 2025-07-17T06:33:20.0489227Z  type=str, 2025-07-17T06:33:20.0489701Z  required=True, 2025-07-17T06:33:20.0490463Z  help="GitHub repo where CI is running", 2025-07-17T06:33:20.0491027Z  ) 2025-07-17T06:33:20.0491434Z  parser.add_argument( 2025-07-17T06:33:20.0492124Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.0492826Z  ) 2025-07-17T06:33:20.0493241Z  parser.add_argument( 2025-07-17T06:33:20.0493952Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.0494681Z  ) 2025-07-17T06:33:20.0495105Z  parser.add_argument( 2025-07-17T06:33:20.0495827Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.0496565Z  ) 2025-07-17T06:33:20.0496975Z  parser.add_argument( 2025-07-17T06:33:20.0497726Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.0498475Z  ) 2025-07-17T06:33:20.0498907Z  parser.add_argument( 2025-07-17T06:33:20.0499430Z  "--github-ref-type", 2025-07-17T06:33:20.0500571Z  type=str, 2025-07-17T06:33:20.0501116Z  required=True, 2025-07-17T06:33:20.0501713Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.0502320Z  ) 2025-07-17T06:33:20.0502749Z  parser.add_argument( 2025-07-17T06:33:20.0503291Z  "--eligible-experiments", 2025-07-17T06:33:20.0504067Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.0504638Z  required=False, 2025-07-17T06:33:20.0505134Z  default="", 2025-07-17T06:33:20.0506074Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.0507049Z  ) 2025-07-17T06:33:20.0507470Z  parser.add_argument( 2025-07-17T06:33:20.0508002Z  "--opt-out-experiments", 2025-07-17T06:33:20.0508571Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.0509133Z  required=False, 2025-07-17T06:33:20.0509625Z  default="", 2025-07-17T06:33:20.0510218Z  help=( 2025-07-17T06:33:20.0510969Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.0512161Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.0513053Z  ), 2025-07-17T06:33:20.0513468Z  ) 2025-07-17T06:33:20.0513889Z  parser.add_argument( 2025-07-17T06:33:20.0514398Z  "--pr-number", 2025-07-17T06:33:20.0514890Z  type=str, 2025-07-17T06:33:20.0515359Z  required=False, 2025-07-17T06:33:20.0515856Z  default="", 2025-07-17T06:33:20.0516425Z  help="the optional PR number where this is run", 2025-07-17T06:33:20.0517030Z  ) 2025-07-17T06:33:20.0517424Z  2025-07-17T06:33:20.0517830Z  return parser.parse_args() 2025-07-17T06:33:20.0518353Z  2025-07-17T06:33:20.0518724Z  2025-07-17T06:33:20.0519373Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.0520417Z  auth = Auth.Token(github_token) 2025-07-17T06:33:20.0521025Z  return Github(auth=auth) 2025-07-17T06:33:20.0521535Z  2025-07-17T06:33:20.0521900Z  2025-07-17T06:33:20.0522610Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.0523473Z  repo = gh.get_repo(repo) 2025-07-17T06:33:20.0524054Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.0524617Z  2025-07-17T06:33:20.0524988Z  2025-07-17T06:33:20.0525394Z def get_potential_pr_author( 2025-07-17T06:33:20.0526134Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.0526911Z ) -> str: 2025-07-17T06:33:20.0527508Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.0528398Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.0529231Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:20.0530011Z  2025-07-17T06:33:20.0530439Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.0530986Z  2025-07-17T06:33:20.0531500Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.0532187Z  split_tag = ref_name.split("/") 2025-07-17T06:33:20.0532738Z  if ( 2025-07-17T06:33:20.0533193Z  len(split_tag) == 3 2025-07-17T06:33:20.0533750Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:20.0534337Z  and split_tag[2].isnumeric() 2025-07-17T06:33:20.0534884Z  ): 2025-07-17T06:33:20.0535343Z  pr_number = split_tag[2] 2025-07-17T06:33:20.0535885Z  try: 2025-07-17T06:33:20.0536392Z  repository = gh.get_repo(repo) 2025-07-17T06:33:20.0537079Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.0537910Z  except Exception as e: 2025-07-17T06:33:20.0538512Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:20.0539255Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.0540097Z  ) from e 2025-07-17T06:33:20.0540731Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.0541510Z  # In all other cases, return the original input username 2025-07-17T06:33:20.0542153Z  return username 2025-07-17T06:33:20.0542621Z  2025-07-17T06:33:20.0542997Z  2025-07-17T06:33:20.0543466Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.0544055Z  """ 2025-07-17T06:33:20.0544778Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.0545626Z  """ 2025-07-17T06:33:20.0546239Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.0546956Z  2025-07-17T06:33:20.0547325Z  2025-07-17T06:33:20.0547757Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.0548311Z  try: 2025-07-17T06:33:20.0548758Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.0549326Z  return data 2025-07-17T06:33:20.0549909Z  except yaml.YAMLError: 2025-07-17T06:33:20.0550483Z  log.exception("Error loading YAML") 2025-07-17T06:33:20.0551044Z  raise 2025-07-17T06:33:20.0551470Z  2025-07-17T06:33:20.0551842Z  2025-07-17T06:33:20.0552517Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.0553318Z  """ 2025-07-17T06:33:20.0554129Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.0554948Z  2025-07-17T06:33:20.0555534Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.0556380Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.0556981Z  2025-07-17T06:33:20.0557616Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.0558373Z  """ 2025-07-17T06:33:20.0558881Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.0559636Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.0560599Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.0561250Z  else: 2025-07-17T06:33:20.0561692Z  return "", rollout_state 2025-07-17T06:33:20.0562211Z  2025-07-17T06:33:20.0562578Z  2025-07-17T06:33:20.0563019Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.0563580Z  """ 2025-07-17T06:33:20.0564165Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.0564866Z  """ 2025-07-17T06:33:20.0565248Z  2025-07-17T06:33:20.0565611Z  2025-07-17T06:33:20.0566183Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.0566901Z  """ 2025-07-17T06:33:20.0567686Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.0568569Z  2025-07-17T06:33:20.0569438Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.0570603Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.0571355Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.0572179Z  2025-07-17T06:33:20.0572566Z  2025-07-17T06:33:20.0572933Z  """ 2025-07-17T06:33:20.0573352Z  optins = UserOptins() 2025-07-17T06:33:20.0573923Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.0574539Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:20.0575155Z  if not user or not user.startswith("@"): 2025-07-17T06:33:20.0575765Z  # Not a valid user. Skip 2025-07-17T06:33:20.0576335Z  continue 2025-07-17T06:33:20.0576793Z  2025-07-17T06:33:20.0577165Z  if user: 2025-07-17T06:33:20.0577682Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.0578433Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.0579114Z  2025-07-17T06:33:20.0579505Z  return optins 2025-07-17T06:33:20.0580069Z  2025-07-17T06:33:20.0580429Z  2025-07-17T06:33:20.0580970Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.0581639Z  """ 2025-07-17T06:33:20.0582096Z  Check if the experiment name is valid. 2025-07-17T06:33:20.0582672Z  A valid name: 2025-07-17T06:33:20.0583397Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.0584412Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.0585173Z  - Cannot contain spaces 2025-07-17T06:33:20.0585692Z  """ 2025-07-17T06:33:20.0586090Z  2025-07-17T06:33:20.0586588Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.0587379Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.0588279Z  2025-07-17T06:33:20.0588787Z  if valid: 2025-07-17T06:33:20.0589227Z  return True 2025-07-17T06:33:20.0589688Z  2025-07-17T06:33:20.0590163Z  log.error( 2025-07-17T06:33:20.0591748Z  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-07-17T06:33:20.0593380Z  ) 2025-07-17T06:33:20.0593776Z  return False 2025-07-17T06:33:20.0594240Z  2025-07-17T06:33:20.0594602Z  2025-07-17T06:33:20.0595162Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.0595845Z  """ 2025-07-17T06:33:20.0596503Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.0597276Z  """ 2025-07-17T06:33:20.0597684Z  try: 2025-07-17T06:33:20.0598106Z  if settings_text: 2025-07-17T06:33:20.0598915Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.0599775Z  # for easy reading 2025-07-17T06:33:20.0600758Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.0601720Z  # the backtick character in shell commands. 2025-07-17T06:33:20.0602391Z  backtick = chr(96) # backtick character 2025-07-17T06:33:20.0603133Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.0603860Z  settings = load_yaml(settings_text) 2025-07-17T06:33:20.0604409Z  2025-07-17T06:33:20.0605054Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.0605983Z  experiments = {} 2025-07-17T06:33:20.0606485Z  2025-07-17T06:33:20.0607086Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.0607909Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.0609077Z  # 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-07-17T06:33:20.0610306Z  continue 2025-07-17T06:33:20.0610809Z  2025-07-17T06:33:20.0611222Z  valid_settings = {} 2025-07-17T06:33:20.0611804Z  for setting in exp_settings: 2025-07-17T06:33:20.0612443Z  if setting not in Experiment._fields: 2025-07-17T06:33:20.0613063Z  log.warning( 2025-07-17T06:33:20.0613853Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.0614616Z  ) 2025-07-17T06:33:20.0615106Z  else: 2025-07-17T06:33:20.0615699Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.0616315Z  2025-07-17T06:33:20.0616826Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.0617527Z  return Settings(experiments) 2025-07-17T06:33:20.0618065Z  2025-07-17T06:33:20.0618462Z  except Exception: 2025-07-17T06:33:20.0619018Z  log.exception("Failed to parse settings") 2025-07-17T06:33:20.0619604Z  2025-07-17T06:33:20.0620089Z  return Settings() 2025-07-17T06:33:20.0620564Z  2025-07-17T06:33:20.0620929Z  2025-07-17T06:33:20.0621548Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.0622184Z  """ 2025-07-17T06:33:20.0622680Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.0623282Z  2025-07-17T06:33:20.0623859Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.0624691Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.0625294Z  2025-07-17T06:33:20.0625940Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.0626755Z  """ 2025-07-17T06:33:20.0627376Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.0628205Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.0628794Z  2025-07-17T06:33:20.0629162Z  2025-07-17T06:33:20.0629652Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.0630846Z  """ 2025-07-17T06:33:20.0631380Z  Parse users from the rollout state. 2025-07-17T06:33:20.0631937Z  2025-07-17T06:33:20.0632307Z  """ 2025-07-17T06:33:20.0632903Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.0633715Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.0634300Z  2025-07-17T06:33:20.0634670Z  2025-07-17T06:33:20.0635335Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.0636150Z  """ 2025-07-17T06:33:20.0636633Z  Check if a user is opted into an experiment 2025-07-17T06:33:20.0637210Z  """ 2025-07-17T06:33:20.0637731Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.0638355Z  2025-07-17T06:33:20.0638721Z  2025-07-17T06:33:20.0639569Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.0640517Z  """ 2025-07-17T06:33:20.0641035Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.0641662Z  """ 2025-07-17T06:33:20.0642228Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.0642979Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.0643682Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.0644332Z  return False 2025-07-17T06:33:20.0644795Z  2025-07-17T06:33:20.0645292Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.0645942Z  log.warning( 2025-07-17T06:33:20.0646854Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.0647789Z  ) 2025-07-17T06:33:20.0648194Z  2025-07-17T06:33:20.0648570Z  return True 2025-07-17T06:33:20.0649012Z  2025-07-17T06:33:20.0649375Z  2025-07-17T06:33:20.0649775Z def get_runner_prefix( 2025-07-17T06:33:20.0650520Z  rollout_state: str, 2025-07-17T06:33:20.0651057Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:20.0651627Z  branch: str, 2025-07-17T06:33:20.0652196Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.0652940Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.0653575Z  is_canary: bool = False, 2025-07-17T06:33:20.0654090Z ) -> str: 2025-07-17T06:33:20.0654578Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:20.0655224Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.0655791Z  2025-07-17T06:33:20.0656319Z  fleet_prefix = "" 2025-07-17T06:33:20.0656834Z  prefixes = [] 2025-07-17T06:33:20.0657550Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.0658567Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.0659334Z  log.info( 2025-07-17T06:33:20.0660214Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.0661019Z  ) 2025-07-17T06:33:20.0661468Z  continue 2025-07-17T06:33:20.0661930Z  2025-07-17T06:33:20.0662338Z  if opt_out_experiments: 2025-07-17T06:33:20.0662952Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.0663669Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.0664315Z  log.info( 2025-07-17T06:33:20.0665335Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.0666355Z  ) 2025-07-17T06:33:20.0666818Z  continue 2025-07-17T06:33:20.0667295Z  2025-07-17T06:33:20.0667755Z  if eligible_experiments: 2025-07-17T06:33:20.0668389Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.0669082Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.0669690Z  log.info( 2025-07-17T06:33:20.0670646Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.0671534Z  ) 2025-07-17T06:33:20.0671989Z  continue 2025-07-17T06:33:20.0672689Z  elif not experiment_settings.default: 2025-07-17T06:33:20.0673275Z  log.info( 2025-07-17T06:33:20.0674008Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.0674793Z  ) 2025-07-17T06:33:20.0675226Z  continue 2025-07-17T06:33:20.0675680Z  2025-07-17T06:33:20.0676187Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.0676863Z  opted_out_users = [ 2025-07-17T06:33:20.0677390Z  requestor 2025-07-17T06:33:20.0677921Z  for requestor in workflow_requestors 2025-07-17T06:33:20.0678659Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.0679331Z  ] 2025-07-17T06:33:20.0679741Z  2025-07-17T06:33:20.0680242Z  if opted_out_users: 2025-07-17T06:33:20.0680789Z  log.info( 2025-07-17T06:33:20.0681501Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.0682253Z  ) 2025-07-17T06:33:20.0682700Z  continue 2025-07-17T06:33:20.0683157Z  2025-07-17T06:33:20.0683669Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.0684323Z  opted_in_users = [ 2025-07-17T06:33:20.0684861Z  requestor 2025-07-17T06:33:20.0685393Z  for requestor in workflow_requestors 2025-07-17T06:33:20.0686125Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.0686798Z  ] 2025-07-17T06:33:20.0687202Z  2025-07-17T06:33:20.0687605Z  enabled = False 2025-07-17T06:33:20.0688110Z  if opted_in_users: 2025-07-17T06:33:20.0688758Z  log.info( 2025-07-17T06:33:20.0689461Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.0690299Z  ) 2025-07-17T06:33:20.0690750Z  enabled = True 2025-07-17T06:33:20.0691238Z  2025-07-17T06:33:20.0691687Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.0692581Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.0693590Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.0694287Z  log.info( 2025-07-17T06:33:20.0695233Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.0696205Z  ) 2025-07-17T06:33:20.0696680Z  enabled = True 2025-07-17T06:33:20.0697198Z  2025-07-17T06:33:20.0697579Z  if enabled: 2025-07-17T06:33:20.0698092Z  label = experiment_name 2025-07-17T06:33:20.0698702Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.0699600Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.0700643Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.0701471Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.0702189Z  if is_canary: 2025-07-17T06:33:20.0702749Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.0703348Z  fleet_prefix = label 2025-07-17T06:33:20.0703897Z  else: 2025-07-17T06:33:20.0704408Z  prefixes.append(label) 2025-07-17T06:33:20.0705091Z  2025-07-17T06:33:20.0705484Z  if len(prefixes) > 1: 2025-07-17T06:33:20.0705995Z  log.error( 2025-07-17T06:33:20.0707110Z  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-07-17T06:33:20.0708295Z  ) 2025-07-17T06:33:20.0708748Z  prefixes = prefixes[:1] 2025-07-17T06:33:20.0709270Z  2025-07-17T06:33:20.0709675Z  # Fleet always comes first 2025-07-17T06:33:20.0710311Z  if fleet_prefix: 2025-07-17T06:33:20.0710834Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.0711382Z  2025-07-17T06:33:20.0711871Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.0712482Z  2025-07-17T06:33:20.0712854Z  2025-07-17T06:33:20.0713555Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.0714371Z  """ 2025-07-17T06:33:20.0715025Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.0715781Z  2025-07-17T06:33:20.0716405Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.0717150Z  """ 2025-07-17T06:33:20.0717601Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.0718221Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.0718921Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.0719568Z  2025-07-17T06:33:20.0720036Z  2025-07-17T06:33:20.0720687Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.0721621Z  for _ in range(num_retries): 2025-07-17T06:33:20.0722168Z  try: 2025-07-17T06:33:20.0722666Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:20.0723378Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.0724120Z  return json.loads(content) 2025-07-17T06:33:20.0724690Z  except Exception as e: 2025-07-17T06:33:20.0725385Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.0725983Z  2025-07-17T06:33:20.0726637Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.0727414Z  return {} 2025-07-17T06:33:20.0727843Z  2025-07-17T06:33:20.0728213Z  2025-07-17T06:33:20.0728578Z @cache 2025-07-17T06:33:20.0729276Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.0730185Z  """ 2025-07-17T06:33:20.0730635Z  Dynamically get PR information 2025-07-17T06:33:20.0731174Z  """ 2025-07-17T06:33:20.0731736Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.0732412Z  headers = { 2025-07-17T06:33:20.0732945Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.0733613Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:20.0734183Z  } 2025-07-17T06:33:20.0734678Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.0735340Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.0735931Z  headers=headers, 2025-07-17T06:33:20.0736422Z  ) 2025-07-17T06:33:20.0736812Z  2025-07-17T06:33:20.0737208Z  if not json_response: 2025-07-17T06:33:20.0737852Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.0738677Z  return {} 2025-07-17T06:33:20.0739130Z  2025-07-17T06:33:20.0739530Z  return json_response 2025-07-17T06:33:20.0740124Z  2025-07-17T06:33:20.0740498Z  2025-07-17T06:33:20.0741136Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.0741919Z  """ 2025-07-17T06:33:20.0742517Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.0743214Z  """ 2025-07-17T06:33:20.0743763Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.0744411Z  return { 2025-07-17T06:33:20.0745067Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.0745805Z  } 2025-07-17T06:33:20.0746186Z  2025-07-17T06:33:20.0746560Z  2025-07-17T06:33:20.0746952Z def main() -> None: 2025-07-17T06:33:20.0747454Z  args = parse_args() 2025-07-17T06:33:20.0747931Z  2025-07-17T06:33:20.0748389Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.0748966Z  2025-07-17T06:33:20.0749381Z  # Check if the PR is opt-out 2025-07-17T06:33:20.0750039Z  if args.pr_number: 2025-07-17T06:33:20.0750782Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.0751596Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.0752142Z  log.info( 2025-07-17T06:33:20.0752909Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.0753711Z  ) 2025-07-17T06:33:20.0754352Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.0755081Z  sys.exit() 2025-07-17T06:33:20.0755679Z  2025-07-17T06:33:20.0756068Z  try: 2025-07-17T06:33:20.0756562Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.0757336Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.0758018Z  ) 2025-07-17T06:33:20.0758431Z  2025-07-17T06:33:20.0758862Z  username = get_potential_pr_author( 2025-07-17T06:33:20.0759449Z  args.github_token, 2025-07-17T06:33:20.0760101Z  args.github_repo, 2025-07-17T06:33:20.0760633Z  args.github_actor, 2025-07-17T06:33:20.0761188Z  args.github_ref_type, 2025-07-17T06:33:20.0761739Z  args.github_branch, 2025-07-17T06:33:20.0762258Z  ) 2025-07-17T06:33:20.0762658Z  2025-07-17T06:33:20.0763184Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.0763842Z  2025-07-17T06:33:20.0764292Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.0764889Z  rollout_state, 2025-07-17T06:33:20.0765447Z  (args.github_issue_owner, username), 2025-07-17T06:33:20.0766046Z  args.github_branch, 2025-07-17T06:33:20.0766607Z  args.eligible_experiments, 2025-07-17T06:33:20.0767204Z  args.opt_out_experiments, 2025-07-17T06:33:20.0767772Z  is_canary, 2025-07-17T06:33:20.0768244Z  ) 2025-07-17T06:33:20.0768649Z  2025-07-17T06:33:20.0769042Z  except Exception as e: 2025-07-17T06:33:20.0769561Z  log.error( 2025-07-17T06:33:20.0770417Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.0771214Z  ) 2025-07-17T06:33:20.0771615Z  2025-07-17T06:33:20.0772308Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.0773010Z  2025-07-17T06:33:20.0773372Z  2025-07-17T06:33:20.0773772Z if __name__ == "__main__": 2025-07-17T06:33:20.0774269Z  main() 2025-07-17T06:33:20.0774686Z  2025-07-17T06:33:20.0775053Z EOF 2025-07-17T06:33:20.0775436Z  2025-07-17T06:33:20.0775844Z cat runner_determinator.py 2025-07-17T06:33:20.1006484Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.1007299Z env: 2025-07-17T06:33:20.1008035Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.1008470Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.1008925Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.1009431Z ISSUE_OWNER: 2025-07-17T06:33:20.1010006Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.1010448Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.1010869Z PR_NUMBER: 2025-07-17T06:33:20.1011251Z ##[endgroup] 2025-07-17T06:33:20.1214129Z # flake8: noqa: G004 2025-07-17T06:33:20.1214484Z 2025-07-17T06:33:20.1214918Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.1215893Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.1216683Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.1217113Z 2025-07-17T06:33:20.1217277Z """ 2025-07-17T06:33:20.1217839Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.1218707Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.1219641Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.1220738Z of which runners should be used to run which job. 2025-07-17T06:33:20.1221142Z 2025-07-17T06:33:20.1221524Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.1222594Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.1223485Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.1224172Z list, defined. 2025-07-17T06:33:20.1224399Z 2025-07-17T06:33:20.1224748Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.1225674Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.1226495Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.1226932Z 2025-07-17T06:33:20.1227303Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.1228157Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.1228883Z experiments which the user could be opted in to. 2025-07-17T06:33:20.1229276Z 2025-07-17T06:33:20.1229476Z The user list has the following rules: 2025-07-17T06:33:20.1230012Z 2025-07-17T06:33:20.1230343Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.1231216Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.1231986Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.1232379Z 2025-07-17T06:33:20.1232555Z Example config: 2025-07-17T06:33:20.1232995Z # A list of experiments that can be opted into. 2025-07-17T06:33:20.1233655Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.1234277Z # Expected syntax is: 2025-07-17T06:33:20.1234917Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.1235894Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.1236502Z 2025-07-17T06:33:20.1236671Z experiments: 2025-07-17T06:33:20.1237058Z lf: 2025-07-17T06:33:20.1237428Z rollout_percent: 25 2025-07-17T06:33:20.1237879Z all_branches: false 2025-07-17T06:33:20.1238501Z default: true 2025-07-17T06:33:20.1238913Z --- 2025-07-17T06:33:20.1239110Z 2025-07-17T06:33:20.1239272Z # Opt-ins: 2025-07-17T06:33:20.1240070Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.1240944Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.1241718Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.1242364Z # Experiments should be from the above list. 2025-07-17T06:33:20.1242740Z 2025-07-17T06:33:20.1242924Z @User1,-lf,split_build 2025-07-17T06:33:20.1243367Z @User2,lf 2025-07-17T06:33:20.1243784Z @User3,split_build 2025-07-17T06:33:20.1244190Z """ 2025-07-17T06:33:20.1244380Z 2025-07-17T06:33:20.1244542Z import json 2025-07-17T06:33:20.1244915Z import logging 2025-07-17T06:33:20.1245288Z import os 2025-07-17T06:33:20.1245647Z import random 2025-07-17T06:33:20.1246020Z import re 2025-07-17T06:33:20.1246371Z import sys 2025-07-17T06:33:20.1246791Z from argparse import ArgumentParser 2025-07-17T06:33:20.1247322Z from collections.abc import Iterable 2025-07-17T06:33:20.1247841Z from functools import cache 2025-07-17T06:33:20.1248309Z from logging import LogRecord 2025-07-17T06:33:20.1248800Z from typing import Any, NamedTuple 2025-07-17T06:33:20.1249329Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.1249706Z 2025-07-17T06:33:20.1250111Z import yaml 2025-07-17T06:33:20.1250528Z from github import Auth, Github 2025-07-17T06:33:20.1251030Z from github.Issue import Issue 2025-07-17T06:33:20.1251330Z 2025-07-17T06:33:20.1251337Z 2025-07-17T06:33:20.1251559Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.1252230Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.1253080Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.1253638Z 2025-07-17T06:33:20.1253866Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.1254608Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.1255127Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.1255679Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.1256027Z 2025-07-17T06:33:20.1256227Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.1256561Z 2025-07-17T06:33:20.1256746Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.1257207Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.1257483Z 2025-07-17T06:33:20.1257489Z 2025-07-17T06:33:20.1257675Z class Experiment(NamedTuple): 2025-07-17T06:33:20.1258157Z rollout_perc: float = ( 2025-07-17T06:33:20.1258777Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.1259466Z ) 2025-07-17T06:33:20.1260060Z all_branches: bool = ( 2025-07-17T06:33:20.1260710Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.1261379Z ) 2025-07-17T06:33:20.1261744Z default: bool = ( 2025-07-17T06:33:20.1262322Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.1262959Z ) 2025-07-17T06:33:20.1263163Z 2025-07-17T06:33:20.1263343Z # Add more fields as needed 2025-07-17T06:33:20.1263642Z 2025-07-17T06:33:20.1263649Z 2025-07-17T06:33:20.1263839Z class Settings(NamedTuple): 2025-07-17T06:33:20.1264280Z """ 2025-07-17T06:33:20.1264726Z Settings for the experiments that can be opted into. 2025-07-17T06:33:20.1265287Z """ 2025-07-17T06:33:20.1265479Z 2025-07-17T06:33:20.1265691Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.1266047Z 2025-07-17T06:33:20.1266054Z 2025-07-17T06:33:20.1266258Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.1266881Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.1267312Z 2025-07-17T06:33:20.1267479Z COLORS = { 2025-07-17T06:33:20.1267868Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.1268373Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.1269071Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.1269575Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.1270170Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.1270638Z } 2025-07-17T06:33:20.1270834Z 2025-07-17T06:33:20.1271049Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.1271813Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.1272584Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.1273151Z return super().format(record) 2025-07-17T06:33:20.1273479Z 2025-07-17T06:33:20.1273485Z 2025-07-17T06:33:20.1273683Z handler = logging.StreamHandler() 2025-07-17T06:33:20.1274371Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.1274924Z 2025-07-17T06:33:20.1275165Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.1275741Z log.addHandler(handler) 2025-07-17T06:33:20.1276187Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.1276476Z 2025-07-17T06:33:20.1276482Z 2025-07-17T06:33:20.1276734Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.1277290Z """ 2025-07-17T06:33:20.1277789Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.1278407Z """ 2025-07-17T06:33:20.1278770Z if not GITHUB_OUTPUT: 2025-07-17T06:33:20.1279934Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.1281054Z log.warning( 2025-07-17T06:33:20.1281901Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.1282809Z ) 2025-07-17T06:33:20.1293604Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.1294214Z return 2025-07-17T06:33:20.1294451Z 2025-07-17T06:33:20.1294856Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.1295481Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.1296054Z f.write(f"{key}={value}\n") 2025-07-17T06:33:20.1296384Z 2025-07-17T06:33:20.1296392Z 2025-07-17T06:33:20.1296711Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.1297341Z return frozenset( 2025-07-17T06:33:20.1297957Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.1298639Z ) 2025-07-17T06:33:20.1298841Z 2025-07-17T06:33:20.1298848Z 2025-07-17T06:33:20.1299031Z def parse_args() -> Any: 2025-07-17T06:33:20.1299585Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.1300654Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.1301429Z parser.add_argument( 2025-07-17T06:33:20.1301876Z "--github-issue-repo", 2025-07-17T06:33:20.1302328Z type=str, 2025-07-17T06:33:20.1302728Z required=False, 2025-07-17T06:33:20.1303181Z default="pytorch/test-infra", 2025-07-17T06:33:20.1303708Z help="GitHub repo to get the issue", 2025-07-17T06:33:20.1304218Z ) 2025-07-17T06:33:20.1304582Z parser.add_argument( 2025-07-17T06:33:20.1305022Z "--github-repo", 2025-07-17T06:33:20.1305444Z type=str, 2025-07-17T06:33:20.1305834Z required=True, 2025-07-17T06:33:20.1306297Z help="GitHub repo where CI is running", 2025-07-17T06:33:20.1306852Z ) 2025-07-17T06:33:20.1307237Z parser.add_argument( 2025-07-17T06:33:20.1307831Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.1308487Z ) 2025-07-17T06:33:20.1308844Z parser.add_argument( 2025-07-17T06:33:20.1309460Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.1310246Z ) 2025-07-17T06:33:20.1310618Z parser.add_argument( 2025-07-17T06:33:20.1311263Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.1312111Z ) 2025-07-17T06:33:20.1312476Z parser.add_argument( 2025-07-17T06:33:20.1313115Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.1313830Z ) 2025-07-17T06:33:20.1314186Z parser.add_argument( 2025-07-17T06:33:20.1314627Z "--github-ref-type", 2025-07-17T06:33:20.1315069Z type=str, 2025-07-17T06:33:20.1315466Z required=True, 2025-07-17T06:33:20.1315939Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.1316497Z ) 2025-07-17T06:33:20.1316863Z parser.add_argument( 2025-07-17T06:33:20.1317326Z "--eligible-experiments", 2025-07-17T06:33:20.1317836Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.1318357Z required=False, 2025-07-17T06:33:20.1318777Z default="", 2025-07-17T06:33:20.1319659Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.1320710Z ) 2025-07-17T06:33:20.1370226Z parser.add_argument( 2025-07-17T06:33:20.1370917Z "--opt-out-experiments", 2025-07-17T06:33:20.1371488Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.1372019Z required=False, 2025-07-17T06:33:20.1372435Z default="", 2025-07-17T06:33:20.1372827Z help=( 2025-07-17T06:33:20.1373500Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.1374627Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.1375460Z ), 2025-07-17T06:33:20.1375808Z ) 2025-07-17T06:33:20.1376179Z parser.add_argument( 2025-07-17T06:33:20.1376610Z "--pr-number", 2025-07-17T06:33:20.1377022Z type=str, 2025-07-17T06:33:20.1377411Z required=False, 2025-07-17T06:33:20.1377831Z default="", 2025-07-17T06:33:20.1378492Z help="the optional PR number where this is run", 2025-07-17T06:33:20.1379067Z ) 2025-07-17T06:33:20.1379261Z 2025-07-17T06:33:20.1379452Z return parser.parse_args() 2025-07-17T06:33:20.1379756Z 2025-07-17T06:33:20.1379763Z 2025-07-17T06:33:20.1380290Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.1381048Z auth = Auth.Token(github_token) 2025-07-17T06:33:20.1381542Z return Github(auth=auth) 2025-07-17T06:33:20.1381839Z 2025-07-17T06:33:20.1381845Z 2025-07-17T06:33:20.1382302Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.1383091Z repo = gh.get_repo(repo) 2025-07-17T06:33:20.1383594Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.1383954Z 2025-07-17T06:33:20.1383960Z 2025-07-17T06:33:20.1384155Z def get_potential_pr_author( 2025-07-17T06:33:20.1384785Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.1385462Z ) -> str: 2025-07-17T06:33:20.1385970Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.1386774Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.1387502Z # embedded in the tag name: ciflow// 2025-07-17T06:33:20.1387915Z 2025-07-17T06:33:20.1388103Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.1388423Z 2025-07-17T06:33:20.1388689Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.1389291Z split_tag = ref_name.split("/") 2025-07-17T06:33:20.1389889Z if ( 2025-07-17T06:33:20.1390277Z len(split_tag) == 3 2025-07-17T06:33:20.1390752Z and split_tag[0] == "ciflow" 2025-07-17T06:33:20.1391268Z and split_tag[2].isnumeric() 2025-07-17T06:33:20.1391753Z ): 2025-07-17T06:33:20.1392132Z pr_number = split_tag[2] 2025-07-17T06:33:20.1392611Z try: 2025-07-17T06:33:20.1393178Z repository = gh.get_repo(repo) 2025-07-17T06:33:20.1393782Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.1394378Z except Exception as e: 2025-07-17T06:33:20.1394886Z raise Exception( # noqa: TRY002 2025-07-17T06:33:20.1395544Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.1396180Z ) from e 2025-07-17T06:33:20.1396710Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.1397400Z # In all other cases, return the original input username 2025-07-17T06:33:20.1397979Z return username 2025-07-17T06:33:20.1398217Z 2025-07-17T06:33:20.1398224Z 2025-07-17T06:33:20.1398455Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.1398981Z """ 2025-07-17T06:33:20.1399616Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.1400506Z """ 2025-07-17T06:33:20.1401047Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.1401559Z 2025-07-17T06:33:20.1401565Z 2025-07-17T06:33:20.1401768Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.1402257Z try: 2025-07-17T06:33:20.1402650Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.1403143Z return data 2025-07-17T06:33:20.1403554Z except yaml.YAMLError: 2025-07-17T06:33:20.1404028Z log.exception("Error loading YAML") 2025-07-17T06:33:20.1404532Z raise 2025-07-17T06:33:20.1404742Z 2025-07-17T06:33:20.1404748Z 2025-07-17T06:33:20.1405154Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.1405887Z """ 2025-07-17T06:33:20.1406506Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.1407100Z 2025-07-17T06:33:20.1407695Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.1408460Z and the text below is the list of opted in users. 2025-07-17T06:33:20.1408859Z 2025-07-17T06:33:20.1409228Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.1410045Z """ 2025-07-17T06:33:20.1410487Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.1411098Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.1411698Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.1412284Z else: 2025-07-17T06:33:20.1412667Z return "", rollout_state 2025-07-17T06:33:20.1412969Z 2025-07-17T06:33:20.1412975Z 2025-07-17T06:33:20.1413178Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.1413681Z """ 2025-07-17T06:33:20.1414194Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.1414833Z """ 2025-07-17T06:33:20.1415030Z 2025-07-17T06:33:20.1415036Z 2025-07-17T06:33:20.1415382Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.1416024Z """ 2025-07-17T06:33:20.1416745Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.1417435Z 2025-07-17T06:33:20.1418056Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.1419050Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.1419769Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.1420351Z 2025-07-17T06:33:20.1420358Z 2025-07-17T06:33:20.1420518Z """ 2025-07-17T06:33:20.1420895Z optins = UserOptins() 2025-07-17T06:33:20.1421375Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.1421935Z user = user.strip("\r\n\t -") 2025-07-17T06:33:20.1422473Z if not user or not user.startswith("@"): 2025-07-17T06:33:20.1423036Z # Not a valid user. Skip 2025-07-17T06:33:20.1423668Z continue 2025-07-17T06:33:20.1423921Z 2025-07-17T06:33:20.1424083Z if user: 2025-07-17T06:33:20.1424520Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.1425204Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.1425699Z 2025-07-17T06:33:20.1425875Z return optins 2025-07-17T06:33:20.1426109Z 2025-07-17T06:33:20.1426115Z 2025-07-17T06:33:20.1426400Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.1427007Z """ 2025-07-17T06:33:20.1427400Z Check if the experiment name is valid. 2025-07-17T06:33:20.1427929Z A valid name: 2025-07-17T06:33:20.1428559Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.1429487Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.1430340Z - Cannot contain spaces 2025-07-17T06:33:20.1430814Z """ 2025-07-17T06:33:20.1431022Z 2025-07-17T06:33:20.1431287Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.1431989Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.1432440Z 2025-07-17T06:33:20.1432602Z if valid: 2025-07-17T06:33:20.1432982Z return True 2025-07-17T06:33:20.1433224Z 2025-07-17T06:33:20.1433387Z log.error( 2025-07-17T06:33:20.1434838Z 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-07-17T06:33:20.1436404Z ) 2025-07-17T06:33:20.1436760Z return False 2025-07-17T06:33:20.1436988Z 2025-07-17T06:33:20.1436995Z 2025-07-17T06:33:20.1437297Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.1437911Z """ 2025-07-17T06:33:20.1438617Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.1439348Z """ 2025-07-17T06:33:20.1439701Z try: 2025-07-17T06:33:20.1440181Z if settings_text: 2025-07-17T06:33:20.1440915Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.1441703Z # for easy reading 2025-07-17T06:33:20.1442486Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.1443375Z # the backtick character in shell commands. 2025-07-17T06:33:20.1443971Z backtick = chr(96) # backtick character 2025-07-17T06:33:20.1444633Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.1445289Z settings = load_yaml(settings_text) 2025-07-17T06:33:20.1445661Z 2025-07-17T06:33:20.1446072Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.1446844Z experiments = {} 2025-07-17T06:33:20.1447137Z 2025-07-17T06:33:20.1447520Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.1448290Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.1449416Z # 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-07-17T06:33:20.1450813Z continue 2025-07-17T06:33:20.1451105Z 2025-07-17T06:33:20.1451287Z valid_settings = {} 2025-07-17T06:33:20.1451806Z for setting in exp_settings: 2025-07-17T06:33:20.1452379Z if setting not in Experiment._fields: 2025-07-17T06:33:20.1452933Z log.warning( 2025-07-17T06:33:20.1453632Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.1454363Z ) 2025-07-17T06:33:20.1454965Z else: 2025-07-17T06:33:20.1455476Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.1455914Z 2025-07-17T06:33:20.1456189Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.1456827Z return Settings(experiments) 2025-07-17T06:33:20.1457178Z 2025-07-17T06:33:20.1457353Z except Exception: 2025-07-17T06:33:20.1457831Z log.exception("Failed to parse settings") 2025-07-17T06:33:20.1458226Z 2025-07-17T06:33:20.1458398Z return Settings() 2025-07-17T06:33:20.1458661Z 2025-07-17T06:33:20.1458667Z 2025-07-17T06:33:20.1458917Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.1459487Z """ 2025-07-17T06:33:20.1460206Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.1460652Z 2025-07-17T06:33:20.1461018Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.1461790Z and the text below is the list of opted in users. 2025-07-17T06:33:20.1462201Z 2025-07-17T06:33:20.1462609Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.1463435Z """ 2025-07-17T06:33:20.1463989Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.1464749Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.1465147Z 2025-07-17T06:33:20.1465153Z 2025-07-17T06:33:20.1465401Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.1465970Z """ 2025-07-17T06:33:20.1466352Z Parse users from the rollout state. 2025-07-17T06:33:20.1466707Z 2025-07-17T06:33:20.1466871Z """ 2025-07-17T06:33:20.1467393Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.1468124Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.1468528Z 2025-07-17T06:33:20.1468534Z 2025-07-17T06:33:20.1469110Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.1470082Z """ 2025-07-17T06:33:20.1470520Z Check if a user is opted into an experiment 2025-07-17T06:33:20.1471065Z """ 2025-07-17T06:33:20.1471517Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.1471937Z 2025-07-17T06:33:20.1471944Z 2025-07-17T06:33:20.1472363Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.1473118Z """ 2025-07-17T06:33:20.1473577Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.1474153Z """ 2025-07-17T06:33:20.1474656Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.1475330Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.1475969Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.1476566Z return False 2025-07-17T06:33:20.1476835Z 2025-07-17T06:33:20.1477119Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.1477717Z log.warning( 2025-07-17T06:33:20.1478513Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.1479396Z ) 2025-07-17T06:33:20.1479605Z 2025-07-17T06:33:20.1479768Z return True 2025-07-17T06:33:20.1480105Z 2025-07-17T06:33:20.1480118Z 2025-07-17T06:33:20.1480296Z def get_runner_prefix( 2025-07-17T06:33:20.1480730Z rollout_state: str, 2025-07-17T06:33:20.1481188Z workflow_requestors: Iterable[str], 2025-07-17T06:33:20.1481698Z branch: str, 2025-07-17T06:33:20.1482182Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.1482844Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.1483432Z is_canary: bool = False, 2025-07-17T06:33:20.1483889Z ) -> str: 2025-07-17T06:33:20.1484302Z settings = parse_settings(rollout_state) 2025-07-17T06:33:20.1485042Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.1485410Z 2025-07-17T06:33:20.1485582Z fleet_prefix = "" 2025-07-17T06:33:20.1486012Z prefixes = [] 2025-07-17T06:33:20.1486628Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.1487565Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.1488279Z log.info( 2025-07-17T06:33:20.1488948Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.1489720Z ) 2025-07-17T06:33:20.1490213Z continue 2025-07-17T06:33:20.1490468Z 2025-07-17T06:33:20.1490657Z if opt_out_experiments: 2025-07-17T06:33:20.1491185Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.1491837Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.1492419Z log.info( 2025-07-17T06:33:20.1493356Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.1494357Z ) 2025-07-17T06:33:20.1494749Z continue 2025-07-17T06:33:20.1495019Z 2025-07-17T06:33:20.1495211Z if eligible_experiments: 2025-07-17T06:33:20.1495759Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.1496396Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.1496954Z log.info( 2025-07-17T06:33:20.1497735Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.1498577Z ) 2025-07-17T06:33:20.1498967Z continue 2025-07-17T06:33:20.1499441Z elif not experiment_settings.default: 2025-07-17T06:33:20.1500069Z log.info( 2025-07-17T06:33:20.1500848Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.1501605Z ) 2025-07-17T06:33:20.1501981Z continue 2025-07-17T06:33:20.1501990Z 2025-07-17T06:33:20.1502264Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.1502445Z opted_out_users = [ 2025-07-17T06:33:20.1502609Z requestor 2025-07-17T06:33:20.1502819Z for requestor in workflow_requestors 2025-07-17T06:33:20.1503117Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.1503283Z ] 2025-07-17T06:33:20.1503290Z 2025-07-17T06:33:20.1503470Z if opted_out_users: 2025-07-17T06:33:20.1503635Z log.info( 2025-07-17T06:33:20.1504007Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.1504168Z ) 2025-07-17T06:33:20.1504330Z continue 2025-07-17T06:33:20.1504337Z 2025-07-17T06:33:20.1504620Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.1504803Z opted_in_users = [ 2025-07-17T06:33:20.1504967Z requestor 2025-07-17T06:33:20.1505173Z for requestor in workflow_requestors 2025-07-17T06:33:20.1505472Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.1505629Z ] 2025-07-17T06:33:20.1505637Z 2025-07-17T06:33:20.1505806Z enabled = False 2025-07-17T06:33:20.1505983Z if opted_in_users: 2025-07-17T06:33:20.1506148Z log.info( 2025-07-17T06:33:20.1506496Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.1506662Z ) 2025-07-17T06:33:20.1506839Z enabled = True 2025-07-17T06:33:20.1506846Z 2025-07-17T06:33:20.1507057Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.1507508Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.1507992Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.1508164Z log.info( 2025-07-17T06:33:20.1508760Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.1508928Z ) 2025-07-17T06:33:20.1509102Z enabled = True 2025-07-17T06:33:20.1509111Z 2025-07-17T06:33:20.1509273Z if enabled: 2025-07-17T06:33:20.1509461Z label = experiment_name 2025-07-17T06:33:20.1509681Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.1510228Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.1510503Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.1510823Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.1510998Z if is_canary: 2025-07-17T06:33:20.1511195Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.1511382Z fleet_prefix = label 2025-07-17T06:33:20.1511544Z else: 2025-07-17T06:33:20.1511737Z prefixes.append(label) 2025-07-17T06:33:20.1511745Z 2025-07-17T06:33:20.1511925Z if len(prefixes) > 1: 2025-07-17T06:33:20.1512090Z log.error( 2025-07-17T06:33:20.1512916Z 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-07-17T06:33:20.1513078Z ) 2025-07-17T06:33:20.1513270Z prefixes = prefixes[:1] 2025-07-17T06:33:20.1513279Z 2025-07-17T06:33:20.1513465Z # Fleet always comes first 2025-07-17T06:33:20.1513636Z if fleet_prefix: 2025-07-17T06:33:20.1513845Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.1513853Z 2025-07-17T06:33:20.1514235Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.1514246Z 2025-07-17T06:33:20.1514252Z 2025-07-17T06:33:20.1514706Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.1514873Z """ 2025-07-17T06:33:20.1515265Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.1515273Z 2025-07-17T06:33:20.1515657Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.1515825Z """ 2025-07-17T06:33:20.1516160Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.1516487Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.1516937Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.1516954Z 2025-07-17T06:33:20.1516966Z 2025-07-17T06:33:20.1517644Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.1517957Z for _ in range(num_retries): 2025-07-17T06:33:20.1518251Z try: 2025-07-17T06:33:20.1518605Z req = Request(url=url, headers=headers) 2025-07-17T06:33:20.1519116Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.1519513Z return json.loads(content) 2025-07-17T06:33:20.1520033Z except Exception as e: 2025-07-17T06:33:20.1520458Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.1520475Z 2025-07-17T06:33:20.1521095Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.1521349Z return {} 2025-07-17T06:33:20.1521357Z 2025-07-17T06:33:20.1521363Z 2025-07-17T06:33:20.1521521Z @cache 2025-07-17T06:33:20.1521953Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.1522120Z """ 2025-07-17T06:33:20.1522317Z Dynamically get PR information 2025-07-17T06:33:20.1522477Z """ 2025-07-17T06:33:20.1522789Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.1523157Z headers = { 2025-07-17T06:33:20.1523389Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.1523604Z "Authorization": f"token {github_token}", 2025-07-17T06:33:20.1523769Z } 2025-07-17T06:33:20.1524158Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.1524530Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.1524846Z headers=headers, 2025-07-17T06:33:20.1525025Z ) 2025-07-17T06:33:20.1525035Z 2025-07-17T06:33:20.1525218Z if not json_response: 2025-07-17T06:33:20.1525513Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.1525683Z return {} 2025-07-17T06:33:20.1525691Z 2025-07-17T06:33:20.1525867Z return json_response 2025-07-17T06:33:20.1525875Z 2025-07-17T06:33:20.1525882Z 2025-07-17T06:33:20.1526280Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.1526472Z """ 2025-07-17T06:33:20.1526796Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.1526955Z """ 2025-07-17T06:33:20.1527238Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.1527408Z return { 2025-07-17T06:33:20.1527764Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.1527922Z } 2025-07-17T06:33:20.1527929Z 2025-07-17T06:33:20.1527935Z 2025-07-17T06:33:20.1528113Z def main() -> None: 2025-07-17T06:33:20.1528290Z args = parse_args() 2025-07-17T06:33:20.1528299Z 2025-07-17T06:33:20.1528518Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.1528525Z 2025-07-17T06:33:20.1528720Z # Check if the PR is opt-out 2025-07-17T06:33:20.1528895Z if args.pr_number: 2025-07-17T06:33:20.1529279Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.1529656Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.1530078Z log.info( 2025-07-17T06:33:20.1530536Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.1530698Z ) 2025-07-17T06:33:20.1531031Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.1531201Z sys.exit() 2025-07-17T06:33:20.1531209Z 2025-07-17T06:33:20.1531370Z try: 2025-07-17T06:33:20.1531608Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.1531910Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.1532071Z ) 2025-07-17T06:33:20.1532078Z 2025-07-17T06:33:20.1532284Z username = get_potential_pr_author( 2025-07-17T06:33:20.1532468Z args.github_token, 2025-07-17T06:33:20.1532648Z args.github_repo, 2025-07-17T06:33:20.1532824Z args.github_actor, 2025-07-17T06:33:20.1533009Z args.github_ref_type, 2025-07-17T06:33:20.1533202Z args.github_branch, 2025-07-17T06:33:20.1533373Z ) 2025-07-17T06:33:20.1533382Z 2025-07-17T06:33:20.1533671Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.1533679Z 2025-07-17T06:33:20.1533896Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.1534076Z rollout_state, 2025-07-17T06:33:20.1534286Z (args.github_issue_owner, username), 2025-07-17T06:33:20.1534469Z args.github_branch, 2025-07-17T06:33:20.1534664Z args.eligible_experiments, 2025-07-17T06:33:20.1534857Z args.opt_out_experiments, 2025-07-17T06:33:20.1535032Z is_canary, 2025-07-17T06:33:20.1535192Z ) 2025-07-17T06:33:20.1535199Z 2025-07-17T06:33:20.1535380Z except Exception as e: 2025-07-17T06:33:20.1535551Z log.error( 2025-07-17T06:33:20.1535983Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.1536291Z ) 2025-07-17T06:33:20.1536299Z 2025-07-17T06:33:20.1536635Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.1536643Z 2025-07-17T06:33:20.1536649Z 2025-07-17T06:33:20.1536829Z if __name__ == "__main__": 2025-07-17T06:33:20.1536993Z main() 2025-07-17T06:33:20.1537000Z 2025-07-17T06:33:20.1642243Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.1642618Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.1671089Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.1671258Z env: 2025-07-17T06:33:20.1671708Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.1671880Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.1672083Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.1672247Z ISSUE_OWNER: 2025-07-17T06:33:20.1672418Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.1672601Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.1672761Z PR_NUMBER: 2025-07-17T06:33:20.1672924Z ##[endgroup] 2025-07-17T06:33:20.5873050Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:20.9642523Z Collecting urllib3==1.26.18 2025-07-17T06:33:20.9998410Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:21.0231448Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.2 MB/s eta 0:00:00 2025-07-17T06:33:21.0442587Z Collecting PyGithub==2.3.0 2025-07-17T06:33:21.0477435Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:21.0891102Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:21.0926849Z 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-07-17T06:33:21.0971948Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:33:21.0990507Z 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-07-17T06:33:21.1006957Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-17T06:33:21.1257407Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:21.1291378Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:21.1519170Z 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-07-17T06:33:21.2581835Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.2621588Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:21.3670114Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:21.3707979Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-07-17T06:33:21.3946758Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.3982234Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:21.4212631Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:21.4272816Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 32.7 MB/s eta 0:00:00 2025-07-17T06:33:21.4307009Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:21.4376508Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 67.8 MB/s eta 0:00:00 2025-07-17T06:33:21.4409474Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-17T06:33:21.4491326Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 132.8 MB/s eta 0:00:00 2025-07-17T06:33:21.4524659Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:21.4580714Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:21.4643888Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 104.5 MB/s eta 0:00:00 2025-07-17T06:33:21.4677132Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-07-17T06:33:21.4716097Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 35.1 MB/s eta 0:00:00 2025-07-17T06:33:21.4748958Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:21.4791299Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 41.1 MB/s eta 0:00:00 2025-07-17T06:33:21.7634804Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:22.2994680Z 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.2 2025-07-17T06:33:22.3783532Z ##[group]Run curr_branch="main" 2025-07-17T06:33:22.3783853Z curr_branch="main" 2025-07-17T06:33:22.3784077Z curr_ref_type="branch" 2025-07-17T06:33:22.3784369Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:22.3784620Z  2025-07-17T06:33:22.3784816Z python3 runner_determinator.py \ 2025-07-17T06:33:22.3785100Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:22.3785375Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:22.3785628Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:22.3785887Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:22.3786168Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:22.3786439Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:22.3786710Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:22.3787031Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:22.3787403Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:22.3787694Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:22.3817363Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:22.3817607Z env: 2025-07-17T06:33:22.3818148Z GITHUB_TOKEN: *** 2025-07-17T06:33:22.3818349Z ISSUE_NUMBER: 5132 2025-07-17T06:33:22.3818551Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:22.3818785Z ISSUE_OWNER: 2025-07-17T06:33:22.3818958Z CHECK_EXPERIMENTS: 2025-07-17T06:33:22.3819151Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:22.3819338Z PR_NUMBER: 2025-07-17T06:33:22.3819502Z ##[endgroup] 2025-07-17T06:33:22.3868377Z Current branch is 'main' 2025-07-17T06:33:23.6880297Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:23.6881057Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:23.6882576Z INFO : Setting output: label-type='' 2025-07-17T06:33:23.7193958Z Evaluate and set job outputs 2025-07-17T06:33:23.7200428Z Cleaning up orphan processes