2025-03-04T19:47:19.5208440Z Current runner version: '2.322.0' 2025-03-04T19:47:19.5232760Z ##[group]Operating System 2025-03-04T19:47:19.5233637Z Ubuntu 2025-03-04T19:47:19.5234158Z 24.04.2 2025-03-04T19:47:19.5234643Z LTS 2025-03-04T19:47:19.5235154Z ##[endgroup] 2025-03-04T19:47:19.5235688Z ##[group]Runner Image 2025-03-04T19:47:19.5236240Z Image: ubuntu-24.04 2025-03-04T19:47:19.5237275Z Version: 20250223.1.0 2025-03-04T19:47:19.5239233Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250223.1/images/ubuntu/Ubuntu2404-Readme.md 2025-03-04T19:47:19.5241725Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250223.1 2025-03-04T19:47:19.5243218Z ##[endgroup] 2025-03-04T19:47:19.5243926Z ##[group]Runner Image Provisioner 2025-03-04T19:47:19.5244656Z 2.0.422.1 2025-03-04T19:47:19.5245217Z ##[endgroup] 2025-03-04T19:47:19.5247470Z ##[group]GITHUB_TOKEN Permissions 2025-03-04T19:47:19.5249939Z Actions: read 2025-03-04T19:47:19.5250785Z Attestations: read 2025-03-04T19:47:19.5251414Z Checks: read 2025-03-04T19:47:19.5251938Z Contents: read 2025-03-04T19:47:19.5252542Z Deployments: read 2025-03-04T19:47:19.5253064Z Discussions: read 2025-03-04T19:47:19.5253774Z Issues: read 2025-03-04T19:47:19.5254325Z Metadata: read 2025-03-04T19:47:19.5254801Z Packages: read 2025-03-04T19:47:19.5255342Z Pages: read 2025-03-04T19:47:19.5255886Z PullRequests: read 2025-03-04T19:47:19.5256431Z RepositoryProjects: read 2025-03-04T19:47:19.5257064Z SecurityEvents: read 2025-03-04T19:47:19.5257565Z Statuses: read 2025-03-04T19:47:19.5258066Z ##[endgroup] 2025-03-04T19:47:19.5261240Z Secret source: Actions 2025-03-04T19:47:19.5262033Z Prepare workflow directory 2025-03-04T19:47:19.5752895Z Prepare all required actions 2025-03-04T19:47:19.5807890Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (92beda54c8707d476ea8bc193ce79a37653d2e49) 2025-03-04T19:47:19.5813231Z ##[group] Inputs 2025-03-04T19:47:19.5813824Z check_experiments: 2025-03-04T19:47:19.5814525Z triggering_actor: pytorch-bot[bot] 2025-03-04T19:47:19.5815193Z issue_owner: 2025-03-04T19:47:19.5815716Z curr_branch: ciflow/inductor/148205 2025-03-04T19:47:19.5816407Z curr_ref_type: tag 2025-03-04T19:47:19.5816892Z issue_number: 5132 2025-03-04T19:47:19.5817422Z ##[endgroup] 2025-03-04T19:47:19.5818127Z Complete job name: unit-test / get-label-type / runner-determinator 2025-03-04T19:47:19.6527629Z ##[group]Run cat < runner_determinator.py 2025-03-04T19:47:19.6530126Z cat < runner_determinator.py 2025-03-04T19:47:19.6530728Z # flake8: noqa: G004 2025-03-04T19:47:19.6531223Z  2025-03-04T19:47:19.6531884Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-04T19:47:19.6532857Z # must be kept in sync. You can do it easily by running the following command: 2025-03-04T19:47:19.6533697Z # python .github/scripts/update_runner_determinator.py 2025-03-04T19:47:19.6534342Z  2025-03-04T19:47:19.6534733Z """ 2025-03-04T19:47:19.6535356Z This runner determinator is used to determine which set of runners to run a 2025-03-04T19:47:19.6536282Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-04T19:47:19.6537303Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-04T19:47:19.6538221Z of which runners should be used to run which job. 2025-03-04T19:47:19.6538942Z  2025-03-04T19:47:19.6539575Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-04T19:47:19.6540522Z separated by a line containing "---". If the line is not present, the 2025-03-04T19:47:19.6541433Z settings are considered to be empty with only the second part, the user 2025-03-04T19:47:19.6542162Z list, defined. 2025-03-04T19:47:19.6542591Z  2025-03-04T19:47:19.6543170Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-04T19:47:19.6544494Z used to define any settings that are needed to determine which runners to use. 2025-03-04T19:47:19.6545381Z It's fields are defined by the RolloutSettings class below. 2025-03-04T19:47:19.6546019Z  2025-03-04T19:47:19.6546634Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-04T19:47:19.6547565Z The user list is also a comma separated list of additional features or 2025-03-04T19:47:19.6548375Z experiments which the user could be opted in to. 2025-03-04T19:47:19.6549095Z  2025-03-04T19:47:19.6549530Z The user list has the following rules: 2025-03-04T19:47:19.6550289Z  2025-03-04T19:47:19.6551224Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-04T19:47:19.6552304Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-04T19:47:19.6553139Z - A "#" prefix opts the user out of all experiments 2025-03-04T19:47:19.6553723Z  2025-03-04T19:47:19.6554104Z Example config: 2025-03-04T19:47:19.6554632Z  # A list of experiments that can be opted into. 2025-03-04T19:47:19.6555496Z  # This defines the behavior they'll induce when opted into. 2025-03-04T19:47:19.6556150Z  # Expected syntax is: 2025-03-04T19:47:19.6556867Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-04T19:47:19.6557873Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-04T19:47:19.6558654Z  2025-03-04T19:47:19.6559278Z  experiments: 2025-03-04T19:47:19.6559724Z  lf: 2025-03-04T19:47:19.6560145Z  rollout_percent: 25 2025-03-04T19:47:19.6560662Z  all_branches: false 2025-03-04T19:47:19.6561169Z  default: true 2025-03-04T19:47:19.6561638Z  --- 2025-03-04T19:47:19.6562025Z  2025-03-04T19:47:19.6562393Z  # Opt-ins: 2025-03-04T19:47:19.6563036Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-04T19:47:19.6564181Z  # and specifying experiments to enable in a comma-separated list. 2025-03-04T19:47:19.6565067Z  # To always opt out of an experiment, prefix it with a "-". 2025-03-04T19:47:19.6565783Z  # Experiments should be from the above list. 2025-03-04T19:47:19.6566501Z  2025-03-04T19:47:19.6566976Z  @User1,-lf,split_build 2025-03-04T19:47:19.6567477Z  @User2,lf 2025-03-04T19:47:19.6567925Z  @User3,split_build 2025-03-04T19:47:19.6568397Z """ 2025-03-04T19:47:19.6569162Z  2025-03-04T19:47:19.6569577Z import json 2025-03-04T19:47:19.6570008Z import logging 2025-03-04T19:47:19.6570459Z import os 2025-03-04T19:47:19.6570875Z import random 2025-03-04T19:47:19.6571314Z import re 2025-03-04T19:47:19.6571732Z import sys 2025-03-04T19:47:19.6572189Z from argparse import ArgumentParser 2025-03-04T19:47:19.6572776Z from collections.abc import Iterable 2025-03-04T19:47:19.6573345Z from functools import cache 2025-03-04T19:47:19.6573864Z from logging import LogRecord 2025-03-04T19:47:19.6574411Z from typing import Any, NamedTuple 2025-03-04T19:47:19.6575007Z from urllib.request import Request, urlopen 2025-03-04T19:47:19.6575567Z  2025-03-04T19:47:19.6575936Z import yaml 2025-03-04T19:47:19.6576386Z from github import Auth, Github 2025-03-04T19:47:19.6576936Z from github.Issue import Issue 2025-03-04T19:47:19.6577441Z  2025-03-04T19:47:19.6577801Z  2025-03-04T19:47:19.6578249Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-04T19:47:19.6579364Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-04T19:47:19.6580285Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-04T19:47:19.6581020Z  2025-03-04T19:47:19.6581492Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-04T19:47:19.6582105Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-04T19:47:19.6582687Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-04T19:47:19.6583301Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-04T19:47:19.6583846Z  2025-03-04T19:47:19.6584266Z SETTING_EXPERIMENTS = "experiments" 2025-03-04T19:47:19.6584793Z  2025-03-04T19:47:19.6585178Z LF_FLEET_EXPERIMENT = "lf" 2025-03-04T19:47:19.6585690Z CANARY_FLEET_SUFFIX = ".c" 2025-03-04T19:47:19.6586181Z  2025-03-04T19:47:19.6586546Z  2025-03-04T19:47:19.6586942Z class Experiment(NamedTuple): 2025-03-04T19:47:19.6587479Z  rollout_perc: float = ( 2025-03-04T19:47:19.6588187Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-04T19:47:19.6588989Z  ) 2025-03-04T19:47:19.6589417Z  all_branches: bool = ( 2025-03-04T19:47:19.6590118Z  False # If True, the experiment is also enabled on the exception branches 2025-03-04T19:47:19.6590818Z  ) 2025-03-04T19:47:19.6591262Z  default: bool = ( 2025-03-04T19:47:19.6592005Z  True # If True, the experiment is enabled by default for all queries 2025-03-04T19:47:19.6593620Z  ) 2025-03-04T19:47:19.6594386Z  2025-03-04T19:47:19.6594794Z  # Add more fields as needed 2025-03-04T19:47:19.6595311Z  2025-03-04T19:47:19.6595673Z  2025-03-04T19:47:19.6596070Z class Settings(NamedTuple): 2025-03-04T19:47:19.6596594Z  """ 2025-03-04T19:47:19.6597114Z  Settings for the experiments that can be opted into. 2025-03-04T19:47:19.6597738Z  """ 2025-03-04T19:47:19.6598124Z  2025-03-04T19:47:19.6598553Z  experiments: dict[str, Experiment] = {} 2025-03-04T19:47:19.6599342Z  2025-03-04T19:47:19.6599901Z  2025-03-04T19:47:19.6600360Z class ColorFormatter(logging.Formatter): 2025-03-04T19:47:19.6601051Z  """Color codes the log messages based on the log level""" 2025-03-04T19:47:19.6601666Z  2025-03-04T19:47:19.6602039Z  COLORS = { 2025-03-04T19:47:19.6602506Z  "WARNING": "\033[33m", # Yellow 2025-03-04T19:47:19.6603053Z  "ERROR": "\033[31m", # Red 2025-03-04T19:47:19.6603599Z  "CRITICAL": "\033[31m", # Red 2025-03-04T19:47:19.6604141Z  "INFO": "\033[0m", # Reset 2025-03-04T19:47:19.6604675Z  "DEBUG": "\033[0m", # Reset 2025-03-04T19:47:19.6605201Z  } 2025-03-04T19:47:19.6605577Z  2025-03-04T19:47:19.6606029Z  def format(self, record: LogRecord) -> str: 2025-03-04T19:47:19.6606819Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-04T19:47:19.6607634Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-04T19:47:19.6608251Z  return super().format(record) 2025-03-04T19:47:19.6609014Z  2025-03-04T19:47:19.6609391Z  2025-03-04T19:47:19.6609805Z handler = logging.StreamHandler() 2025-03-04T19:47:19.6610586Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-04T19:47:19.6611332Z  2025-03-04T19:47:19.6611820Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-04T19:47:19.6612441Z log.addHandler(handler) 2025-03-04T19:47:19.6612949Z log.setLevel(logging.INFO) 2025-03-04T19:47:19.6613591Z  2025-03-04T19:47:19.6613952Z  2025-03-04T19:47:19.6614435Z def set_github_output(key: str, value: str) -> None: 2025-03-04T19:47:19.6615039Z  """ 2025-03-04T19:47:19.6615590Z  Defines outputs of the github action that invokes this script 2025-03-04T19:47:19.6616253Z  """ 2025-03-04T19:47:19.6616669Z  if not GITHUB_OUTPUT: 2025-03-04T19:47:19.6617771Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-04T19:47:19.6619058Z  log.warning( 2025-03-04T19:47:19.6619952Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-04T19:47:19.6620882Z  ) 2025-03-04T19:47:19.6621358Z  print(f"::set-output name={key}::{value}") 2025-03-04T19:47:19.6621937Z  return 2025-03-04T19:47:19.6622356Z  2025-03-04T19:47:19.6622764Z  with open(GITHUB_OUTPUT, "a") as f: 2025-03-04T19:47:19.6623380Z  log.info(f"Setting output: {key}='{value}'") 2025-03-04T19:47:19.6623982Z  f.write(f"{key}={value}\n") 2025-03-04T19:47:19.6624491Z  2025-03-04T19:47:19.6624861Z  2025-03-04T19:47:19.6625395Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-04T19:47:19.6626070Z  return frozenset( 2025-03-04T19:47:19.6626727Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-04T19:47:19.6627429Z  ) 2025-03-04T19:47:19.6627801Z  2025-03-04T19:47:19.6628156Z  2025-03-04T19:47:19.6628527Z def parse_args() -> Any: 2025-03-04T19:47:19.6629332Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-03-04T19:47:19.6630223Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-04T19:47:19.6631018Z  parser.add_argument( 2025-03-04T19:47:19.6631539Z  "--github-issue-repo", 2025-03-04T19:47:19.6632054Z  type=str, 2025-03-04T19:47:19.6632503Z  required=False, 2025-03-04T19:47:19.6633149Z  default="pytorch/test-infra", 2025-03-04T19:47:19.6633745Z  help="GitHub repo to get the issue", 2025-03-04T19:47:19.6634289Z  ) 2025-03-04T19:47:19.6634695Z  parser.add_argument( 2025-03-04T19:47:19.6635219Z  "--github-repo", 2025-03-04T19:47:19.6635706Z  type=str, 2025-03-04T19:47:19.6636167Z  required=True, 2025-03-04T19:47:19.6636690Z  help="GitHub repo where CI is running", 2025-03-04T19:47:19.6637268Z  ) 2025-03-04T19:47:19.6637664Z  parser.add_argument( 2025-03-04T19:47:19.6638342Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-04T19:47:19.6639267Z  ) 2025-03-04T19:47:19.6639672Z  parser.add_argument( 2025-03-04T19:47:19.6640368Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-04T19:47:19.6641068Z  ) 2025-03-04T19:47:19.6641476Z  parser.add_argument( 2025-03-04T19:47:19.6642173Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-04T19:47:19.6642874Z  ) 2025-03-04T19:47:19.6643276Z  parser.add_argument( 2025-03-04T19:47:19.6643994Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-04T19:47:19.6644719Z  ) 2025-03-04T19:47:19.6645124Z  parser.add_argument( 2025-03-04T19:47:19.6645626Z  "--github-ref-type", 2025-03-04T19:47:19.6646118Z  type=str, 2025-03-04T19:47:19.6646720Z  required=True, 2025-03-04T19:47:19.6647277Z  help="Current GitHub ref type, branch or tag", 2025-03-04T19:47:19.6647851Z  ) 2025-03-04T19:47:19.6648254Z  parser.add_argument( 2025-03-04T19:47:19.6648992Z  "--eligible-experiments", 2025-03-04T19:47:19.6649903Z  type=_str_comma_separated_to_set, 2025-03-04T19:47:19.6650626Z  required=False, 2025-03-04T19:47:19.6651117Z  default="", 2025-03-04T19:47:19.6652023Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-04T19:47:19.6653016Z  ) 2025-03-04T19:47:19.6653417Z  parser.add_argument( 2025-03-04T19:47:19.6653913Z  "--pr-number", 2025-03-04T19:47:19.6654389Z  type=str, 2025-03-04T19:47:19.6654840Z  required=False, 2025-03-04T19:47:19.6655325Z  default="", 2025-03-04T19:47:19.6655865Z  help="the optional PR number where this is run", 2025-03-04T19:47:19.6656451Z  ) 2025-03-04T19:47:19.6656831Z  2025-03-04T19:47:19.6657230Z  return parser.parse_args() 2025-03-04T19:47:19.6657738Z  2025-03-04T19:47:19.6658097Z  2025-03-04T19:47:19.6658837Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-04T19:47:19.6659639Z  auth = Auth.Token(github_token) 2025-03-04T19:47:19.6660186Z  return Github(auth=auth) 2025-03-04T19:47:19.6660674Z  2025-03-04T19:47:19.6661021Z  2025-03-04T19:47:19.6661690Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-04T19:47:19.6662517Z  repo = gh.get_repo(repo) 2025-03-04T19:47:19.6663079Z  return repo.get_issue(number=issue_num) 2025-03-04T19:47:19.6663633Z  2025-03-04T19:47:19.6663987Z  2025-03-04T19:47:19.6664369Z def get_potential_pr_author( 2025-03-04T19:47:19.6665068Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-04T19:47:19.6665766Z ) -> str: 2025-03-04T19:47:19.6666493Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-04T19:47:19.6667348Z  # Fetch the actual username from the original PR. The PR number is 2025-03-04T19:47:19.6668126Z  # embedded in the tag name: ciflow// 2025-03-04T19:47:19.6668847Z  2025-03-04T19:47:19.6669264Z  gh = get_gh_client(github_token) 2025-03-04T19:47:19.6669788Z  2025-03-04T19:47:19.6670277Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-04T19:47:19.6670928Z  split_tag = ref_name.split("/") 2025-03-04T19:47:19.6671459Z  if ( 2025-03-04T19:47:19.6671892Z  len(split_tag) == 3 2025-03-04T19:47:19.6672430Z  and split_tag[0] == "ciflow" 2025-03-04T19:47:19.6672999Z  and split_tag[2].isnumeric() 2025-03-04T19:47:19.6673549Z  ): 2025-03-04T19:47:19.6674005Z  pr_number = split_tag[2] 2025-03-04T19:47:19.6674524Z  try: 2025-03-04T19:47:19.6675013Z  repository = gh.get_repo(repo) 2025-03-04T19:47:19.6675704Z  pull = repository.get_pull(number=int(pr_number)) 2025-03-04T19:47:19.6676337Z  except Exception as e: 2025-03-04T19:47:19.6676900Z  raise Exception( # noqa: TRY002 2025-03-04T19:47:19.6677597Z  f"issue with pull request {pr_number} from repo {repository}" 2025-03-04T19:47:19.6678251Z  ) from e 2025-03-04T19:47:19.6679073Z  return pull.user.login # type: ignore[no-any-return] 2025-03-04T19:47:19.6679815Z  # In all other cases, return the original input username 2025-03-04T19:47:19.6680427Z  return username 2025-03-04T19:47:19.6680858Z  2025-03-04T19:47:19.6681207Z  2025-03-04T19:47:19.6681645Z def is_exception_branch(branch: str) -> bool: 2025-03-04T19:47:19.6682197Z  """ 2025-03-04T19:47:19.6682874Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-04T19:47:19.6683650Z  """ 2025-03-04T19:47:19.6684220Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-04T19:47:19.6684902Z  2025-03-04T19:47:19.6685264Z  2025-03-04T19:47:19.6685676Z def load_yaml(yaml_text: str) -> Any: 2025-03-04T19:47:19.6686208Z  try: 2025-03-04T19:47:19.6686624Z  data = yaml.safe_load(yaml_text) 2025-03-04T19:47:19.6687165Z  return data 2025-03-04T19:47:19.6687638Z  except yaml.YAMLError: 2025-03-04T19:47:19.6688177Z  log.exception("Error loading YAML") 2025-03-04T19:47:19.6688808Z  raise 2025-03-04T19:47:19.6689221Z  2025-03-04T19:47:19.6689570Z  2025-03-04T19:47:19.6690192Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-04T19:47:19.6690944Z  """ 2025-03-04T19:47:19.6691592Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-04T19:47:19.6692343Z  2025-03-04T19:47:19.6692886Z  If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:19.6693669Z  and the text below is the list of opted in users. 2025-03-04T19:47:19.6694238Z  2025-03-04T19:47:19.6694817Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-04T19:47:19.6695530Z  """ 2025-03-04T19:47:19.6696005Z  rollout_state_parts = rollout_state.split("---") 2025-03-04T19:47:19.6696627Z  if len(rollout_state_parts) >= 2: 2025-03-04T19:47:19.6697420Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-03-04T19:47:19.6698082Z  else: 2025-03-04T19:47:19.6698503Z  return "", rollout_state 2025-03-04T19:47:19.6699094Z  2025-03-04T19:47:19.6699439Z  2025-03-04T19:47:19.6699858Z class UserOptins(dict[str, list[str]]): 2025-03-04T19:47:19.6700399Z  """ 2025-03-04T19:47:19.6700949Z  Dictionary of users with a list of features they have opted into 2025-03-04T19:47:19.6701610Z  """ 2025-03-04T19:47:19.6701983Z  2025-03-04T19:47:19.6702329Z  2025-03-04T19:47:19.6702875Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-04T19:47:19.6703552Z  """ 2025-03-04T19:47:19.6704286Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-04T19:47:19.6705115Z  2025-03-04T19:47:19.6705926Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-04T19:47:19.6706929Z  - Example line: "@User1,lf,split_build" 2025-03-04T19:47:19.6707636Z  - A "#" prefix indicates the user is opted out of all experiments 2025-03-04T19:47:19.6708283Z  2025-03-04T19:47:19.6708960Z  2025-03-04T19:47:19.6709509Z  """ 2025-03-04T19:47:19.6710004Z  optins = UserOptins() 2025-03-04T19:47:19.6710565Z  for user in user_optin_text.split("\n"): 2025-03-04T19:47:19.6711161Z  user = user.strip("\r\n\t -") 2025-03-04T19:47:19.6711952Z  if not user or not user.startswith("@"): 2025-03-04T19:47:19.6712543Z  # Not a valid user. Skip 2025-03-04T19:47:19.6713062Z  continue 2025-03-04T19:47:19.6713503Z  2025-03-04T19:47:19.6713865Z  if user: 2025-03-04T19:47:19.6714365Z  usr_name = user.split(",")[0].strip("@") 2025-03-04T19:47:19.6715076Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-04T19:47:19.6715724Z  2025-03-04T19:47:19.6716090Z  return optins 2025-03-04T19:47:19.6716522Z  2025-03-04T19:47:19.6716871Z  2025-03-04T19:47:19.6717385Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-04T19:47:19.6718010Z  """ 2025-03-04T19:47:19.6718450Z  Check if the experiment name is valid. 2025-03-04T19:47:19.6719117Z  A valid name: 2025-03-04T19:47:19.6719811Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-04T19:47:19.6720760Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-04T19:47:19.6721479Z  - Cannot contain spaces 2025-03-04T19:47:19.6721972Z  """ 2025-03-04T19:47:19.6722353Z  2025-03-04T19:47:19.6722833Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-04T19:47:19.6723562Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-04T19:47:19.6724170Z  2025-03-04T19:47:19.6724520Z  if valid: 2025-03-04T19:47:19.6724938Z  return True 2025-03-04T19:47:19.6725372Z  2025-03-04T19:47:19.6725731Z  log.error( 2025-03-04T19:47:19.6727152Z  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-03-04T19:47:19.6728670Z  ) 2025-03-04T19:47:19.6729143Z  return False 2025-03-04T19:47:19.6729571Z  2025-03-04T19:47:19.6729917Z  2025-03-04T19:47:19.6730577Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-04T19:47:19.6731238Z  """ 2025-03-04T19:47:19.6731852Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-04T19:47:19.6732570Z  """ 2025-03-04T19:47:19.6732947Z  try: 2025-03-04T19:47:19.6733345Z  if settings_text: 2025-03-04T19:47:19.6734110Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-04T19:47:19.6734912Z  # for easy reading 2025-03-04T19:47:19.6735730Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-04T19:47:19.6736633Z  # the backtick character in shell commands. 2025-03-04T19:47:19.6737297Z  backtick = chr(96) # backtick character 2025-03-04T19:47:19.6737991Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-04T19:47:19.6738677Z  settings = load_yaml(settings_text) 2025-03-04T19:47:19.6739303Z  2025-03-04T19:47:19.6739899Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-03-04T19:47:19.6740653Z  experiments = {} 2025-03-04T19:47:19.6741132Z  2025-03-04T19:47:19.6741704Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-04T19:47:19.6742487Z  if not is_valid_experiment_name(exp_name): 2025-03-04T19:47:19.6743582Z  # 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-03-04T19:47:19.6744736Z  continue 2025-03-04T19:47:19.6745208Z  2025-03-04T19:47:19.6745597Z  valid_settings = {} 2025-03-04T19:47:19.6746165Z  for setting in exp_settings: 2025-03-04T19:47:19.6746763Z  if setting not in Experiment._fields: 2025-03-04T19:47:19.6747340Z  log.warning( 2025-03-04T19:47:19.6748062Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-04T19:47:19.6748870Z  ) 2025-03-04T19:47:19.6749341Z  else: 2025-03-04T19:47:19.6749899Z  valid_settings[setting] = exp_settings[setting] 2025-03-04T19:47:19.6750481Z  2025-03-04T19:47:19.6750973Z  experiments[exp_name] = Experiment(**valid_settings) 2025-03-04T19:47:19.6751628Z  return Settings(experiments) 2025-03-04T19:47:19.6752426Z  2025-03-04T19:47:19.6752993Z  except Exception: 2025-03-04T19:47:19.6753553Z  log.exception("Failed to parse settings") 2025-03-04T19:47:19.6754169Z  2025-03-04T19:47:19.6754537Z  return Settings() 2025-03-04T19:47:19.6754993Z  2025-03-04T19:47:19.6755346Z  2025-03-04T19:47:19.6755812Z def parse_settings(rollout_state: str) -> Settings: 2025-03-04T19:47:19.6756401Z  """ 2025-03-04T19:47:19.6756867Z  Parse settings, if any, from the rollout state. 2025-03-04T19:47:19.6757436Z  2025-03-04T19:47:19.6757992Z  If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:19.6758924Z  and the text below is the list of opted in users. 2025-03-04T19:47:19.6759554Z  2025-03-04T19:47:19.6760153Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-04T19:47:19.6760897Z  """ 2025-03-04T19:47:19.6761490Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:19.6762440Z  return parse_settings_from_text(settings_text) 2025-03-04T19:47:19.6763017Z  2025-03-04T19:47:19.6763368Z  2025-03-04T19:47:19.6763829Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-04T19:47:19.6764415Z  """ 2025-03-04T19:47:19.6764839Z  Parse users from the rollout state. 2025-03-04T19:47:19.6765357Z  2025-03-04T19:47:19.6765712Z  """ 2025-03-04T19:47:19.6766275Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:19.6767094Z  return parse_user_opt_in_from_text(users_text) 2025-03-04T19:47:19.6767664Z  2025-03-04T19:47:19.6768018Z  2025-03-04T19:47:19.6768645Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:19.6769521Z  """ 2025-03-04T19:47:19.6769981Z  Check if a user is opted into an experiment 2025-03-04T19:47:19.6770545Z  """ 2025-03-04T19:47:19.6771048Z  return experiment_name in user_optins.get(user, []) 2025-03-04T19:47:19.6771641Z  2025-03-04T19:47:19.6771994Z  2025-03-04T19:47:19.6772663Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:19.6773416Z  """ 2025-03-04T19:47:19.6773907Z  Check if a user explicitly opted out of an experiment 2025-03-04T19:47:19.6774501Z  """ 2025-03-04T19:47:19.6775040Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-04T19:47:19.6775875Z  experiment_optout = "-" + experiment_name 2025-03-04T19:47:19.6776562Z  if experiment_optout not in user_optins.get(user, []): 2025-03-04T19:47:19.6777180Z  return False 2025-03-04T19:47:19.6777618Z  2025-03-04T19:47:19.6778101Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-03-04T19:47:19.6778888Z  log.warning( 2025-03-04T19:47:19.6779746Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-04T19:47:19.6780615Z  ) 2025-03-04T19:47:19.6781000Z  2025-03-04T19:47:19.6781367Z  return True 2025-03-04T19:47:19.6781789Z  2025-03-04T19:47:19.6782133Z  2025-03-04T19:47:19.6782500Z def get_runner_prefix( 2025-03-04T19:47:19.6782977Z  rollout_state: str, 2025-03-04T19:47:19.6783496Z  workflow_requestors: Iterable[str], 2025-03-04T19:47:19.6784037Z  branch: str, 2025-03-04T19:47:19.6784584Z  eligible_experiments: frozenset[str] = frozenset(), 2025-03-04T19:47:19.6785202Z  is_canary: bool = False, 2025-03-04T19:47:19.6785690Z ) -> str: 2025-03-04T19:47:19.6786159Z  settings = parse_settings(rollout_state) 2025-03-04T19:47:19.6786767Z  user_optins = parse_users(rollout_state) 2025-03-04T19:47:19.6787297Z  2025-03-04T19:47:19.6787658Z  fleet_prefix = "" 2025-03-04T19:47:19.6788119Z  prefixes = [] 2025-03-04T19:47:19.6788895Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-04T19:47:19.6789859Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-04T19:47:19.6790590Z  log.info( 2025-03-04T19:47:19.6791309Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-04T19:47:19.6792099Z  ) 2025-03-04T19:47:19.6792518Z  continue 2025-03-04T19:47:19.6792953Z  2025-03-04T19:47:19.6793340Z  if eligible_experiments: 2025-03-04T19:47:19.6794079Z  if experiment_name not in eligible_experiments: 2025-03-04T19:47:19.6794755Z  exp_list = ", ".join(eligible_experiments) 2025-03-04T19:47:19.6795333Z  log.info( 2025-03-04T19:47:19.6796147Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-04T19:47:19.6796976Z  ) 2025-03-04T19:47:19.6797419Z  continue 2025-03-04T19:47:19.6797942Z  elif not experiment_settings.default: 2025-03-04T19:47:19.6798487Z  log.info( 2025-03-04T19:47:19.6799291Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-04T19:47:19.6800034Z  ) 2025-03-04T19:47:19.6800451Z  continue 2025-03-04T19:47:19.6800885Z  2025-03-04T19:47:19.6801371Z  # Is any workflow_requestor opted out to this experiment? 2025-03-04T19:47:19.6802007Z  opted_out_users = [ 2025-03-04T19:47:19.6802505Z  requestor 2025-03-04T19:47:19.6803005Z  for requestor in workflow_requestors 2025-03-04T19:47:19.6803743Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-04T19:47:19.6804421Z  ] 2025-03-04T19:47:19.6804810Z  2025-03-04T19:47:19.6805181Z  if opted_out_users: 2025-03-04T19:47:19.6805669Z  log.info( 2025-03-04T19:47:19.6806333Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-04T19:47:19.6807168Z  ) 2025-03-04T19:47:19.6807587Z  continue 2025-03-04T19:47:19.6808022Z  2025-03-04T19:47:19.6808506Z  # Is any workflow_requestor opted in to this experiment? 2025-03-04T19:47:19.6809224Z  opted_in_users = [ 2025-03-04T19:47:19.6809727Z  requestor 2025-03-04T19:47:19.6810239Z  for requestor in workflow_requestors 2025-03-04T19:47:19.6810924Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-04T19:47:19.6811552Z  ] 2025-03-04T19:47:19.6811937Z  2025-03-04T19:47:19.6812311Z  enabled = False 2025-03-04T19:47:19.6812800Z  if opted_in_users: 2025-03-04T19:47:19.6813282Z  log.info( 2025-03-04T19:47:19.6813921Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-04T19:47:19.6814611Z  ) 2025-03-04T19:47:19.6815025Z  enabled = True 2025-03-04T19:47:19.6815494Z  2025-03-04T19:47:19.6815915Z  elif experiment_settings.rollout_perc: 2025-03-04T19:47:19.6816762Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-04T19:47:19.6817709Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-04T19:47:19.6818371Z  log.info( 2025-03-04T19:47:19.6819354Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-04T19:47:19.6820279Z  ) 2025-03-04T19:47:19.6820733Z  enabled = True 2025-03-04T19:47:19.6821216Z  2025-03-04T19:47:19.6821588Z  if enabled: 2025-03-04T19:47:19.6822056Z  label = experiment_name 2025-03-04T19:47:19.6822641Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-04T19:47:19.6823481Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-04T19:47:19.6824504Z  # - If it's enabled, then we always list it's prefix first 2025-03-04T19:47:19.6825294Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-04T19:47:19.6826111Z  if is_canary: 2025-03-04T19:47:19.6826650Z  label += CANARY_FLEET_SUFFIX 2025-03-04T19:47:19.6827204Z  fleet_prefix = label 2025-03-04T19:47:19.6827720Z  else: 2025-03-04T19:47:19.6828192Z  prefixes.append(label) 2025-03-04T19:47:19.6828815Z  2025-03-04T19:47:19.6829208Z  if len(prefixes) > 1: 2025-03-04T19:47:19.6829690Z  log.error( 2025-03-04T19:47:19.6830745Z  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-03-04T19:47:19.6831833Z  ) 2025-03-04T19:47:19.6832252Z  prefixes = prefixes[:1] 2025-03-04T19:47:19.6832762Z  2025-03-04T19:47:19.6833146Z  # Fleet always comes first 2025-03-04T19:47:19.6833651Z  if fleet_prefix: 2025-03-04T19:47:19.6834144Z  prefixes.insert(0, fleet_prefix) 2025-03-04T19:47:19.6834934Z  2025-03-04T19:47:19.6835538Z  return ".".join(prefixes) + "." if prefixes else "" 2025-03-04T19:47:19.6836122Z  2025-03-04T19:47:19.6836522Z  2025-03-04T19:47:19.6837196Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-04T19:47:19.6837969Z  """ 2025-03-04T19:47:19.6838882Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-03-04T19:47:19.6839652Z  2025-03-04T19:47:19.6840232Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-04T19:47:19.6840944Z  """ 2025-03-04T19:47:19.6841375Z  gh = get_gh_client(github_token) 2025-03-04T19:47:19.6841945Z  issue = get_issue(gh, repo, issue_num) 2025-03-04T19:47:19.6842611Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-04T19:47:19.6843212Z  2025-03-04T19:47:19.6843560Z  2025-03-04T19:47:19.6844166Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-04T19:47:19.6844936Z  for _ in range(num_retries): 2025-03-04T19:47:19.6845435Z  try: 2025-03-04T19:47:19.6845904Z  req = Request(url=url, headers=headers) 2025-03-04T19:47:19.6846583Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-04T19:47:19.6847240Z  return json.loads(content) 2025-03-04T19:47:19.6847787Z  except Exception as e: 2025-03-04T19:47:19.6848538Z  log.warning(f"Could not download {url}: {e}") 2025-03-04T19:47:19.6849452Z  2025-03-04T19:47:19.6850053Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-04T19:47:19.6851101Z  return {} 2025-03-04T19:47:19.6851591Z  2025-03-04T19:47:19.6852036Z  2025-03-04T19:47:19.6852392Z @cache 2025-03-04T19:47:19.6853049Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-04T19:47:19.6854152Z  """ 2025-03-04T19:47:19.6854802Z  Dynamically get PR information 2025-03-04T19:47:19.6855314Z  """ 2025-03-04T19:47:19.6855840Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-04T19:47:19.6856487Z  headers = { 2025-03-04T19:47:19.6856996Z  "Accept": "application/vnd.github.v3+json", 2025-03-04T19:47:19.6857629Z  "Authorization": f"token {github_token}", 2025-03-04T19:47:19.6858173Z  } 2025-03-04T19:47:19.6858935Z  json_response: dict[str, Any] = download_json( 2025-03-04T19:47:19.6859612Z  url=f"{github_api}/issues/{pr_number}", 2025-03-04T19:47:19.6860177Z  headers=headers, 2025-03-04T19:47:19.6860648Z  ) 2025-03-04T19:47:19.6861019Z  2025-03-04T19:47:19.6861385Z  if not json_response: 2025-03-04T19:47:19.6862014Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-04T19:47:19.6862649Z  return {} 2025-03-04T19:47:19.6863084Z  2025-03-04T19:47:19.6863465Z  return json_response 2025-03-04T19:47:19.6863925Z  2025-03-04T19:47:19.6864274Z  2025-03-04T19:47:19.6864879Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-04T19:47:19.6865605Z  """ 2025-03-04T19:47:19.6866167Z  Dynamically get the latest list of labels from the pull request 2025-03-04T19:47:19.6866834Z  """ 2025-03-04T19:47:19.6867378Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-04T19:47:19.6868000Z  return { 2025-03-04T19:47:19.6868610Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-04T19:47:19.6869422Z  } 2025-03-04T19:47:19.6869790Z  2025-03-04T19:47:19.6870300Z  2025-03-04T19:47:19.6870673Z def main() -> None: 2025-03-04T19:47:19.6871315Z  args = parse_args() 2025-03-04T19:47:19.6871784Z  2025-03-04T19:47:19.6872224Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-04T19:47:19.6872935Z  2025-03-04T19:47:19.6873328Z  # Check if the PR is opt-out 2025-03-04T19:47:19.6873856Z  if args.pr_number: 2025-03-04T19:47:19.6874635Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-04T19:47:19.6875406Z  if OPT_OUT_LABEL in labels: 2025-03-04T19:47:19.6875923Z  log.info( 2025-03-04T19:47:19.6876651Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-04T19:47:19.6877410Z  ) 2025-03-04T19:47:19.6878004Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:19.6878685Z  sys.exit() 2025-03-04T19:47:19.6879269Z  2025-03-04T19:47:19.6879614Z  try: 2025-03-04T19:47:19.6880081Z  rollout_state = get_rollout_state_from_issue( 2025-03-04T19:47:19.6880822Z  args.github_token, args.github_issue_repo, args.github_issue 2025-03-04T19:47:19.6881465Z  ) 2025-03-04T19:47:19.6881851Z  2025-03-04T19:47:19.6882253Z  username = get_potential_pr_author( 2025-03-04T19:47:19.6882810Z  args.github_token, 2025-03-04T19:47:19.6883326Z  args.github_repo, 2025-03-04T19:47:19.6883839Z  args.github_actor, 2025-03-04T19:47:19.6884357Z  args.github_ref_type, 2025-03-04T19:47:19.6884874Z  args.github_branch, 2025-03-04T19:47:19.6885357Z  ) 2025-03-04T19:47:19.6885738Z  2025-03-04T19:47:19.6886233Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-04T19:47:19.6886849Z  2025-03-04T19:47:19.6887269Z  runner_label_prefix = get_runner_prefix( 2025-03-04T19:47:19.6887824Z  rollout_state, 2025-03-04T19:47:19.6888360Z  (args.github_issue_owner, username), 2025-03-04T19:47:19.6889123Z  args.github_branch, 2025-03-04T19:47:19.6889670Z  args.eligible_experiments, 2025-03-04T19:47:19.6890198Z  is_canary, 2025-03-04T19:47:19.6890770Z  ) 2025-03-04T19:47:19.6891164Z  2025-03-04T19:47:19.6891543Z  except Exception as e: 2025-03-04T19:47:19.6892031Z  log.error( 2025-03-04T19:47:19.6892739Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-04T19:47:19.6893496Z  ) 2025-03-04T19:47:19.6893874Z  2025-03-04T19:47:19.6894406Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:19.6895062Z  2025-03-04T19:47:19.6895411Z  2025-03-04T19:47:19.6895783Z if __name__ == "__main__": 2025-03-04T19:47:19.6957392Z  main() 2025-03-04T19:47:19.6958213Z  2025-03-04T19:47:19.6959046Z EOF 2025-03-04T19:47:19.6959735Z  2025-03-04T19:47:19.6960456Z cat runner_determinator.py 2025-03-04T19:47:19.7281073Z shell: /usr/bin/bash -e {0} 2025-03-04T19:47:19.7281886Z env: 2025-03-04T19:47:19.7282574Z GITHUB_TOKEN: *** 2025-03-04T19:47:19.7283016Z ISSUE_NUMBER: 5132 2025-03-04T19:47:19.7283473Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-03-04T19:47:19.7283999Z ISSUE_OWNER: 2025-03-04T19:47:19.7284412Z CHECK_EXPERIMENTS: 2025-03-04T19:47:19.7284854Z PR_NUMBER: 2025-03-04T19:47:19.7285254Z ##[endgroup] 2025-03-04T19:47:19.7513344Z # flake8: noqa: G004 2025-03-04T19:47:19.7513665Z 2025-03-04T19:47:19.7514085Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-04T19:47:19.7515008Z # must be kept in sync. You can do it easily by running the following command: 2025-03-04T19:47:19.7515790Z # python .github/scripts/update_runner_determinator.py 2025-03-04T19:47:19.7516435Z 2025-03-04T19:47:19.7516593Z """ 2025-03-04T19:47:19.7517150Z This runner determinator is used to determine which set of runners to run a 2025-03-04T19:47:19.7517978Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-04T19:47:19.7519100Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-04T19:47:19.7519896Z of which runners should be used to run which job. 2025-03-04T19:47:19.7520276Z 2025-03-04T19:47:19.7520646Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-04T19:47:19.7521488Z separated by a line containing "---". If the line is not present, the 2025-03-04T19:47:19.7522312Z settings are considered to be empty with only the second part, the user 2025-03-04T19:47:19.7522962Z list, defined. 2025-03-04T19:47:19.7523183Z 2025-03-04T19:47:19.7523522Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-04T19:47:19.7524392Z used to define any settings that are needed to determine which runners to use. 2025-03-04T19:47:19.7525179Z It's fields are defined by the RolloutSettings class below. 2025-03-04T19:47:19.7525599Z 2025-03-04T19:47:19.7526052Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-04T19:47:19.7527000Z The user list is also a comma separated list of additional features or 2025-03-04T19:47:19.7527706Z experiments which the user could be opted in to. 2025-03-04T19:47:19.7528103Z 2025-03-04T19:47:19.7528296Z The user list has the following rules: 2025-03-04T19:47:19.7528637Z 2025-03-04T19:47:19.7529497Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-04T19:47:19.7530326Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-04T19:47:19.7531058Z - A "#" prefix opts the user out of all experiments 2025-03-04T19:47:19.7531435Z 2025-03-04T19:47:19.7531607Z Example config: 2025-03-04T19:47:19.7532052Z # A list of experiments that can be opted into. 2025-03-04T19:47:19.7532700Z # This defines the behavior they'll induce when opted into. 2025-03-04T19:47:19.7533298Z # Expected syntax is: 2025-03-04T19:47:19.7533909Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-04T19:47:19.7535003Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-04T19:47:19.7535601Z 2025-03-04T19:47:19.7535764Z experiments: 2025-03-04T19:47:19.7536137Z lf: 2025-03-04T19:47:19.7536498Z rollout_percent: 25 2025-03-04T19:47:19.7536937Z all_branches: false 2025-03-04T19:47:19.7537361Z default: true 2025-03-04T19:47:19.7537745Z --- 2025-03-04T19:47:19.7537941Z 2025-03-04T19:47:19.7538094Z # Opt-ins: 2025-03-04T19:47:19.7538645Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-04T19:47:19.7539677Z # and specifying experiments to enable in a comma-separated list. 2025-03-04T19:47:19.7540421Z # To always opt out of an experiment, prefix it with a "-". 2025-03-04T19:47:19.7541052Z # Experiments should be from the above list. 2025-03-04T19:47:19.7541422Z 2025-03-04T19:47:19.7541595Z @User1,-lf,split_build 2025-03-04T19:47:19.7542019Z @User2,lf 2025-03-04T19:47:19.7542390Z @User3,split_build 2025-03-04T19:47:19.7542779Z """ 2025-03-04T19:47:19.7542958Z 2025-03-04T19:47:19.7543115Z import json 2025-03-04T19:47:19.7543470Z import logging 2025-03-04T19:47:19.7543832Z import os 2025-03-04T19:47:19.7544178Z import random 2025-03-04T19:47:19.7544535Z import re 2025-03-04T19:47:19.7544874Z import sys 2025-03-04T19:47:19.7545262Z from argparse import ArgumentParser 2025-03-04T19:47:19.7545760Z from collections.abc import Iterable 2025-03-04T19:47:19.7546326Z from functools import cache 2025-03-04T19:47:19.7546784Z from logging import LogRecord 2025-03-04T19:47:19.7547252Z from typing import Any, NamedTuple 2025-03-04T19:47:19.7547929Z from urllib.request import Request, urlopen 2025-03-04T19:47:19.7548288Z 2025-03-04T19:47:19.7548444Z import yaml 2025-03-04T19:47:19.7549128Z from github import Auth, Github 2025-03-04T19:47:19.7549616Z from github.Issue import Issue 2025-03-04T19:47:19.7549906Z 2025-03-04T19:47:19.7549912Z 2025-03-04T19:47:19.7550124Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-04T19:47:19.7550788Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-04T19:47:19.7551617Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-04T19:47:19.7552145Z 2025-03-04T19:47:19.7552360Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-04T19:47:19.7552907Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-04T19:47:19.7553390Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-04T19:47:19.7553913Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-04T19:47:19.7554255Z 2025-03-04T19:47:19.7554441Z SETTING_EXPERIMENTS = "experiments" 2025-03-04T19:47:19.7554764Z 2025-03-04T19:47:19.7554944Z LF_FLEET_EXPERIMENT = "lf" 2025-03-04T19:47:19.7555389Z CANARY_FLEET_SUFFIX = ".c" 2025-03-04T19:47:19.7555660Z 2025-03-04T19:47:19.7555666Z 2025-03-04T19:47:19.7555855Z class Experiment(NamedTuple): 2025-03-04T19:47:19.7556323Z rollout_perc: float = ( 2025-03-04T19:47:19.7556932Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-04T19:47:19.7557579Z ) 2025-03-04T19:47:19.7557933Z all_branches: bool = ( 2025-03-04T19:47:19.7558528Z False # If True, the experiment is also enabled on the exception branches 2025-03-04T19:47:19.7559374Z ) 2025-03-04T19:47:19.7559714Z default: bool = ( 2025-03-04T19:47:19.7560254Z True # If True, the experiment is enabled by default for all queries 2025-03-04T19:47:19.7561020Z ) 2025-03-04T19:47:19.7561213Z 2025-03-04T19:47:19.7561391Z # Add more fields as needed 2025-03-04T19:47:19.7561679Z 2025-03-04T19:47:19.7561685Z 2025-03-04T19:47:19.7561864Z class Settings(NamedTuple): 2025-03-04T19:47:19.7562285Z """ 2025-03-04T19:47:19.7562712Z Settings for the experiments that can be opted into. 2025-03-04T19:47:19.7563252Z """ 2025-03-04T19:47:19.7563440Z 2025-03-04T19:47:19.7563644Z experiments: dict[str, Experiment] = {} 2025-03-04T19:47:19.7563984Z 2025-03-04T19:47:19.7563991Z 2025-03-04T19:47:19.7564337Z class ColorFormatter(logging.Formatter): 2025-03-04T19:47:19.7565086Z """Color codes the log messages based on the log level""" 2025-03-04T19:47:19.7565509Z 2025-03-04T19:47:19.7565667Z COLORS = { 2025-03-04T19:47:19.7566048Z "WARNING": "\033[33m", # Yellow 2025-03-04T19:47:19.7566539Z "ERROR": "\033[31m", # Red 2025-03-04T19:47:19.7567130Z "CRITICAL": "\033[31m", # Red 2025-03-04T19:47:19.7567606Z "INFO": "\033[0m", # Reset 2025-03-04T19:47:19.7568064Z "DEBUG": "\033[0m", # Reset 2025-03-04T19:47:19.7568512Z } 2025-03-04T19:47:19.7568862Z 2025-03-04T19:47:19.7569089Z def format(self, record: LogRecord) -> str: 2025-03-04T19:47:19.7569825Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-04T19:47:19.7570557Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-04T19:47:19.7571101Z return super().format(record) 2025-03-04T19:47:19.7571428Z 2025-03-04T19:47:19.7571434Z 2025-03-04T19:47:19.7571627Z handler = logging.StreamHandler() 2025-03-04T19:47:19.7572303Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-04T19:47:19.7572829Z 2025-03-04T19:47:19.7573061Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-04T19:47:19.7573621Z log.addHandler(handler) 2025-03-04T19:47:19.7574052Z log.setLevel(logging.INFO) 2025-03-04T19:47:19.7574325Z 2025-03-04T19:47:19.7574331Z 2025-03-04T19:47:19.7574568Z def set_github_output(key: str, value: str) -> None: 2025-03-04T19:47:19.7575106Z """ 2025-03-04T19:47:19.7575586Z Defines outputs of the github action that invokes this script 2025-03-04T19:47:19.7576330Z """ 2025-03-04T19:47:19.7576680Z if not GITHUB_OUTPUT: 2025-03-04T19:47:19.7577685Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-04T19:47:19.7578979Z log.warning( 2025-03-04T19:47:19.7579810Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-04T19:47:19.7580692Z ) 2025-03-04T19:47:19.7590882Z print(f"::set-output name={key}::{value}") 2025-03-04T19:47:19.7591468Z return 2025-03-04T19:47:19.7591687Z 2025-03-04T19:47:19.7591883Z with open(GITHUB_OUTPUT, "a") as f: 2025-03-04T19:47:19.7592451Z log.info(f"Setting output: {key}='{value}'") 2025-03-04T19:47:19.7592999Z f.write(f"{key}={value}\n") 2025-03-04T19:47:19.7593313Z 2025-03-04T19:47:19.7593319Z 2025-03-04T19:47:19.7593617Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-04T19:47:19.7594245Z return frozenset( 2025-03-04T19:47:19.7594832Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-04T19:47:19.7595514Z ) 2025-03-04T19:47:19.7595714Z 2025-03-04T19:47:19.7595720Z 2025-03-04T19:47:19.7595894Z def parse_args() -> Any: 2025-03-04T19:47:19.7596426Z parser = ArgumentParser("Get dynamic rollout settings") 2025-03-04T19:47:19.7597709Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-04T19:47:19.7598515Z parser.add_argument( 2025-03-04T19:47:19.7599125Z "--github-issue-repo", 2025-03-04T19:47:19.7599567Z type=str, 2025-03-04T19:47:19.7599954Z required=False, 2025-03-04T19:47:19.7600386Z default="pytorch/test-infra", 2025-03-04T19:47:19.7600911Z help="GitHub repo to get the issue", 2025-03-04T19:47:19.7601399Z ) 2025-03-04T19:47:19.7601755Z parser.add_argument( 2025-03-04T19:47:19.7602180Z "--github-repo", 2025-03-04T19:47:19.7602592Z type=str, 2025-03-04T19:47:19.7602968Z required=True, 2025-03-04T19:47:19.7603397Z help="GitHub repo where CI is running", 2025-03-04T19:47:19.7603893Z ) 2025-03-04T19:47:19.7604240Z parser.add_argument( 2025-03-04T19:47:19.7604818Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-04T19:47:19.7605630Z ) 2025-03-04T19:47:19.7605988Z parser.add_argument( 2025-03-04T19:47:19.7606579Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-04T19:47:19.7607261Z ) 2025-03-04T19:47:19.7607610Z parser.add_argument( 2025-03-04T19:47:19.7608214Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-04T19:47:19.7608984Z ) 2025-03-04T19:47:19.7609343Z parser.add_argument( 2025-03-04T19:47:19.7609989Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-04T19:47:19.7610678Z ) 2025-03-04T19:47:19.7611033Z parser.add_argument( 2025-03-04T19:47:19.7611453Z "--github-ref-type", 2025-03-04T19:47:19.7611882Z type=str, 2025-03-04T19:47:19.7612264Z required=True, 2025-03-04T19:47:19.7612723Z help="Current GitHub ref type, branch or tag", 2025-03-04T19:47:19.7613246Z ) 2025-03-04T19:47:19.7613591Z parser.add_argument( 2025-03-04T19:47:19.7614032Z "--eligible-experiments", 2025-03-04T19:47:19.7614521Z type=_str_comma_separated_to_set, 2025-03-04T19:47:19.7615021Z required=False, 2025-03-04T19:47:19.7615419Z default="", 2025-03-04T19:47:19.7616208Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-04T19:47:19.7617071Z ) 2025-03-04T19:47:19.7617425Z parser.add_argument( 2025-03-04T19:47:19.7617842Z "--pr-number", 2025-03-04T19:47:19.7618237Z type=str, 2025-03-04T19:47:19.7618609Z required=False, 2025-03-04T19:47:19.7619278Z default="", 2025-03-04T19:47:19.7619723Z help="the optional PR number where this is run", 2025-03-04T19:47:19.7620254Z ) 2025-03-04T19:47:19.7620440Z 2025-03-04T19:47:19.7620624Z return parser.parse_args() 2025-03-04T19:47:19.7620916Z 2025-03-04T19:47:19.7620923Z 2025-03-04T19:47:19.7621315Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-04T19:47:19.7622030Z auth = Auth.Token(github_token) 2025-03-04T19:47:19.7622515Z return Github(auth=auth) 2025-03-04T19:47:19.7622796Z 2025-03-04T19:47:19.7622808Z 2025-03-04T19:47:19.7623237Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-04T19:47:19.7623994Z repo = gh.get_repo(repo) 2025-03-04T19:47:19.7624466Z return repo.get_issue(number=issue_num) 2025-03-04T19:47:19.7624814Z 2025-03-04T19:47:19.7624820Z 2025-03-04T19:47:19.7624998Z def get_potential_pr_author( 2025-03-04T19:47:19.7625614Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-04T19:47:19.7626259Z ) -> str: 2025-03-04T19:47:19.7626743Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-04T19:47:19.7627502Z # Fetch the actual username from the original PR. The PR number is 2025-03-04T19:47:19.7628238Z # embedded in the tag name: ciflow// 2025-03-04T19:47:19.7628639Z 2025-03-04T19:47:19.7628928Z gh = get_gh_client(github_token) 2025-03-04T19:47:19.7629255Z 2025-03-04T19:47:19.7629508Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-04T19:47:19.7630104Z split_tag = ref_name.split("/") 2025-03-04T19:47:19.7630581Z if ( 2025-03-04T19:47:19.7630944Z len(split_tag) == 3 2025-03-04T19:47:19.7631395Z and split_tag[0] == "ciflow" 2025-03-04T19:47:19.7631888Z and split_tag[2].isnumeric() 2025-03-04T19:47:19.7632360Z ): 2025-03-04T19:47:19.7632724Z pr_number = split_tag[2] 2025-03-04T19:47:19.7633189Z try: 2025-03-04T19:47:19.7633586Z repository = gh.get_repo(repo) 2025-03-04T19:47:19.7634170Z pull = repository.get_pull(number=int(pr_number)) 2025-03-04T19:47:19.7634743Z except Exception as e: 2025-03-04T19:47:19.7635229Z raise Exception( # noqa: TRY002 2025-03-04T19:47:19.7635994Z f"issue with pull request {pr_number} from repo {repository}" 2025-03-04T19:47:19.7636613Z ) from e 2025-03-04T19:47:19.7637117Z return pull.user.login # type: ignore[no-any-return] 2025-03-04T19:47:19.7637772Z # In all other cases, return the original input username 2025-03-04T19:47:19.7638366Z return username 2025-03-04T19:47:19.7638601Z 2025-03-04T19:47:19.7638607Z 2025-03-04T19:47:19.7638945Z def is_exception_branch(branch: str) -> bool: 2025-03-04T19:47:19.7639463Z """ 2025-03-04T19:47:19.7640064Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-04T19:47:19.7640794Z """ 2025-03-04T19:47:19.7641312Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-04T19:47:19.7641803Z 2025-03-04T19:47:19.7641809Z 2025-03-04T19:47:19.7642003Z def load_yaml(yaml_text: str) -> Any: 2025-03-04T19:47:19.7642471Z try: 2025-03-04T19:47:19.7642840Z data = yaml.safe_load(yaml_text) 2025-03-04T19:47:19.7643324Z return data 2025-03-04T19:47:19.7643719Z except yaml.YAMLError: 2025-03-04T19:47:19.7644179Z log.exception("Error loading YAML") 2025-03-04T19:47:19.7644666Z raise 2025-03-04T19:47:19.7644867Z 2025-03-04T19:47:19.7644873Z 2025-03-04T19:47:19.7645258Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-04T19:47:19.7645953Z """ 2025-03-04T19:47:19.7646535Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-04T19:47:19.7647100Z 2025-03-04T19:47:19.7647431Z If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:19.7648278Z and the text below is the list of opted in users. 2025-03-04T19:47:19.7648657Z 2025-03-04T19:47:19.7649136Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-04T19:47:19.7649798Z """ 2025-03-04T19:47:19.7650229Z rollout_state_parts = rollout_state.split("---") 2025-03-04T19:47:19.7650800Z if len(rollout_state_parts) >= 2: 2025-03-04T19:47:19.7651370Z return rollout_state_parts[0], rollout_state_parts[1] 2025-03-04T19:47:19.7651928Z else: 2025-03-04T19:47:19.7652276Z return "", rollout_state 2025-03-04T19:47:19.7652572Z 2025-03-04T19:47:19.7652578Z 2025-03-04T19:47:19.7652767Z class UserOptins(dict[str, list[str]]): 2025-03-04T19:47:19.7653251Z """ 2025-03-04T19:47:19.7653742Z Dictionary of users with a list of features they have opted into 2025-03-04T19:47:19.7654353Z """ 2025-03-04T19:47:19.7654537Z 2025-03-04T19:47:19.7654548Z 2025-03-04T19:47:19.7654872Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-04T19:47:19.7655484Z """ 2025-03-04T19:47:19.7656149Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-04T19:47:19.7656790Z 2025-03-04T19:47:19.7657375Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-04T19:47:19.7658305Z - Example line: "@User1,lf,split_build" 2025-03-04T19:47:19.7659091Z - A "#" prefix indicates the user is opted out of all experiments 2025-03-04T19:47:19.7659568Z 2025-03-04T19:47:19.7659573Z 2025-03-04T19:47:19.7659735Z """ 2025-03-04T19:47:19.7660273Z optins = UserOptins() 2025-03-04T19:47:19.7660752Z for user in user_optin_text.split("\n"): 2025-03-04T19:47:19.7661278Z user = user.strip("\r\n\t -") 2025-03-04T19:47:19.7661800Z if not user or not user.startswith("@"): 2025-03-04T19:47:19.7662337Z # Not a valid user. Skip 2025-03-04T19:47:19.7662793Z continue 2025-03-04T19:47:19.7663031Z 2025-03-04T19:47:19.7663182Z if user: 2025-03-04T19:47:19.7663598Z usr_name = user.split(",")[0].strip("@") 2025-03-04T19:47:19.7664429Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-04T19:47:19.7664924Z 2025-03-04T19:47:19.7665088Z return optins 2025-03-04T19:47:19.7665312Z 2025-03-04T19:47:19.7665319Z 2025-03-04T19:47:19.7665596Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-04T19:47:19.7666160Z """ 2025-03-04T19:47:19.7666534Z Check if the experiment name is valid. 2025-03-04T19:47:19.7667082Z A valid name: 2025-03-04T19:47:19.7667693Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-04T19:47:19.7668585Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-04T19:47:19.7669495Z - Cannot contain spaces 2025-03-04T19:47:19.7669946Z """ 2025-03-04T19:47:19.7670135Z 2025-03-04T19:47:19.7670380Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-04T19:47:19.7671039Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-04T19:47:19.7671522Z 2025-03-04T19:47:19.7671680Z if valid: 2025-03-04T19:47:19.7672048Z return True 2025-03-04T19:47:19.7672272Z 2025-03-04T19:47:19.7672424Z log.error( 2025-03-04T19:47:19.7673790Z 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-03-04T19:47:19.7675243Z ) 2025-03-04T19:47:19.7675580Z return False 2025-03-04T19:47:19.7675799Z 2025-03-04T19:47:19.7675806Z 2025-03-04T19:47:19.7676099Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-04T19:47:19.7676685Z """ 2025-03-04T19:47:19.7677384Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-04T19:47:19.7678067Z """ 2025-03-04T19:47:19.7678400Z try: 2025-03-04T19:47:19.7678967Z if settings_text: 2025-03-04T19:47:19.7679663Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-04T19:47:19.7680412Z # for easy reading 2025-03-04T19:47:19.7681157Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-04T19:47:19.7681990Z # the backtick character in shell commands. 2025-03-04T19:47:19.7682561Z backtick = chr(96) # backtick character 2025-03-04T19:47:19.7683187Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-04T19:47:19.7683808Z settings = load_yaml(settings_text) 2025-03-04T19:47:19.7684160Z 2025-03-04T19:47:19.7684538Z # For now we just load experiments. We can expand this if/when we add more settings 2025-03-04T19:47:19.7685251Z experiments = {} 2025-03-04T19:47:19.7685533Z 2025-03-04T19:47:19.7685867Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-04T19:47:19.7686580Z if not is_valid_experiment_name(exp_name): 2025-03-04T19:47:19.7687625Z # 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-03-04T19:47:19.7688609Z continue 2025-03-04T19:47:19.7689020Z 2025-03-04T19:47:19.7689193Z valid_settings = {} 2025-03-04T19:47:19.7689686Z for setting in exp_settings: 2025-03-04T19:47:19.7690221Z if setting not in Experiment._fields: 2025-03-04T19:47:19.7690745Z log.warning( 2025-03-04T19:47:19.7691412Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-04T19:47:19.7692097Z ) 2025-03-04T19:47:19.7692496Z else: 2025-03-04T19:47:19.7692977Z valid_settings[setting] = exp_settings[setting] 2025-03-04T19:47:19.7693386Z 2025-03-04T19:47:19.7693643Z experiments[exp_name] = Experiment(**valid_settings) 2025-03-04T19:47:19.7694422Z return Settings(experiments) 2025-03-04T19:47:19.7694764Z 2025-03-04T19:47:19.7694936Z except Exception: 2025-03-04T19:47:19.7695388Z log.exception("Failed to parse settings") 2025-03-04T19:47:19.7695753Z 2025-03-04T19:47:19.7695913Z return Settings() 2025-03-04T19:47:19.7696152Z 2025-03-04T19:47:19.7696157Z 2025-03-04T19:47:19.7696391Z def parse_settings(rollout_state: str) -> Settings: 2025-03-04T19:47:19.7696924Z """ 2025-03-04T19:47:19.7697332Z Parse settings, if any, from the rollout state. 2025-03-04T19:47:19.7697707Z 2025-03-04T19:47:19.7698037Z If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:19.7698870Z and the text below is the list of opted in users. 2025-03-04T19:47:19.7699264Z 2025-03-04T19:47:19.7699687Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-04T19:47:19.7700374Z """ 2025-03-04T19:47:19.7700911Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:19.7701619Z return parse_settings_from_text(settings_text) 2025-03-04T19:47:19.7701994Z 2025-03-04T19:47:19.7702001Z 2025-03-04T19:47:19.7702237Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-04T19:47:19.7702762Z """ 2025-03-04T19:47:19.7703132Z Parse users from the rollout state. 2025-03-04T19:47:19.7703469Z 2025-03-04T19:47:19.7703614Z """ 2025-03-04T19:47:19.7704108Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:19.7704797Z return parse_user_opt_in_from_text(users_text) 2025-03-04T19:47:19.7705173Z 2025-03-04T19:47:19.7705424Z 2025-03-04T19:47:19.7705829Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:19.7706525Z """ 2025-03-04T19:47:19.7706955Z Check if a user is opted into an experiment 2025-03-04T19:47:19.7707462Z """ 2025-03-04T19:47:19.7707887Z return experiment_name in user_optins.get(user, []) 2025-03-04T19:47:19.7708283Z 2025-03-04T19:47:19.7708290Z 2025-03-04T19:47:19.7708681Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:19.7709558Z """ 2025-03-04T19:47:19.7709996Z Check if a user explicitly opted out of an experiment 2025-03-04T19:47:19.7710539Z """ 2025-03-04T19:47:19.7711007Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-04T19:47:19.7711648Z experiment_optout = "-" + experiment_name 2025-03-04T19:47:19.7712242Z if experiment_optout not in user_optins.get(user, []): 2025-03-04T19:47:19.7712802Z return False 2025-03-04T19:47:19.7713049Z 2025-03-04T19:47:19.7713302Z if is_user_opted_in(user, user_optins, experiment_name): 2025-03-04T19:47:19.7713863Z log.warning( 2025-03-04T19:47:19.7714614Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-04T19:47:19.7715433Z ) 2025-03-04T19:47:19.7715631Z 2025-03-04T19:47:19.7715786Z return True 2025-03-04T19:47:19.7716012Z 2025-03-04T19:47:19.7716019Z 2025-03-04T19:47:19.7716184Z def get_runner_prefix( 2025-03-04T19:47:19.7716591Z rollout_state: str, 2025-03-04T19:47:19.7717021Z workflow_requestors: Iterable[str], 2025-03-04T19:47:19.7717507Z branch: str, 2025-03-04T19:47:19.7717953Z eligible_experiments: frozenset[str] = frozenset(), 2025-03-04T19:47:19.7718520Z is_canary: bool = False, 2025-03-04T19:47:19.7719093Z ) -> str: 2025-03-04T19:47:19.7719485Z settings = parse_settings(rollout_state) 2025-03-04T19:47:19.7720032Z user_optins = parse_users(rollout_state) 2025-03-04T19:47:19.7720386Z 2025-03-04T19:47:19.7720548Z fleet_prefix = "" 2025-03-04T19:47:19.7720950Z prefixes = [] 2025-03-04T19:47:19.7721535Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-04T19:47:19.7722415Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-04T19:47:19.7723233Z log.info( 2025-03-04T19:47:19.7723873Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-04T19:47:19.7724569Z ) 2025-03-04T19:47:19.7724925Z continue 2025-03-04T19:47:19.7725162Z 2025-03-04T19:47:19.7725339Z if eligible_experiments: 2025-03-04T19:47:19.7725860Z if experiment_name not in eligible_experiments: 2025-03-04T19:47:19.7726453Z exp_list = ", ".join(eligible_experiments) 2025-03-04T19:47:19.7726969Z log.info( 2025-03-04T19:47:19.7727701Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-04T19:47:19.7728489Z ) 2025-03-04T19:47:19.7729002Z continue 2025-03-04T19:47:19.7729451Z elif not experiment_settings.default: 2025-03-04T19:47:19.7729946Z log.info( 2025-03-04T19:47:19.7730571Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-04T19:47:19.7731260Z ) 2025-03-04T19:47:19.7731620Z continue 2025-03-04T19:47:19.7731850Z 2025-03-04T19:47:19.7732110Z # Is any workflow_requestor opted out to this experiment? 2025-03-04T19:47:19.7732686Z opted_out_users = [ 2025-03-04T19:47:19.7733113Z requestor 2025-03-04T19:47:19.7733536Z for requestor in workflow_requestors 2025-03-04T19:47:19.7734166Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-04T19:47:19.7734760Z ] 2025-03-04T19:47:19.7734953Z 2025-03-04T19:47:19.7735277Z if opted_out_users: 2025-03-04T19:47:19.7735703Z log.info( 2025-03-04T19:47:19.7736286Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-04T19:47:19.7736937Z ) 2025-03-04T19:47:19.7737290Z continue 2025-03-04T19:47:19.7737519Z 2025-03-04T19:47:19.7737781Z # Is any workflow_requestor opted in to this experiment? 2025-03-04T19:47:19.7738356Z opted_in_users = [ 2025-03-04T19:47:19.7738880Z requestor 2025-03-04T19:47:19.7739314Z for requestor in workflow_requestors 2025-03-04T19:47:19.7739935Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-04T19:47:19.7740517Z ] 2025-03-04T19:47:19.7740707Z 2025-03-04T19:47:19.7740867Z enabled = False 2025-03-04T19:47:19.7741278Z if opted_in_users: 2025-03-04T19:47:19.7741695Z log.info( 2025-03-04T19:47:19.7742256Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-04T19:47:19.7742903Z ) 2025-03-04T19:47:19.7743259Z enabled = True 2025-03-04T19:47:19.7743521Z 2025-03-04T19:47:19.7743724Z elif experiment_settings.rollout_perc: 2025-03-04T19:47:19.7744501Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-04T19:47:19.7745371Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-04T19:47:19.7745976Z log.info( 2025-03-04T19:47:19.7746789Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-04T19:47:19.7747641Z ) 2025-03-04T19:47:19.7748022Z enabled = True 2025-03-04T19:47:19.7748309Z 2025-03-04T19:47:19.7748464Z if enabled: 2025-03-04T19:47:19.7748957Z label = experiment_name 2025-03-04T19:47:19.7749476Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-04T19:47:19.7750250Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-04T19:47:19.7751063Z # - If it's enabled, then we always list it's prefix first 2025-03-04T19:47:19.7751894Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-04T19:47:19.7752527Z if is_canary: 2025-03-04T19:47:19.7752994Z label += CANARY_FLEET_SUFFIX 2025-03-04T19:47:19.7753510Z fleet_prefix = label 2025-03-04T19:47:19.7753966Z else: 2025-03-04T19:47:19.7754369Z prefixes.append(label) 2025-03-04T19:47:19.7754697Z 2025-03-04T19:47:19.7754869Z if len(prefixes) > 1: 2025-03-04T19:47:19.7755287Z log.error( 2025-03-04T19:47:19.7756240Z 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-03-04T19:47:19.7757280Z ) 2025-03-04T19:47:19.7757640Z prefixes = prefixes[:1] 2025-03-04T19:47:19.7757937Z 2025-03-04T19:47:19.7758115Z # Fleet always comes first 2025-03-04T19:47:19.7758558Z if fleet_prefix: 2025-03-04T19:47:19.7759081Z prefixes.insert(0, fleet_prefix) 2025-03-04T19:47:19.7759418Z 2025-03-04T19:47:19.7759652Z return ".".join(prefixes) + "." if prefixes else "" 2025-03-04T19:47:19.7760045Z 2025-03-04T19:47:19.7760051Z 2025-03-04T19:47:19.7760463Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-04T19:47:19.7761182Z """ 2025-03-04T19:47:19.7761729Z Gets the first comment of the issue, which contains the desired rollout state. 2025-03-04T19:47:19.7762249Z 2025-03-04T19:47:19.7762614Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-04T19:47:19.7763264Z """ 2025-03-04T19:47:19.7763620Z gh = get_gh_client(github_token) 2025-03-04T19:47:19.7764272Z issue = get_issue(gh, repo, issue_num) 2025-03-04T19:47:19.7764864Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-04T19:47:19.7765284Z 2025-03-04T19:47:19.7765290Z 2025-03-04T19:47:19.7765666Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-04T19:47:19.7766370Z for _ in range(num_retries): 2025-03-04T19:47:19.7766818Z try: 2025-03-04T19:47:19.7767208Z req = Request(url=url, headers=headers) 2025-03-04T19:47:19.7767827Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-04T19:47:19.7768426Z return json.loads(content) 2025-03-04T19:47:19.7769014Z except Exception as e: 2025-03-04T19:47:19.7769521Z log.warning(f"Could not download {url}: {e}") 2025-03-04T19:47:19.7769896Z 2025-03-04T19:47:19.7770249Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-04T19:47:19.7770910Z return {} 2025-03-04T19:47:19.7771116Z 2025-03-04T19:47:19.7771128Z 2025-03-04T19:47:19.7771276Z @cache 2025-03-04T19:47:19.7771859Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-04T19:47:19.7772559Z """ 2025-03-04T19:47:19.7772926Z Dynamically get PR information 2025-03-04T19:47:19.7773378Z """ 2025-03-04T19:47:19.7773834Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-04T19:47:19.7774416Z headers = { 2025-03-04T19:47:19.7774839Z "Accept": "application/vnd.github.v3+json", 2025-03-04T19:47:19.7775407Z "Authorization": f"token {github_token}", 2025-03-04T19:47:19.7775898Z } 2025-03-04T19:47:19.7776300Z json_response: dict[str, Any] = download_json( 2025-03-04T19:47:19.7776860Z url=f"{github_api}/issues/{pr_number}", 2025-03-04T19:47:19.7777373Z headers=headers, 2025-03-04T19:47:19.7777770Z ) 2025-03-04T19:47:19.7777952Z 2025-03-04T19:47:19.7778119Z if not json_response: 2025-03-04T19:47:19.7778650Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-04T19:47:19.7779335Z return {} 2025-03-04T19:47:19.7779556Z 2025-03-04T19:47:19.7779730Z return json_response 2025-03-04T19:47:19.7779991Z 2025-03-04T19:47:19.7779996Z 2025-03-04T19:47:19.7780378Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-04T19:47:19.7781170Z """ 2025-03-04T19:47:19.7781669Z Dynamically get the latest list of labels from the pull request 2025-03-04T19:47:19.7782276Z """ 2025-03-04T19:47:19.7782728Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-04T19:47:19.7783294Z return { 2025-03-04T19:47:19.7783821Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-04T19:47:19.7784466Z } 2025-03-04T19:47:19.7784653Z 2025-03-04T19:47:19.7784659Z 2025-03-04T19:47:19.7784819Z def main() -> None: 2025-03-04T19:47:19.7785211Z args = parse_args() 2025-03-04T19:47:19.7785461Z 2025-03-04T19:47:19.7785677Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-04T19:47:19.7786032Z 2025-03-04T19:47:19.7786216Z # Check if the PR is opt-out 2025-03-04T19:47:19.7786662Z if args.pr_number: 2025-03-04T19:47:19.7787270Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-04T19:47:19.7787968Z if OPT_OUT_LABEL in labels: 2025-03-04T19:47:19.7788422Z log.info( 2025-03-04T19:47:19.7789158Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-04T19:47:19.7789866Z ) 2025-03-04T19:47:19.7790370Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:19.7791004Z sys.exit() 2025-03-04T19:47:19.7791248Z 2025-03-04T19:47:19.7791397Z try: 2025-03-04T19:47:19.7791799Z rollout_state = get_rollout_state_from_issue( 2025-03-04T19:47:19.7792461Z args.github_token, args.github_issue_repo, args.github_issue 2025-03-04T19:47:19.7793205Z ) 2025-03-04T19:47:19.7793403Z 2025-03-04T19:47:19.7793590Z username = get_potential_pr_author( 2025-03-04T19:47:19.7794103Z args.github_token, 2025-03-04T19:47:19.7794551Z args.github_repo, 2025-03-04T19:47:19.7795004Z args.github_actor, 2025-03-04T19:47:19.7795449Z args.github_ref_type, 2025-03-04T19:47:19.7795913Z args.github_branch, 2025-03-04T19:47:19.7796344Z ) 2025-03-04T19:47:19.7796532Z 2025-03-04T19:47:19.7796800Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-04T19:47:19.7797218Z 2025-03-04T19:47:19.7797420Z runner_label_prefix = get_runner_prefix( 2025-03-04T19:47:19.7797939Z rollout_state, 2025-03-04T19:47:19.7798393Z (args.github_issue_owner, username), 2025-03-04T19:47:19.7799007Z args.github_branch, 2025-03-04T19:47:19.7799467Z args.eligible_experiments, 2025-03-04T19:47:19.7799942Z is_canary, 2025-03-04T19:47:19.7800325Z ) 2025-03-04T19:47:19.7800521Z 2025-03-04T19:47:19.7800695Z except Exception as e: 2025-03-04T19:47:19.7801123Z log.error( 2025-03-04T19:47:19.7801738Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-04T19:47:19.7802444Z ) 2025-03-04T19:47:19.7802630Z 2025-03-04T19:47:19.7802944Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:19.7803413Z 2025-03-04T19:47:19.7803419Z 2025-03-04T19:47:19.7803585Z if __name__ == "__main__": 2025-03-04T19:47:19.7804005Z main() 2025-03-04T19:47:19.7804203Z 2025-03-04T19:47:19.7891836Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-04T19:47:19.7892683Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-04T19:47:19.7938023Z shell: /usr/bin/bash -e {0} 2025-03-04T19:47:19.7938473Z env: 2025-03-04T19:47:19.7939225Z GITHUB_TOKEN: *** 2025-03-04T19:47:19.7939621Z ISSUE_NUMBER: 5132 2025-03-04T19:47:19.7940053Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-03-04T19:47:19.7940534Z ISSUE_OWNER: 2025-03-04T19:47:19.7940903Z CHECK_EXPERIMENTS: 2025-03-04T19:47:19.7941294Z PR_NUMBER: 2025-03-04T19:47:19.7941653Z ##[endgroup] 2025-03-04T19:47:20.1646346Z Defaulting to user installation because normal site-packages is not writeable 2025-03-04T19:47:20.5657553Z Collecting urllib3==1.26.18 2025-03-04T19:47:20.6237010Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-03-04T19:47:20.6491419Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.7 MB/s eta 0:00:00 2025-03-04T19:47:20.6754388Z Collecting PyGithub==2.3.0 2025-03-04T19:47:20.6828119Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-03-04T19:47:20.7305645Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-03-04T19:47:20.7392732Z 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-03-04T19:47:20.7442245Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-03-04T19:47:20.7459591Z 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-03-04T19:47:20.7474280Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-03-04T19:47:20.7761456Z Collecting Deprecated (from PyGithub==2.3.0) 2025-03-04T19:47:20.7840416Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-03-04T19:47:20.8075322Z 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-03-04T19:47:20.9235539Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-04T19:47:20.9310281Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-03-04T19:47:21.0409048Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-03-04T19:47:21.0487840Z 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-03-04T19:47:21.0708227Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-04T19:47:21.0776621Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-03-04T19:47:21.1050111Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-03-04T19:47:21.1149669Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 16.5 MB/s eta 0:00:00 2025-03-04T19:47:21.1251725Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-03-04T19:47:21.1348899Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 42.7 MB/s eta 0:00:00 2025-03-04T19:47:21.1420636Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-03-04T19:47:21.1538172Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 83.7 MB/s eta 0:00:00 2025-03-04T19:47:21.1613916Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-03-04T19:47:21.1714436Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-03-04T19:47:21.1780989Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 93.8 MB/s eta 0:00:00 2025-03-04T19:47:21.1855185Z 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-03-04T19:47:21.1901958Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 25.0 MB/s eta 0:00:00 2025-03-04T19:47:21.1973355Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-03-04T19:47:21.2021005Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 36.2 MB/s eta 0:00:00 2025-03-04T19:47:21.4933250Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-03-04T19:47:22.0472040Z 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-03-04T19:47:22.1250379Z ##[group]Run curr_branch="ciflow/inductor/148205" 2025-03-04T19:47:22.1250842Z curr_branch="ciflow/inductor/148205" 2025-03-04T19:47:22.1251165Z curr_ref_type="tag" 2025-03-04T19:47:22.1251465Z echo "Current branch is '$curr_branch'" 2025-03-04T19:47:22.1251766Z  2025-03-04T19:47:22.1252013Z python3 runner_determinator.py \ 2025-03-04T19:47:22.1252354Z  --github-token "$GITHUB_TOKEN" \ 2025-03-04T19:47:22.1252673Z  --github-issue "$ISSUE_NUMBER" \ 2025-03-04T19:47:22.1252987Z  --github-branch "$curr_branch" \ 2025-03-04T19:47:22.1253306Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-03-04T19:47:22.1253646Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-03-04T19:47:22.1253984Z  --github-ref-type "$curr_ref_type" \ 2025-03-04T19:47:22.1254316Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-03-04T19:47:22.1254731Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-03-04T19:47:22.1255131Z  --pr-number "${PR_NUMBER}" 2025-03-04T19:47:22.1302430Z shell: /usr/bin/bash -e {0} 2025-03-04T19:47:22.1302712Z env: 2025-03-04T19:47:22.1303359Z GITHUB_TOKEN: *** 2025-03-04T19:47:22.1303613Z ISSUE_NUMBER: 5132 2025-03-04T19:47:22.1303883Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-03-04T19:47:22.1304184Z ISSUE_OWNER: 2025-03-04T19:47:22.1304420Z CHECK_EXPERIMENTS: 2025-03-04T19:47:22.1304675Z PR_NUMBER: 2025-03-04T19:47:22.1304897Z ##[endgroup] 2025-03-04T19:47:22.1369424Z Current branch is 'ciflow/inductor/148205' 2025-03-04T19:47:24.2613954Z INFO : Skipping experiment 'awsa100', as it is not a default experiment 2025-03-04T19:47:24.2614917Z INFO : Setting output: label-type='' 2025-03-04T19:47:24.2922680Z Evaluate and set job outputs 2025-03-04T19:47:24.2930444Z Cleaning up orphan processes