2025-04-25T04:18:11.2513596Z Current runner version: '2.323.0' 2025-04-25T04:18:11.2536731Z ##[group]Operating System 2025-04-25T04:18:11.2537439Z Ubuntu 2025-04-25T04:18:11.2537922Z 24.04.2 2025-04-25T04:18:11.2538486Z LTS 2025-04-25T04:18:11.2538963Z ##[endgroup] 2025-04-25T04:18:11.2539473Z ##[group]Runner Image 2025-04-25T04:18:11.2540046Z Image: ubuntu-24.04 2025-04-25T04:18:11.2540595Z Version: 20250420.1.0 2025-04-25T04:18:11.2541577Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250420.1/images/ubuntu/Ubuntu2404-Readme.md 2025-04-25T04:18:11.2543194Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250420.1 2025-04-25T04:18:11.2544135Z ##[endgroup] 2025-04-25T04:18:11.2544608Z ##[group]Runner Image Provisioner 2025-04-25T04:18:11.2545498Z 2.0.422.1 2025-04-25T04:18:11.2545962Z ##[endgroup] 2025-04-25T04:18:11.2546920Z ##[group]GITHUB_TOKEN Permissions 2025-04-25T04:18:11.2549146Z Contents: read 2025-04-25T04:18:11.2549661Z Metadata: read 2025-04-25T04:18:11.2550375Z ##[endgroup] 2025-04-25T04:18:11.2553097Z Secret source: Actions 2025-04-25T04:18:11.2554092Z Prepare workflow directory 2025-04-25T04:18:11.3062066Z Prepare all required actions 2025-04-25T04:18:11.3116136Z Complete job name: before-test / get-label-type / runner-determinator 2025-04-25T04:18:11.8390545Z ##[group]Run cat < runner_determinator.py 2025-04-25T04:18:11.8393277Z cat < runner_determinator.py 2025-04-25T04:18:11.8394054Z # flake8: noqa: G004 2025-04-25T04:18:11.8394620Z  2025-04-25T04:18:11.8395442Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-04-25T04:18:11.8396595Z # must be kept in sync. You can do it easily by running the following command: 2025-04-25T04:18:11.8397595Z # python .github/scripts/update_runner_determinator.py 2025-04-25T04:18:11.8398352Z  2025-04-25T04:18:11.8398768Z """ 2025-04-25T04:18:11.8399585Z This runner determinator is used to determine which set of runners to run a 2025-04-25T04:18:11.8400685Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-04-25T04:18:11.8401907Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-04-25T04:18:11.8403071Z of which runners should be used to run which job. 2025-04-25T04:18:11.8403785Z  2025-04-25T04:18:11.8404593Z The configuration has two parts, the settings and a list of opted-in users, 2025-04-25T04:18:11.8405653Z separated by a line containing "---". If the line is not present, the 2025-04-25T04:18:11.8406728Z settings are considered to be empty with only the second part, the user 2025-04-25T04:18:11.8407650Z list, defined. 2025-04-25T04:18:11.8408154Z  2025-04-25T04:18:11.8408881Z The first part is a YAML block that defines the rollout settings. This can be 2025-04-25T04:18:11.8409987Z used to define any settings that are needed to determine which runners to use. 2025-04-25T04:18:11.8411046Z It's fields are defined by the RolloutSettings class below. 2025-04-25T04:18:11.8411774Z  2025-04-25T04:18:11.8412663Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-04-25T04:18:11.8413804Z The user list is also a comma separated list of additional features or 2025-04-25T04:18:11.8414701Z experiments which the user could be opted in to. 2025-04-25T04:18:11.8415432Z  2025-04-25T04:18:11.8415947Z The user list has the following rules: 2025-04-25T04:18:11.8416599Z  2025-04-25T04:18:11.8417304Z - Users are GitHub usernames, which must start with the @ prefix 2025-04-25T04:18:11.8418365Z - Each user is also a comma-separated list of features/experiments to enable 2025-04-25T04:18:11.8419309Z - A "#" prefix opts the user out of all experiments 2025-04-25T04:18:11.8420204Z  2025-04-25T04:18:11.8420873Z Example config: 2025-04-25T04:18:11.8421534Z  # A list of experiments that can be opted into. 2025-04-25T04:18:11.8422619Z  # This defines the behavior they'll induce when opted into. 2025-04-25T04:18:11.8423599Z  # Expected syntax is: 2025-04-25T04:18:11.8424421Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-04-25T04:18:11.8425561Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-04-25T04:18:11.8426544Z  2025-04-25T04:18:11.8426986Z  experiments: 2025-04-25T04:18:11.8427549Z  lf: 2025-04-25T04:18:11.8428108Z  rollout_percent: 25 2025-04-25T04:18:11.8428721Z  all_branches: false 2025-04-25T04:18:11.8429290Z  default: true 2025-04-25T04:18:11.8429905Z  --- 2025-04-25T04:18:11.8430405Z  2025-04-25T04:18:11.8430876Z  # Opt-ins: 2025-04-25T04:18:11.8431691Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-04-25T04:18:11.8433073Z  # and specifying experiments to enable in a comma-separated list. 2025-04-25T04:18:11.8434078Z  # To always opt out of an experiment, prefix it with a "-". 2025-04-25T04:18:11.8434937Z  # Experiments should be from the above list. 2025-04-25T04:18:11.8435635Z  2025-04-25T04:18:11.8436150Z  @User1,-lf,split_build 2025-04-25T04:18:11.8436748Z  @User2,lf 2025-04-25T04:18:11.8437322Z  @User3,split_build 2025-04-25T04:18:11.8437853Z """ 2025-04-25T04:18:11.8438352Z  2025-04-25T04:18:11.8438798Z import json 2025-04-25T04:18:11.8439357Z import logging 2025-04-25T04:18:11.8439924Z import os 2025-04-25T04:18:11.8440423Z import random 2025-04-25T04:18:11.8440965Z import re 2025-04-25T04:18:11.8441437Z import sys 2025-04-25T04:18:11.8442104Z from argparse import ArgumentParser 2025-04-25T04:18:11.8443027Z from collections.abc import Iterable 2025-04-25T04:18:11.8443710Z from functools import cache 2025-04-25T04:18:11.8444402Z from logging import LogRecord 2025-04-25T04:18:11.8445080Z from typing import Any, NamedTuple 2025-04-25T04:18:11.8445781Z from urllib.request import Request, urlopen 2025-04-25T04:18:11.8520051Z  2025-04-25T04:18:11.8520841Z import yaml 2025-04-25T04:18:11.8521725Z from github import Auth, Github 2025-04-25T04:18:11.8523275Z from github.Issue import Issue 2025-04-25T04:18:11.8524353Z  2025-04-25T04:18:11.8525016Z  2025-04-25T04:18:11.8525526Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-04-25T04:18:11.8526314Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-04-25T04:18:11.8527305Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-04-25T04:18:11.8528078Z  2025-04-25T04:18:11.8528560Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-04-25T04:18:11.8529214Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-04-25T04:18:11.8529815Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-04-25T04:18:11.8530464Z OPT_OUT_LABEL = "no-runner-experiments" 2025-04-25T04:18:11.8531029Z  2025-04-25T04:18:11.8531467Z SETTING_EXPERIMENTS = "experiments" 2025-04-25T04:18:11.8532012Z  2025-04-25T04:18:11.8532629Z LF_FLEET_EXPERIMENT = "lf" 2025-04-25T04:18:11.8533158Z CANARY_FLEET_SUFFIX = ".c" 2025-04-25T04:18:11.8533648Z  2025-04-25T04:18:11.8534014Z  2025-04-25T04:18:11.8534423Z class Experiment(NamedTuple): 2025-04-25T04:18:11.8534985Z  rollout_perc: float = ( 2025-04-25T04:18:11.8535961Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-04-25T04:18:11.8536712Z  ) 2025-04-25T04:18:11.8537129Z  all_branches: bool = ( 2025-04-25T04:18:11.8537863Z  False # If True, the experiment is also enabled on the exception branches 2025-04-25T04:18:11.8538646Z  ) 2025-04-25T04:18:11.8539051Z  default: bool = ( 2025-04-25T04:18:11.8539708Z  True # If True, the experiment is enabled by default for all queries 2025-04-25T04:18:11.8540405Z  ) 2025-04-25T04:18:11.8540796Z  2025-04-25T04:18:11.8541211Z  # Add more fields as needed 2025-04-25T04:18:11.8541726Z  2025-04-25T04:18:11.8542097Z  2025-04-25T04:18:11.8542680Z class Settings(NamedTuple): 2025-04-25T04:18:11.8543189Z  """ 2025-04-25T04:18:11.8543715Z  Settings for the experiments that can be opted into. 2025-04-25T04:18:11.8544368Z  """ 2025-04-25T04:18:11.8544765Z  2025-04-25T04:18:11.8545194Z  experiments: dict[str, Experiment] = {} 2025-04-25T04:18:11.8545757Z  2025-04-25T04:18:11.8546272Z  2025-04-25T04:18:11.8546747Z class ColorFormatter(logging.Formatter): 2025-04-25T04:18:11.8547459Z  """Color codes the log messages based on the log level""" 2025-04-25T04:18:11.8548099Z  2025-04-25T04:18:11.8548486Z  COLORS = { 2025-04-25T04:18:11.8548985Z  "WARNING": "\033[33m", # Yellow 2025-04-25T04:18:11.8549567Z  "ERROR": "\033[31m", # Red 2025-04-25T04:18:11.8550123Z  "CRITICAL": "\033[31m", # Red 2025-04-25T04:18:11.8550689Z  "INFO": "\033[0m", # Reset 2025-04-25T04:18:11.8551244Z  "DEBUG": "\033[0m", # Reset 2025-04-25T04:18:11.8551781Z  } 2025-04-25T04:18:11.8552165Z  2025-04-25T04:18:11.8552896Z  def format(self, record: LogRecord) -> str: 2025-04-25T04:18:11.8553742Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-04-25T04:18:11.8554590Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-04-25T04:18:11.8555233Z  return super().format(record) 2025-04-25T04:18:11.8555754Z  2025-04-25T04:18:11.8556124Z  2025-04-25T04:18:11.8556539Z handler = logging.StreamHandler() 2025-04-25T04:18:11.8557348Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-04-25T04:18:11.8558109Z  2025-04-25T04:18:11.8558607Z log = logging.getLogger(os.path.basename(__file__)) 2025-04-25T04:18:11.8559258Z log.addHandler(handler) 2025-04-25T04:18:11.8559774Z log.setLevel(logging.INFO) 2025-04-25T04:18:11.8560266Z  2025-04-25T04:18:11.8560626Z  2025-04-25T04:18:11.8561126Z def set_github_output(key: str, value: str) -> None: 2025-04-25T04:18:11.8561744Z  """ 2025-04-25T04:18:11.8562532Z  Defines outputs of the github action that invokes this script 2025-04-25T04:18:11.8563246Z  """ 2025-04-25T04:18:11.8563677Z  if not GITHUB_OUTPUT: 2025-04-25T04:18:11.8564852Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-04-25T04:18:11.8566054Z  log.warning( 2025-04-25T04:18:11.8567013Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-04-25T04:18:11.8568014Z  ) 2025-04-25T04:18:11.8568516Z  print(f"::set-output name={key}::{value}") 2025-04-25T04:18:11.8569115Z  return 2025-04-25T04:18:11.8569546Z  2025-04-25T04:18:11.8570123Z  with open(GITHUB_OUTPUT, "a") as f: 2025-04-25T04:18:11.8570760Z  log.info(f"Setting output: {key}='{value}'") 2025-04-25T04:18:11.8571388Z  f.write(f"{key}={value}\n") 2025-04-25T04:18:11.8571913Z  2025-04-25T04:18:11.8572463Z  2025-04-25T04:18:11.8573030Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-04-25T04:18:11.8573756Z  return frozenset( 2025-04-25T04:18:11.8574457Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-04-25T04:18:11.8575179Z  ) 2025-04-25T04:18:11.8575576Z  2025-04-25T04:18:11.8575943Z  2025-04-25T04:18:11.8576341Z def parse_args() -> Any: 2025-04-25T04:18:11.8576994Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-04-25T04:18:11.8577936Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-04-25T04:18:11.8578773Z  parser.add_argument( 2025-04-25T04:18:11.8579299Z  "--github-issue-repo", 2025-04-25T04:18:11.8579841Z  type=str, 2025-04-25T04:18:11.8580316Z  required=False, 2025-04-25T04:18:11.8580985Z  default="pytorch/test-infra", 2025-04-25T04:18:11.8581597Z  help="GitHub repo to get the issue", 2025-04-25T04:18:11.8582158Z  ) 2025-04-25T04:18:11.8582790Z  parser.add_argument( 2025-04-25T04:18:11.8583305Z  "--github-repo", 2025-04-25T04:18:11.8583818Z  type=str, 2025-04-25T04:18:11.8584302Z  required=True, 2025-04-25T04:18:11.8584853Z  help="GitHub repo where CI is running", 2025-04-25T04:18:11.8585420Z  ) 2025-04-25T04:18:11.8585851Z  parser.add_argument( 2025-04-25T04:18:11.8586549Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-04-25T04:18:11.8587272Z  ) 2025-04-25T04:18:11.8587687Z  parser.add_argument( 2025-04-25T04:18:11.8588393Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-04-25T04:18:11.8589133Z  ) 2025-04-25T04:18:11.8589546Z  parser.add_argument( 2025-04-25T04:18:11.8590290Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-04-25T04:18:11.8591037Z  ) 2025-04-25T04:18:11.8591463Z  parser.add_argument( 2025-04-25T04:18:11.8592428Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-04-25T04:18:11.8593232Z  ) 2025-04-25T04:18:11.8593676Z  parser.add_argument( 2025-04-25T04:18:11.8594202Z  "--github-ref-type", 2025-04-25T04:18:11.8594723Z  type=str, 2025-04-25T04:18:11.8595189Z  required=True, 2025-04-25T04:18:11.8595773Z  help="Current GitHub ref type, branch or tag", 2025-04-25T04:18:11.8596368Z  ) 2025-04-25T04:18:11.8596789Z  parser.add_argument( 2025-04-25T04:18:11.8597332Z  "--eligible-experiments", 2025-04-25T04:18:11.8597920Z  type=_str_comma_separated_to_set, 2025-04-25T04:18:11.8598496Z  required=False, 2025-04-25T04:18:11.8598993Z  default="", 2025-04-25T04:18:11.8599951Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-04-25T04:18:11.8600945Z  ) 2025-04-25T04:18:11.8601362Z  parser.add_argument( 2025-04-25T04:18:11.8601879Z  "--pr-number", 2025-04-25T04:18:11.8602727Z  type=str, 2025-04-25T04:18:11.8603260Z  required=False, 2025-04-25T04:18:11.8603763Z  default="", 2025-04-25T04:18:11.8604501Z  help="the optional PR number where this is run", 2025-04-25T04:18:11.8605108Z  ) 2025-04-25T04:18:11.8605498Z  2025-04-25T04:18:11.8605905Z  return parser.parse_args() 2025-04-25T04:18:11.8606425Z  2025-04-25T04:18:11.8606803Z  2025-04-25T04:18:11.8607458Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-04-25T04:18:11.8608292Z  auth = Auth.Token(github_token) 2025-04-25T04:18:11.8608855Z  return Github(auth=auth) 2025-04-25T04:18:11.8609367Z  2025-04-25T04:18:11.8609738Z  2025-04-25T04:18:11.8610445Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-04-25T04:18:11.8611305Z  repo = gh.get_repo(repo) 2025-04-25T04:18:11.8611886Z  return repo.get_issue(number=issue_num) 2025-04-25T04:18:11.8612634Z  2025-04-25T04:18:11.8612999Z  2025-04-25T04:18:11.8613411Z def get_potential_pr_author( 2025-04-25T04:18:11.8614133Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-04-25T04:18:11.8614871Z ) -> str: 2025-04-25T04:18:11.8615588Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-04-25T04:18:11.8616511Z  # Fetch the actual username from the original PR. The PR number is 2025-04-25T04:18:11.8617347Z  # embedded in the tag name: ciflow// 2025-04-25T04:18:11.8617971Z  2025-04-25T04:18:11.8618387Z  gh = get_gh_client(github_token) 2025-04-25T04:18:11.8618930Z  2025-04-25T04:18:11.8619456Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-04-25T04:18:11.8620174Z  split_tag = ref_name.split("/") 2025-04-25T04:18:11.8620740Z  if ( 2025-04-25T04:18:11.8621196Z  len(split_tag) == 3 2025-04-25T04:18:11.8621758Z  and split_tag[0] == "ciflow" 2025-04-25T04:18:11.8622513Z  and split_tag[2].isnumeric() 2025-04-25T04:18:11.8623086Z  ): 2025-04-25T04:18:11.8623562Z  pr_number = split_tag[2] 2025-04-25T04:18:11.8624114Z  try: 2025-04-25T04:18:11.8624630Z  repository = gh.get_repo(repo) 2025-04-25T04:18:11.8625326Z  pull = repository.get_pull(number=int(pr_number)) 2025-04-25T04:18:11.8626005Z  except Exception as e: 2025-04-25T04:18:11.8626600Z  raise Exception( # noqa: TRY002 2025-04-25T04:18:11.8627353Z  f"issue with pull request {pr_number} from repo {repository}" 2025-04-25T04:18:11.8628052Z  ) from e 2025-04-25T04:18:11.8628681Z  return pull.user.login # type: ignore[no-any-return] 2025-04-25T04:18:11.8629472Z  # In all other cases, return the original input username 2025-04-25T04:18:11.8630119Z  return username 2025-04-25T04:18:11.8630584Z  2025-04-25T04:18:11.8630952Z  2025-04-25T04:18:11.8631419Z def is_exception_branch(branch: str) -> bool: 2025-04-25T04:18:11.8632002Z  """ 2025-04-25T04:18:11.8632947Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-04-25T04:18:11.8633802Z  """ 2025-04-25T04:18:11.8634417Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-04-25T04:18:11.8635138Z  2025-04-25T04:18:11.8635503Z  2025-04-25T04:18:11.8635936Z def load_yaml(yaml_text: str) -> Any: 2025-04-25T04:18:11.8636486Z  try: 2025-04-25T04:18:11.8636944Z  data = yaml.safe_load(yaml_text) 2025-04-25T04:18:11.8637504Z  return data 2025-04-25T04:18:11.8638147Z  except yaml.YAMLError: 2025-04-25T04:18:11.8638726Z  log.exception("Error loading YAML") 2025-04-25T04:18:11.8639291Z  raise 2025-04-25T04:18:11.8639725Z  2025-04-25T04:18:11.8640085Z  2025-04-25T04:18:11.8640772Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-04-25T04:18:11.8641572Z  """ 2025-04-25T04:18:11.8642486Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-04-25T04:18:11.8643319Z  2025-04-25T04:18:11.8643905Z  If the issue body contains "---" then the text above that is the settings 2025-04-25T04:18:11.8644754Z  and the text below is the list of opted in users. 2025-04-25T04:18:11.8645361Z  2025-04-25T04:18:11.8645994Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-04-25T04:18:11.8646756Z  """ 2025-04-25T04:18:11.8647282Z  rollout_state_parts = rollout_state.split("---") 2025-04-25T04:18:11.8647950Z  if len(rollout_state_parts) >= 2: 2025-04-25T04:18:11.8649412Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-04-25T04:18:11.8650086Z  else: 2025-04-25T04:18:11.8650533Z  return "", rollout_state 2025-04-25T04:18:11.8651045Z  2025-04-25T04:18:11.8651410Z  2025-04-25T04:18:11.8651849Z class UserOptins(dict[str, list[str]]): 2025-04-25T04:18:11.8652592Z  """ 2025-04-25T04:18:11.8653211Z  Dictionary of users with a list of features they have opted into 2025-04-25T04:18:11.8653933Z  """ 2025-04-25T04:18:11.8654332Z  2025-04-25T04:18:11.8654699Z  2025-04-25T04:18:11.8655279Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-04-25T04:18:11.8656002Z  """ 2025-04-25T04:18:11.8656978Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-04-25T04:18:11.8657960Z  2025-04-25T04:18:11.8658848Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-04-25T04:18:11.8659925Z  - Example line: "@User1,lf,split_build" 2025-04-25T04:18:11.8660686Z  - A "#" prefix indicates the user is opted out of all experiments 2025-04-25T04:18:11.8661372Z  2025-04-25T04:18:11.8661745Z  2025-04-25T04:18:11.8662117Z  """ 2025-04-25T04:18:11.8662714Z  optins = UserOptins() 2025-04-25T04:18:11.8663286Z  for user in user_optin_text.split("\n"): 2025-04-25T04:18:11.8663906Z  user = user.strip("\r\n\t -") 2025-04-25T04:18:11.8664526Z  if not user or not user.startswith("@"): 2025-04-25T04:18:11.8665144Z  # Not a valid user. Skip 2025-04-25T04:18:11.8665693Z  continue 2025-04-25T04:18:11.8666150Z  2025-04-25T04:18:11.8666526Z  if user: 2025-04-25T04:18:11.8667057Z  usr_name = user.split(",")[0].strip("@") 2025-04-25T04:18:11.8667816Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-04-25T04:18:11.8668508Z  2025-04-25T04:18:11.8668884Z  return optins 2025-04-25T04:18:11.8669328Z  2025-04-25T04:18:11.8669688Z  2025-04-25T04:18:11.8670232Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-04-25T04:18:11.8670890Z  """ 2025-04-25T04:18:11.8671351Z  Check if the experiment name is valid. 2025-04-25T04:18:11.8671931Z  A valid name: 2025-04-25T04:18:11.8672869Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-04-25T04:18:11.8674109Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-04-25T04:18:11.8674888Z  - Cannot contain spaces 2025-04-25T04:18:11.8675509Z  """ 2025-04-25T04:18:11.8675898Z  2025-04-25T04:18:11.8676402Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-04-25T04:18:11.8677202Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-04-25T04:18:11.8677840Z  2025-04-25T04:18:11.8678209Z  if valid: 2025-04-25T04:18:11.8678644Z  return True 2025-04-25T04:18:11.8679089Z  2025-04-25T04:18:11.8679460Z  log.error( 2025-04-25T04:18:11.8681011Z  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-04-25T04:18:11.8683439Z  ) 2025-04-25T04:18:11.8683958Z  return False 2025-04-25T04:18:11.8684412Z  2025-04-25T04:18:11.8684774Z  2025-04-25T04:18:11.8685492Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-04-25T04:18:11.8686191Z  """ 2025-04-25T04:18:11.8686976Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-04-25T04:18:11.8687829Z  """ 2025-04-25T04:18:11.8688222Z  try: 2025-04-25T04:18:11.8688637Z  if settings_text: 2025-04-25T04:18:11.8689452Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-04-25T04:18:11.8690307Z  # for easy reading 2025-04-25T04:18:11.8691197Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-04-25T04:18:11.8692173Z  # the backtick character in shell commands. 2025-04-25T04:18:11.8693005Z  backtick = chr(96) # backtick character 2025-04-25T04:18:11.8693733Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-04-25T04:18:11.8694469Z  settings = load_yaml(settings_text) 2025-04-25T04:18:11.8695020Z  2025-04-25T04:18:11.8695668Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-04-25T04:18:11.8696470Z  experiments = {} 2025-04-25T04:18:11.8696961Z  2025-04-25T04:18:11.8697568Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-04-25T04:18:11.8698426Z  if not is_valid_experiment_name(exp_name): 2025-04-25T04:18:11.8699624Z  # 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-04-25T04:18:11.8700753Z  continue 2025-04-25T04:18:11.8701242Z  2025-04-25T04:18:11.8701642Z  valid_settings = {} 2025-04-25T04:18:11.8702326Z  for setting in exp_settings: 2025-04-25T04:18:11.8702972Z  if setting not in Experiment._fields: 2025-04-25T04:18:11.8703576Z  log.warning( 2025-04-25T04:18:11.8704355Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-04-25T04:18:11.8705125Z  ) 2025-04-25T04:18:11.8705608Z  else: 2025-04-25T04:18:11.8706195Z  valid_settings[setting] = exp_settings[setting] 2025-04-25T04:18:11.8706811Z  2025-04-25T04:18:11.8707314Z  experiments[exp_name] = Experiment(**valid_settings) 2025-04-25T04:18:11.8708164Z  return Settings(experiments) 2025-04-25T04:18:11.8708708Z  2025-04-25T04:18:11.8709104Z  except Exception: 2025-04-25T04:18:11.8709668Z  log.exception("Failed to parse settings") 2025-04-25T04:18:11.8710250Z  2025-04-25T04:18:11.8710630Z  return Settings() 2025-04-25T04:18:11.8711096Z  2025-04-25T04:18:11.8711452Z  2025-04-25T04:18:11.8711953Z def parse_settings(rollout_state: str) -> Settings: 2025-04-25T04:18:11.8712686Z  """ 2025-04-25T04:18:11.8713184Z  Parse settings, if any, from the rollout state. 2025-04-25T04:18:11.8713789Z  2025-04-25T04:18:11.8714363Z  If the issue body contains "---" then the text above that is the settings 2025-04-25T04:18:11.8715194Z  and the text below is the list of opted in users. 2025-04-25T04:18:11.8715793Z  2025-04-25T04:18:11.8716438Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-04-25T04:18:11.8717221Z  """ 2025-04-25T04:18:11.8717849Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-25T04:18:11.8718841Z  return parse_settings_from_text(settings_text) 2025-04-25T04:18:11.8719439Z  2025-04-25T04:18:11.8719799Z  2025-04-25T04:18:11.8720277Z def parse_users(rollout_state: str) -> UserOptins: 2025-04-25T04:18:11.8720897Z  """ 2025-04-25T04:18:11.8721347Z  Parse users from the rollout state. 2025-04-25T04:18:11.8721882Z  2025-04-25T04:18:11.8722339Z  """ 2025-04-25T04:18:11.8722947Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-25T04:18:11.8723750Z  return parse_user_opt_in_from_text(users_text) 2025-04-25T04:18:11.8724328Z  2025-04-25T04:18:11.8724686Z  2025-04-25T04:18:11.8725363Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-25T04:18:11.8726169Z  """ 2025-04-25T04:18:11.8726651Z  Check if a user is opted into an experiment 2025-04-25T04:18:11.8727231Z  """ 2025-04-25T04:18:11.8727756Z  return experiment_name in user_optins.get(user, []) 2025-04-25T04:18:11.8728381Z  2025-04-25T04:18:11.8728750Z  2025-04-25T04:18:11.8729417Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-25T04:18:11.8730231Z  """ 2025-04-25T04:18:11.8730753Z  Check if a user explicitly opted out of an experiment 2025-04-25T04:18:11.8731380Z  """ 2025-04-25T04:18:11.8731940Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-04-25T04:18:11.8732798Z  experiment_optout = "-" + experiment_name 2025-04-25T04:18:11.8733518Z  if experiment_optout not in user_optins.get(user, []): 2025-04-25T04:18:11.8734162Z  return False 2025-04-25T04:18:11.8734622Z  2025-04-25T04:18:11.8735125Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-04-25T04:18:11.8735774Z  log.warning( 2025-04-25T04:18:11.8736663Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-04-25T04:18:11.8737594Z  ) 2025-04-25T04:18:11.8738005Z  2025-04-25T04:18:11.8738376Z  return True 2025-04-25T04:18:11.8738812Z  2025-04-25T04:18:11.8739169Z  2025-04-25T04:18:11.8739571Z def get_runner_prefix( 2025-04-25T04:18:11.8740068Z  rollout_state: str, 2025-04-25T04:18:11.8740610Z  workflow_requestors: Iterable[str], 2025-04-25T04:18:11.8741169Z  branch: str, 2025-04-25T04:18:11.8741898Z  eligible_experiments: frozenset[str] = frozenset(), 2025-04-25T04:18:11.8742676Z  is_canary: bool = False, 2025-04-25T04:18:11.8743189Z ) -> str: 2025-04-25T04:18:11.8743681Z  settings = parse_settings(rollout_state) 2025-04-25T04:18:11.8744321Z  user_optins = parse_users(rollout_state) 2025-04-25T04:18:11.8744885Z  2025-04-25T04:18:11.8745265Z  fleet_prefix = "" 2025-04-25T04:18:11.8745758Z  prefixes = [] 2025-04-25T04:18:11.8746477Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-04-25T04:18:11.8747490Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-04-25T04:18:11.8748252Z  log.info( 2025-04-25T04:18:11.8749007Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-04-25T04:18:11.8749816Z  ) 2025-04-25T04:18:11.8750253Z  continue 2025-04-25T04:18:11.8750703Z  2025-04-25T04:18:11.8751110Z  if eligible_experiments: 2025-04-25T04:18:11.8751861Z  if experiment_name not in eligible_experiments: 2025-04-25T04:18:11.8752680Z  exp_list = ", ".join(eligible_experiments) 2025-04-25T04:18:11.8753280Z  log.info( 2025-04-25T04:18:11.8754150Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-04-25T04:18:11.8755038Z  ) 2025-04-25T04:18:11.8755492Z  continue 2025-04-25T04:18:11.8756047Z  elif not experiment_settings.default: 2025-04-25T04:18:11.8756618Z  log.info( 2025-04-25T04:18:11.8757360Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-04-25T04:18:11.8758147Z  ) 2025-04-25T04:18:11.8758581Z  continue 2025-04-25T04:18:11.8759029Z  2025-04-25T04:18:11.8759542Z  # Is any workflow_requestor opted out to this experiment? 2025-04-25T04:18:11.8760234Z  opted_out_users = [ 2025-04-25T04:18:11.8760753Z  requestor 2025-04-25T04:18:11.8761292Z  for requestor in workflow_requestors 2025-04-25T04:18:11.8762028Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-04-25T04:18:11.8762810Z  ] 2025-04-25T04:18:11.8763203Z  2025-04-25T04:18:11.8763600Z  if opted_out_users: 2025-04-25T04:18:11.8764114Z  log.info( 2025-04-25T04:18:11.8764813Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-04-25T04:18:11.8765567Z  ) 2025-04-25T04:18:11.8766000Z  continue 2025-04-25T04:18:11.8766456Z  2025-04-25T04:18:11.8766959Z  # Is any workflow_requestor opted in to this experiment? 2025-04-25T04:18:11.8767623Z  opted_in_users = [ 2025-04-25T04:18:11.8768134Z  requestor 2025-04-25T04:18:11.8768671Z  for requestor in workflow_requestors 2025-04-25T04:18:11.8769402Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-04-25T04:18:11.8770101Z  ] 2025-04-25T04:18:11.8770514Z  2025-04-25T04:18:11.8770900Z  enabled = False 2025-04-25T04:18:11.8771409Z  if opted_in_users: 2025-04-25T04:18:11.8771914Z  log.info( 2025-04-25T04:18:11.8773074Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-04-25T04:18:11.8773868Z  ) 2025-04-25T04:18:11.8774317Z  enabled = True 2025-04-25T04:18:11.8774974Z  2025-04-25T04:18:11.8775421Z  elif experiment_settings.rollout_perc: 2025-04-25T04:18:11.8776365Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-04-25T04:18:11.8777400Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-04-25T04:18:11.8778099Z  log.info( 2025-04-25T04:18:11.8779057Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-04-25T04:18:11.8780044Z  ) 2025-04-25T04:18:11.8780520Z  enabled = True 2025-04-25T04:18:11.8781019Z  2025-04-25T04:18:11.8781405Z  if enabled: 2025-04-25T04:18:11.8781908Z  label = experiment_name 2025-04-25T04:18:11.8782668Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-04-25T04:18:11.8783610Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-04-25T04:18:11.8784857Z  # - If it's enabled, then we always list it's prefix first 2025-04-25T04:18:11.8785715Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-04-25T04:18:11.8786439Z  if is_canary: 2025-04-25T04:18:11.8787002Z  label += CANARY_FLEET_SUFFIX 2025-04-25T04:18:11.8787607Z  fleet_prefix = label 2025-04-25T04:18:11.8788147Z  else: 2025-04-25T04:18:11.8788648Z  prefixes.append(label) 2025-04-25T04:18:11.8789186Z  2025-04-25T04:18:11.8789586Z  if len(prefixes) > 1: 2025-04-25T04:18:11.8790090Z  log.error( 2025-04-25T04:18:11.8791235Z  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-04-25T04:18:11.8792549Z  ) 2025-04-25T04:18:11.8792992Z  prefixes = prefixes[:1] 2025-04-25T04:18:11.8793513Z  2025-04-25T04:18:11.8793911Z  # Fleet always comes first 2025-04-25T04:18:11.8794447Z  if fleet_prefix: 2025-04-25T04:18:11.8794964Z  prefixes.insert(0, fleet_prefix) 2025-04-25T04:18:11.8795514Z  2025-04-25T04:18:11.8796014Z  return ".".join(prefixes) + "." if prefixes else "" 2025-04-25T04:18:11.8796632Z  2025-04-25T04:18:11.8796996Z  2025-04-25T04:18:11.8797682Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-04-25T04:18:11.8798503Z  """ 2025-04-25T04:18:11.8799151Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-04-25T04:18:11.8799919Z  2025-04-25T04:18:11.8800556Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-04-25T04:18:11.8801305Z  """ 2025-04-25T04:18:11.8801764Z  gh = get_gh_client(github_token) 2025-04-25T04:18:11.8802472Z  issue = get_issue(gh, repo, issue_num) 2025-04-25T04:18:11.8803192Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-04-25T04:18:11.8803837Z  2025-04-25T04:18:11.8804206Z  2025-04-25T04:18:11.8804854Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-04-25T04:18:11.8805667Z  for _ in range(num_retries): 2025-04-25T04:18:11.8806192Z  try: 2025-04-25T04:18:11.8806685Z  req = Request(url=url, headers=headers) 2025-04-25T04:18:11.8807415Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-04-25T04:18:11.8808250Z  return json.loads(content) 2025-04-25T04:18:11.8808830Z  except Exception as e: 2025-04-25T04:18:11.8809450Z  log.warning(f"Could not download {url}: {e}") 2025-04-25T04:18:11.8810046Z  2025-04-25T04:18:11.8810673Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-04-25T04:18:11.8811439Z  return {} 2025-04-25T04:18:11.8811868Z  2025-04-25T04:18:11.8812328Z  2025-04-25T04:18:11.8812702Z @cache 2025-04-25T04:18:11.8813397Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-04-25T04:18:11.8814213Z  """ 2025-04-25T04:18:11.8814659Z  Dynamically get PR information 2025-04-25T04:18:11.8815185Z  """ 2025-04-25T04:18:11.8815753Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-04-25T04:18:11.8816426Z  headers = { 2025-04-25T04:18:11.8816972Z  "Accept": "application/vnd.github.v3+json", 2025-04-25T04:18:11.8817641Z  "Authorization": f"token {github_token}", 2025-04-25T04:18:11.8818221Z  } 2025-04-25T04:18:11.8818827Z  json_response: dict[str, Any] = download_json( 2025-04-25T04:18:11.8819506Z  url=f"{github_api}/issues/{pr_number}", 2025-04-25T04:18:11.8820088Z  headers=headers, 2025-04-25T04:18:11.8820571Z  ) 2025-04-25T04:18:11.8820952Z  2025-04-25T04:18:11.8821417Z  if not json_response: 2025-04-25T04:18:11.8822072Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-04-25T04:18:11.8822859Z  return {} 2025-04-25T04:18:11.8823307Z  2025-04-25T04:18:11.8823698Z  return json_response 2025-04-25T04:18:11.8824175Z  2025-04-25T04:18:11.8824541Z  2025-04-25T04:18:11.8825181Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-04-25T04:18:11.8825947Z  """ 2025-04-25T04:18:11.8826535Z  Dynamically get the latest list of labels from the pull request 2025-04-25T04:18:11.8827237Z  """ 2025-04-25T04:18:11.8827781Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-04-25T04:18:11.8828441Z  return { 2025-04-25T04:18:11.8829107Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-04-25T04:18:11.8829839Z  } 2025-04-25T04:18:11.8830232Z  2025-04-25T04:18:11.8830595Z  2025-04-25T04:18:11.8830986Z def main() -> None: 2025-04-25T04:18:11.8831468Z  args = parse_args() 2025-04-25T04:18:11.8831952Z  2025-04-25T04:18:11.8832511Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-04-25T04:18:11.8833109Z  2025-04-25T04:18:11.8833525Z  # Check if the PR is opt-out 2025-04-25T04:18:11.8834075Z  if args.pr_number: 2025-04-25T04:18:11.8834823Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-04-25T04:18:11.8835632Z  if OPT_OUT_LABEL in labels: 2025-04-25T04:18:11.8836177Z  log.info( 2025-04-25T04:18:11.8836956Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-04-25T04:18:11.8837772Z  ) 2025-04-25T04:18:11.8838406Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-25T04:18:11.8839130Z  sys.exit() 2025-04-25T04:18:11.8839596Z  2025-04-25T04:18:11.8839958Z  try: 2025-04-25T04:18:11.8840455Z  rollout_state = get_rollout_state_from_issue( 2025-04-25T04:18:11.8841225Z  args.github_token, args.github_issue_repo, args.github_issue 2025-04-25T04:18:11.8842060Z  ) 2025-04-25T04:18:11.8842581Z  2025-04-25T04:18:11.8843014Z  username = get_potential_pr_author( 2025-04-25T04:18:11.8843601Z  args.github_token, 2025-04-25T04:18:11.8844143Z  args.github_repo, 2025-04-25T04:18:11.8844685Z  args.github_actor, 2025-04-25T04:18:11.8845232Z  args.github_ref_type, 2025-04-25T04:18:11.8845786Z  args.github_branch, 2025-04-25T04:18:11.8846301Z  ) 2025-04-25T04:18:11.8846699Z  2025-04-25T04:18:11.8847215Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-04-25T04:18:11.8847860Z  2025-04-25T04:18:11.8848307Z  runner_label_prefix = get_runner_prefix( 2025-04-25T04:18:11.8848903Z  rollout_state, 2025-04-25T04:18:11.8849462Z  (args.github_issue_owner, username), 2025-04-25T04:18:11.8850054Z  args.github_branch, 2025-04-25T04:18:11.8850613Z  args.eligible_experiments, 2025-04-25T04:18:11.8851164Z  is_canary, 2025-04-25T04:18:11.8851739Z  ) 2025-04-25T04:18:11.8852151Z  2025-04-25T04:18:11.8852655Z  except Exception as e: 2025-04-25T04:18:11.8853177Z  log.error( 2025-04-25T04:18:11.8853926Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-04-25T04:18:11.8854731Z  ) 2025-04-25T04:18:11.8855129Z  2025-04-25T04:18:11.8855700Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-25T04:18:11.8856397Z  2025-04-25T04:18:11.8856753Z  2025-04-25T04:18:11.8857137Z if __name__ == "__main__": 2025-04-25T04:18:11.8857629Z  main() 2025-04-25T04:18:11.8858049Z  2025-04-25T04:18:11.8858416Z EOF 2025-04-25T04:18:11.8858798Z  2025-04-25T04:18:11.8859190Z cat runner_determinator.py 2025-04-25T04:18:11.9057788Z shell: /usr/bin/bash -e {0} 2025-04-25T04:18:11.9058582Z env: 2025-04-25T04:18:11.9059261Z GITHUB_TOKEN: *** 2025-04-25T04:18:11.9059692Z ISSUE_NUMBER: 5132 2025-04-25T04:18:11.9060139Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-04-25T04:18:11.9060647Z ISSUE_OWNER: 2025-04-25T04:18:11.9061052Z CHECK_EXPERIMENTS: 2025-04-25T04:18:11.9061468Z PR_NUMBER: 2025-04-25T04:18:11.9061862Z ##[endgroup] 2025-04-25T04:18:11.9258260Z # flake8: noqa: G004 2025-04-25T04:18:11.9258597Z 2025-04-25T04:18:11.9259043Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-04-25T04:18:11.9260013Z # must be kept in sync. You can do it easily by running the following command: 2025-04-25T04:18:11.9260819Z # python .github/scripts/update_runner_determinator.py 2025-04-25T04:18:11.9261272Z 2025-04-25T04:18:11.9261452Z """ 2025-04-25T04:18:11.9262039Z This runner determinator is used to determine which set of runners to run a 2025-04-25T04:18:11.9263226Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-04-25T04:18:11.9264157Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-04-25T04:18:11.9264977Z of which runners should be used to run which job. 2025-04-25T04:18:11.9265388Z 2025-04-25T04:18:11.9265769Z The configuration has two parts, the settings and a list of opted-in users, 2025-04-25T04:18:11.9266667Z separated by a line containing "---". If the line is not present, the 2025-04-25T04:18:11.9267544Z settings are considered to be empty with only the second part, the user 2025-04-25T04:18:11.9268247Z list, defined. 2025-04-25T04:18:11.9268471Z 2025-04-25T04:18:11.9268834Z The first part is a YAML block that defines the rollout settings. This can be 2025-04-25T04:18:11.9269773Z used to define any settings that are needed to determine which runners to use. 2025-04-25T04:18:11.9270806Z It's fields are defined by the RolloutSettings class below. 2025-04-25T04:18:11.9271267Z 2025-04-25T04:18:11.9271653Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-04-25T04:18:11.9272767Z The user list is also a comma separated list of additional features or 2025-04-25T04:18:11.9273516Z experiments which the user could be opted in to. 2025-04-25T04:18:11.9273914Z 2025-04-25T04:18:11.9274116Z The user list has the following rules: 2025-04-25T04:18:11.9274466Z 2025-04-25T04:18:11.9274773Z - Users are GitHub usernames, which must start with the @ prefix 2025-04-25T04:18:11.9275633Z - Each user is also a comma-separated list of features/experiments to enable 2025-04-25T04:18:11.9276395Z - A "#" prefix opts the user out of all experiments 2025-04-25T04:18:11.9276792Z 2025-04-25T04:18:11.9276957Z Example config: 2025-04-25T04:18:11.9277403Z # A list of experiments that can be opted into. 2025-04-25T04:18:11.9278059Z # This defines the behavior they'll induce when opted into. 2025-04-25T04:18:11.9278686Z # Expected syntax is: 2025-04-25T04:18:11.9279309Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-04-25T04:18:11.9280419Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-04-25T04:18:11.9281044Z 2025-04-25T04:18:11.9281215Z experiments: 2025-04-25T04:18:11.9281601Z lf: 2025-04-25T04:18:11.9281971Z rollout_percent: 25 2025-04-25T04:18:11.9282636Z all_branches: false 2025-04-25T04:18:11.9283096Z default: true 2025-04-25T04:18:11.9283497Z --- 2025-04-25T04:18:11.9283699Z 2025-04-25T04:18:11.9283861Z # Opt-ins: 2025-04-25T04:18:11.9284441Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-04-25T04:18:11.9285306Z # and specifying experiments to enable in a comma-separated list. 2025-04-25T04:18:11.9286070Z # To always opt out of an experiment, prefix it with a "-". 2025-04-25T04:18:11.9286738Z # Experiments should be from the above list. 2025-04-25T04:18:11.9287119Z 2025-04-25T04:18:11.9287300Z @User1,-lf,split_build 2025-04-25T04:18:11.9287726Z @User2,lf 2025-04-25T04:18:11.9288108Z @User3,split_build 2025-04-25T04:18:11.9288507Z """ 2025-04-25T04:18:11.9288705Z 2025-04-25T04:18:11.9288866Z import json 2025-04-25T04:18:11.9289228Z import logging 2025-04-25T04:18:11.9289604Z import os 2025-04-25T04:18:11.9289957Z import random 2025-04-25T04:18:11.9290322Z import re 2025-04-25T04:18:11.9290677Z import sys 2025-04-25T04:18:11.9291079Z from argparse import ArgumentParser 2025-04-25T04:18:11.9291607Z from collections.abc import Iterable 2025-04-25T04:18:11.9292117Z from functools import cache 2025-04-25T04:18:11.9292855Z from logging import LogRecord 2025-04-25T04:18:11.9293339Z from typing import Any, NamedTuple 2025-04-25T04:18:11.9293873Z from urllib.request import Request, urlopen 2025-04-25T04:18:11.9294240Z 2025-04-25T04:18:11.9294410Z import yaml 2025-04-25T04:18:11.9294798Z from github import Auth, Github 2025-04-25T04:18:11.9295276Z from github.Issue import Issue 2025-04-25T04:18:11.9295581Z 2025-04-25T04:18:11.9295588Z 2025-04-25T04:18:11.9295809Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-04-25T04:18:11.9296500Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-04-25T04:18:11.9297372Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-04-25T04:18:11.9297941Z 2025-04-25T04:18:11.9298171Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-04-25T04:18:11.9298736Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-04-25T04:18:11.9299249Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-04-25T04:18:11.9299797Z OPT_OUT_LABEL = "no-runner-experiments" 2025-04-25T04:18:11.9300154Z 2025-04-25T04:18:11.9300348Z SETTING_EXPERIMENTS = "experiments" 2025-04-25T04:18:11.9300674Z 2025-04-25T04:18:11.9300862Z LF_FLEET_EXPERIMENT = "lf" 2025-04-25T04:18:11.9301309Z CANARY_FLEET_SUFFIX = ".c" 2025-04-25T04:18:11.9301742Z 2025-04-25T04:18:11.9301755Z 2025-04-25T04:18:11.9301944Z class Experiment(NamedTuple): 2025-04-25T04:18:11.9302649Z rollout_perc: float = ( 2025-04-25T04:18:11.9303309Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-04-25T04:18:11.9303991Z ) 2025-04-25T04:18:11.9304362Z all_branches: bool = ( 2025-04-25T04:18:11.9304984Z False # If True, the experiment is also enabled on the exception branches 2025-04-25T04:18:11.9305647Z ) 2025-04-25T04:18:11.9306002Z default: bool = ( 2025-04-25T04:18:11.9306559Z True # If True, the experiment is enabled by default for all queries 2025-04-25T04:18:11.9307200Z ) 2025-04-25T04:18:11.9307394Z 2025-04-25T04:18:11.9307573Z # Add more fields as needed 2025-04-25T04:18:11.9307873Z 2025-04-25T04:18:11.9307880Z 2025-04-25T04:18:11.9308067Z class Settings(NamedTuple): 2025-04-25T04:18:11.9308508Z """ 2025-04-25T04:18:11.9308944Z Settings for the experiments that can be opted into. 2025-04-25T04:18:11.9309529Z """ 2025-04-25T04:18:11.9309722Z 2025-04-25T04:18:11.9309924Z experiments: dict[str, Experiment] = {} 2025-04-25T04:18:11.9310281Z 2025-04-25T04:18:11.9310296Z 2025-04-25T04:18:11.9310624Z class ColorFormatter(logging.Formatter): 2025-04-25T04:18:11.9311260Z """Color codes the log messages based on the log level""" 2025-04-25T04:18:11.9311700Z 2025-04-25T04:18:11.9311862Z COLORS = { 2025-04-25T04:18:11.9312432Z "WARNING": "\033[33m", # Yellow 2025-04-25T04:18:11.9312951Z "ERROR": "\033[31m", # Red 2025-04-25T04:18:11.9313442Z "CRITICAL": "\033[31m", # Red 2025-04-25T04:18:11.9313933Z "INFO": "\033[0m", # Reset 2025-04-25T04:18:11.9314408Z "DEBUG": "\033[0m", # Reset 2025-04-25T04:18:11.9314869Z } 2025-04-25T04:18:11.9315069Z 2025-04-25T04:18:11.9315287Z def format(self, record: LogRecord) -> str: 2025-04-25T04:18:11.9316028Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-04-25T04:18:11.9316816Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-04-25T04:18:11.9317397Z return super().format(record) 2025-04-25T04:18:11.9317731Z 2025-04-25T04:18:11.9317737Z 2025-04-25T04:18:11.9317939Z handler = logging.StreamHandler() 2025-04-25T04:18:11.9318644Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-04-25T04:18:11.9319199Z 2025-04-25T04:18:11.9319443Z log = logging.getLogger(os.path.basename(__file__)) 2025-04-25T04:18:11.9320033Z log.addHandler(handler) 2025-04-25T04:18:11.9320475Z log.setLevel(logging.INFO) 2025-04-25T04:18:11.9320763Z 2025-04-25T04:18:11.9320770Z 2025-04-25T04:18:11.9321019Z def set_github_output(key: str, value: str) -> None: 2025-04-25T04:18:11.9321582Z """ 2025-04-25T04:18:11.9322071Z Defines outputs of the github action that invokes this script 2025-04-25T04:18:11.9322912Z """ 2025-04-25T04:18:11.9323281Z if not GITHUB_OUTPUT: 2025-04-25T04:18:11.9324375Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-04-25T04:18:11.9325493Z log.warning( 2025-04-25T04:18:11.9326350Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-04-25T04:18:11.9327276Z ) 2025-04-25T04:18:11.9337404Z print(f"::set-output name={key}::{value}") 2025-04-25T04:18:11.9338046Z return 2025-04-25T04:18:11.9338282Z 2025-04-25T04:18:11.9338476Z with open(GITHUB_OUTPUT, "a") as f: 2025-04-25T04:18:11.9339060Z log.info(f"Setting output: {key}='{value}'") 2025-04-25T04:18:11.9339638Z f.write(f"{key}={value}\n") 2025-04-25T04:18:11.9339967Z 2025-04-25T04:18:11.9339975Z 2025-04-25T04:18:11.9340267Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-04-25T04:18:11.9340909Z return frozenset( 2025-04-25T04:18:11.9341520Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-04-25T04:18:11.9342664Z ) 2025-04-25T04:18:11.9342871Z 2025-04-25T04:18:11.9342878Z 2025-04-25T04:18:11.9343058Z def parse_args() -> Any: 2025-04-25T04:18:11.9343623Z parser = ArgumentParser("Get dynamic rollout settings") 2025-04-25T04:18:11.9344480Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-04-25T04:18:11.9345272Z parser.add_argument( 2025-04-25T04:18:11.9345725Z "--github-issue-repo", 2025-04-25T04:18:11.9346173Z type=str, 2025-04-25T04:18:11.9346570Z required=False, 2025-04-25T04:18:11.9347006Z default="pytorch/test-infra", 2025-04-25T04:18:11.9347546Z help="GitHub repo to get the issue", 2025-04-25T04:18:11.9348038Z ) 2025-04-25T04:18:11.9348400Z parser.add_argument( 2025-04-25T04:18:11.9348835Z "--github-repo", 2025-04-25T04:18:11.9349262Z type=str, 2025-04-25T04:18:11.9349654Z required=True, 2025-04-25T04:18:11.9350123Z help="GitHub repo where CI is running", 2025-04-25T04:18:11.9350646Z ) 2025-04-25T04:18:11.9351015Z parser.add_argument( 2025-04-25T04:18:11.9351623Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-04-25T04:18:11.9352583Z ) 2025-04-25T04:18:11.9352997Z parser.add_argument( 2025-04-25T04:18:11.9353636Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-04-25T04:18:11.9354419Z ) 2025-04-25T04:18:11.9354777Z parser.add_argument( 2025-04-25T04:18:11.9355434Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-04-25T04:18:11.9356144Z ) 2025-04-25T04:18:11.9356525Z parser.add_argument( 2025-04-25T04:18:11.9357202Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-04-25T04:18:11.9357913Z ) 2025-04-25T04:18:11.9358286Z parser.add_argument( 2025-04-25T04:18:11.9358730Z "--github-ref-type", 2025-04-25T04:18:11.9359196Z type=str, 2025-04-25T04:18:11.9359584Z required=True, 2025-04-25T04:18:11.9360069Z help="Current GitHub ref type, branch or tag", 2025-04-25T04:18:11.9360605Z ) 2025-04-25T04:18:11.9360967Z parser.add_argument( 2025-04-25T04:18:11.9361416Z "--eligible-experiments", 2025-04-25T04:18:11.9361933Z type=_str_comma_separated_to_set, 2025-04-25T04:18:11.9362634Z required=False, 2025-04-25T04:18:11.9363067Z default="", 2025-04-25T04:18:11.9363930Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-04-25T04:18:11.9364863Z ) 2025-04-25T04:18:11.9365220Z parser.add_argument( 2025-04-25T04:18:11.9365645Z "--pr-number", 2025-04-25T04:18:11.9366046Z type=str, 2025-04-25T04:18:11.9366441Z required=False, 2025-04-25T04:18:11.9366867Z default="", 2025-04-25T04:18:11.9367336Z help="the optional PR number where this is run", 2025-04-25T04:18:11.9367903Z ) 2025-04-25T04:18:11.9368094Z 2025-04-25T04:18:11.9368292Z return parser.parse_args() 2025-04-25T04:18:11.9368605Z 2025-04-25T04:18:11.9368612Z 2025-04-25T04:18:11.9369026Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-04-25T04:18:11.9369792Z auth = Auth.Token(github_token) 2025-04-25T04:18:11.9370298Z return Github(auth=auth) 2025-04-25T04:18:11.9370597Z 2025-04-25T04:18:11.9370603Z 2025-04-25T04:18:11.9371054Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-04-25T04:18:11.9371857Z repo = gh.get_repo(repo) 2025-04-25T04:18:11.9372609Z return repo.get_issue(number=issue_num) 2025-04-25T04:18:11.9372994Z 2025-04-25T04:18:11.9373002Z 2025-04-25T04:18:11.9373199Z def get_potential_pr_author( 2025-04-25T04:18:11.9373849Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-04-25T04:18:11.9374526Z ) -> str: 2025-04-25T04:18:11.9375190Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-04-25T04:18:11.9376003Z # Fetch the actual username from the original PR. The PR number is 2025-04-25T04:18:11.9376761Z # embedded in the tag name: ciflow// 2025-04-25T04:18:11.9377184Z 2025-04-25T04:18:11.9377369Z gh = get_gh_client(github_token) 2025-04-25T04:18:11.9377712Z 2025-04-25T04:18:11.9377985Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-04-25T04:18:11.9378608Z split_tag = ref_name.split("/") 2025-04-25T04:18:11.9379100Z if ( 2025-04-25T04:18:11.9379480Z len(split_tag) == 3 2025-04-25T04:18:11.9379962Z and split_tag[0] == "ciflow" 2025-04-25T04:18:11.9380476Z and split_tag[2].isnumeric() 2025-04-25T04:18:11.9380971Z ): 2025-04-25T04:18:11.9381351Z pr_number = split_tag[2] 2025-04-25T04:18:11.9381830Z try: 2025-04-25T04:18:11.9382409Z repository = gh.get_repo(repo) 2025-04-25T04:18:11.9383027Z pull = repository.get_pull(number=int(pr_number)) 2025-04-25T04:18:11.9383635Z except Exception as e: 2025-04-25T04:18:11.9384149Z raise Exception( # noqa: TRY002 2025-04-25T04:18:11.9384944Z f"issue with pull request {pr_number} from repo {repository}" 2025-04-25T04:18:11.9385591Z ) from e 2025-04-25T04:18:11.9386117Z return pull.user.login # type: ignore[no-any-return] 2025-04-25T04:18:11.9386808Z # In all other cases, return the original input username 2025-04-25T04:18:11.9387389Z return username 2025-04-25T04:18:11.9387627Z 2025-04-25T04:18:11.9387633Z 2025-04-25T04:18:11.9387867Z def is_exception_branch(branch: str) -> bool: 2025-04-25T04:18:11.9388391Z """ 2025-04-25T04:18:11.9389034Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-04-25T04:18:11.9389803Z """ 2025-04-25T04:18:11.9390350Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-04-25T04:18:11.9390873Z 2025-04-25T04:18:11.9390879Z 2025-04-25T04:18:11.9437439Z def load_yaml(yaml_text: str) -> Any: 2025-04-25T04:18:11.9438618Z try: 2025-04-25T04:18:11.9439387Z data = yaml.safe_load(yaml_text) 2025-04-25T04:18:11.9440030Z return data 2025-04-25T04:18:11.9440463Z except yaml.YAMLError: 2025-04-25T04:18:11.9440962Z log.exception("Error loading YAML") 2025-04-25T04:18:11.9441477Z raise 2025-04-25T04:18:11.9441698Z 2025-04-25T04:18:11.9441706Z 2025-04-25T04:18:11.9442125Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-04-25T04:18:11.9443121Z """ 2025-04-25T04:18:11.9443742Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-04-25T04:18:11.9444357Z 2025-04-25T04:18:11.9444734Z If the issue body contains "---" then the text above that is the settings 2025-04-25T04:18:11.9445484Z and the text below is the list of opted in users. 2025-04-25T04:18:11.9445902Z 2025-04-25T04:18:11.9446282Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-04-25T04:18:11.9446996Z """ 2025-04-25T04:18:11.9447449Z rollout_state_parts = rollout_state.split("---") 2025-04-25T04:18:11.9448056Z if len(rollout_state_parts) >= 2: 2025-04-25T04:18:11.9448653Z return rollout_state_parts[0], rollout_state_parts[1] 2025-04-25T04:18:11.9449232Z else: 2025-04-25T04:18:11.9449605Z return "", rollout_state 2025-04-25T04:18:11.9449905Z 2025-04-25T04:18:11.9449913Z 2025-04-25T04:18:11.9450106Z class UserOptins(dict[str, list[str]]): 2025-04-25T04:18:11.9450603Z """ 2025-04-25T04:18:11.9451111Z Dictionary of users with a list of features they have opted into 2025-04-25T04:18:11.9451759Z """ 2025-04-25T04:18:11.9451957Z 2025-04-25T04:18:11.9451963Z 2025-04-25T04:18:11.9452470Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-04-25T04:18:11.9453382Z """ 2025-04-25T04:18:11.9454097Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-04-25T04:18:11.9454799Z 2025-04-25T04:18:11.9455436Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-04-25T04:18:11.9456437Z - Example line: "@User1,lf,split_build" 2025-04-25T04:18:11.9457112Z - A "#" prefix indicates the user is opted out of all experiments 2025-04-25T04:18:11.9457595Z 2025-04-25T04:18:11.9457601Z 2025-04-25T04:18:11.9457757Z """ 2025-04-25T04:18:11.9458127Z optins = UserOptins() 2025-04-25T04:18:11.9458605Z for user in user_optin_text.split("\n"): 2025-04-25T04:18:11.9459151Z user = user.strip("\r\n\t -") 2025-04-25T04:18:11.9459691Z if not user or not user.startswith("@"): 2025-04-25T04:18:11.9460237Z # Not a valid user. Skip 2025-04-25T04:18:11.9460707Z continue 2025-04-25T04:18:11.9460959Z 2025-04-25T04:18:11.9461112Z if user: 2025-04-25T04:18:11.9461537Z usr_name = user.split(",")[0].strip("@") 2025-04-25T04:18:11.9462529Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-04-25T04:18:11.9463057Z 2025-04-25T04:18:11.9463238Z return optins 2025-04-25T04:18:11.9463475Z 2025-04-25T04:18:11.9463484Z 2025-04-25T04:18:11.9463773Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-04-25T04:18:11.9464379Z """ 2025-04-25T04:18:11.9464769Z Check if the experiment name is valid. 2025-04-25T04:18:11.9465289Z A valid name: 2025-04-25T04:18:11.9465916Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-04-25T04:18:11.9466850Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-04-25T04:18:11.9467569Z - Cannot contain spaces 2025-04-25T04:18:11.9468027Z """ 2025-04-25T04:18:11.9468223Z 2025-04-25T04:18:11.9468496Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-04-25T04:18:11.9469179Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-04-25T04:18:11.9469624Z 2025-04-25T04:18:11.9469781Z if valid: 2025-04-25T04:18:11.9470156Z return True 2025-04-25T04:18:11.9470395Z 2025-04-25T04:18:11.9470548Z log.error( 2025-04-25T04:18:11.9471993Z 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-04-25T04:18:11.9473764Z ) 2025-04-25T04:18:11.9474106Z return False 2025-04-25T04:18:11.9474339Z 2025-04-25T04:18:11.9474345Z 2025-04-25T04:18:11.9474642Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-04-25T04:18:11.9475252Z """ 2025-04-25T04:18:11.9475823Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-04-25T04:18:11.9476534Z """ 2025-04-25T04:18:11.9476877Z try: 2025-04-25T04:18:11.9477234Z if settings_text: 2025-04-25T04:18:11.9477946Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-04-25T04:18:11.9478728Z # for easy reading 2025-04-25T04:18:11.9479505Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-04-25T04:18:11.9480369Z # the backtick character in shell commands. 2025-04-25T04:18:11.9480957Z backtick = chr(96) # backtick character 2025-04-25T04:18:11.9481612Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-04-25T04:18:11.9482436Z settings = load_yaml(settings_text) 2025-04-25T04:18:11.9482816Z 2025-04-25T04:18:11.9483220Z # For now we just load experiments. We can expand this if/when we add more settings 2025-04-25T04:18:11.9483973Z experiments = {} 2025-04-25T04:18:11.9484424Z 2025-04-25T04:18:11.9484776Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-04-25T04:18:11.9485533Z if not is_valid_experiment_name(exp_name): 2025-04-25T04:18:11.9486647Z # 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-04-25T04:18:11.9487694Z continue 2025-04-25T04:18:11.9487976Z 2025-04-25T04:18:11.9488150Z valid_settings = {} 2025-04-25T04:18:11.9488655Z for setting in exp_settings: 2025-04-25T04:18:11.9489217Z if setting not in Experiment._fields: 2025-04-25T04:18:11.9489761Z log.warning( 2025-04-25T04:18:11.9490452Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-04-25T04:18:11.9491156Z ) 2025-04-25T04:18:11.9491579Z else: 2025-04-25T04:18:11.9492080Z valid_settings[setting] = exp_settings[setting] 2025-04-25T04:18:11.9492683Z 2025-04-25T04:18:11.9492957Z experiments[exp_name] = Experiment(**valid_settings) 2025-04-25T04:18:11.9493707Z return Settings(experiments) 2025-04-25T04:18:11.9494075Z 2025-04-25T04:18:11.9494244Z except Exception: 2025-04-25T04:18:11.9494705Z log.exception("Failed to parse settings") 2025-04-25T04:18:11.9495097Z 2025-04-25T04:18:11.9495260Z return Settings() 2025-04-25T04:18:11.9495508Z 2025-04-25T04:18:11.9495514Z 2025-04-25T04:18:11.9495758Z def parse_settings(rollout_state: str) -> Settings: 2025-04-25T04:18:11.9496317Z """ 2025-04-25T04:18:11.9496736Z Parse settings, if any, from the rollout state. 2025-04-25T04:18:11.9497130Z 2025-04-25T04:18:11.9497472Z If the issue body contains "---" then the text above that is the settings 2025-04-25T04:18:11.9498224Z and the text below is the list of opted in users. 2025-04-25T04:18:11.9498627Z 2025-04-25T04:18:11.9499054Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-04-25T04:18:11.9499776Z """ 2025-04-25T04:18:11.9500320Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-25T04:18:11.9501061Z return parse_settings_from_text(settings_text) 2025-04-25T04:18:11.9501456Z 2025-04-25T04:18:11.9501462Z 2025-04-25T04:18:11.9501695Z def parse_users(rollout_state: str) -> UserOptins: 2025-04-25T04:18:11.9502416Z """ 2025-04-25T04:18:11.9502812Z Parse users from the rollout state. 2025-04-25T04:18:11.9503158Z 2025-04-25T04:18:11.9503318Z """ 2025-04-25T04:18:11.9503840Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-25T04:18:11.9504572Z return parse_user_opt_in_from_text(users_text) 2025-04-25T04:18:11.9504968Z 2025-04-25T04:18:11.9504974Z 2025-04-25T04:18:11.9505384Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-25T04:18:11.9506148Z """ 2025-04-25T04:18:11.9506542Z Check if a user is opted into an experiment 2025-04-25T04:18:11.9507065Z """ 2025-04-25T04:18:11.9507504Z return experiment_name in user_optins.get(user, []) 2025-04-25T04:18:11.9507923Z 2025-04-25T04:18:11.9507930Z 2025-04-25T04:18:11.9508347Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-25T04:18:11.9509091Z """ 2025-04-25T04:18:11.9509518Z Check if a user explicitly opted out of an experiment 2025-04-25T04:18:11.9510087Z """ 2025-04-25T04:18:11.9510574Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-04-25T04:18:11.9511247Z experiment_optout = "-" + experiment_name 2025-04-25T04:18:11.9511878Z if experiment_optout not in user_optins.get(user, []): 2025-04-25T04:18:11.9512694Z return False 2025-04-25T04:18:11.9512954Z 2025-04-25T04:18:11.9513224Z if is_user_opted_in(user, user_optins, experiment_name): 2025-04-25T04:18:11.9513977Z log.warning( 2025-04-25T04:18:11.9514784Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-04-25T04:18:11.9515664Z ) 2025-04-25T04:18:11.9515877Z 2025-04-25T04:18:11.9516034Z return True 2025-04-25T04:18:11.9516258Z 2025-04-25T04:18:11.9516265Z 2025-04-25T04:18:11.9516439Z def get_runner_prefix( 2025-04-25T04:18:11.9516861Z rollout_state: str, 2025-04-25T04:18:11.9517307Z workflow_requestors: Iterable[str], 2025-04-25T04:18:11.9517811Z branch: str, 2025-04-25T04:18:11.9518285Z eligible_experiments: frozenset[str] = frozenset(), 2025-04-25T04:18:11.9518878Z is_canary: bool = False, 2025-04-25T04:18:11.9519318Z ) -> str: 2025-04-25T04:18:11.9519717Z settings = parse_settings(rollout_state) 2025-04-25T04:18:11.9520287Z user_optins = parse_users(rollout_state) 2025-04-25T04:18:11.9520648Z 2025-04-25T04:18:11.9520820Z fleet_prefix = "" 2025-04-25T04:18:11.9521229Z prefixes = [] 2025-04-25T04:18:11.9521846Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-04-25T04:18:11.9522964Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-04-25T04:18:11.9523839Z log.info( 2025-04-25T04:18:11.9524525Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-04-25T04:18:11.9525271Z ) 2025-04-25T04:18:11.9525636Z continue 2025-04-25T04:18:11.9525880Z 2025-04-25T04:18:11.9526062Z if eligible_experiments: 2025-04-25T04:18:11.9526605Z if experiment_name not in eligible_experiments: 2025-04-25T04:18:11.9527228Z exp_list = ", ".join(eligible_experiments) 2025-04-25T04:18:11.9527779Z log.info( 2025-04-25T04:18:11.9528564Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-04-25T04:18:11.9529411Z ) 2025-04-25T04:18:11.9529791Z continue 2025-04-25T04:18:11.9530258Z elif not experiment_settings.default: 2025-04-25T04:18:11.9530777Z log.info( 2025-04-25T04:18:11.9531437Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-04-25T04:18:11.9532171Z ) 2025-04-25T04:18:11.9532709Z continue 2025-04-25T04:18:11.9532955Z 2025-04-25T04:18:11.9533229Z # Is any workflow_requestor opted out to this experiment? 2025-04-25T04:18:11.9533857Z opted_out_users = [ 2025-04-25T04:18:11.9534287Z requestor 2025-04-25T04:18:11.9534729Z for requestor in workflow_requestors 2025-04-25T04:18:11.9535392Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-04-25T04:18:11.9536004Z ] 2025-04-25T04:18:11.9536209Z 2025-04-25T04:18:11.9536384Z if opted_out_users: 2025-04-25T04:18:11.9536847Z log.info( 2025-04-25T04:18:11.9537459Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-04-25T04:18:11.9538167Z ) 2025-04-25T04:18:11.9538530Z continue 2025-04-25T04:18:11.9538775Z 2025-04-25T04:18:11.9539046Z # Is any workflow_requestor opted in to this experiment? 2025-04-25T04:18:11.9539645Z opted_in_users = [ 2025-04-25T04:18:11.9540074Z requestor 2025-04-25T04:18:11.9540514Z for requestor in workflow_requestors 2025-04-25T04:18:11.9541170Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-04-25T04:18:11.9541783Z ] 2025-04-25T04:18:11.9541986Z 2025-04-25T04:18:11.9542151Z enabled = False 2025-04-25T04:18:11.9542744Z if opted_in_users: 2025-04-25T04:18:11.9543168Z log.info( 2025-04-25T04:18:11.9543769Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-04-25T04:18:11.9544437Z ) 2025-04-25T04:18:11.9544997Z enabled = True 2025-04-25T04:18:11.9545271Z 2025-04-25T04:18:11.9545484Z elif experiment_settings.rollout_perc: 2025-04-25T04:18:11.9546307Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-04-25T04:18:11.9547240Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-04-25T04:18:11.9547882Z log.info( 2025-04-25T04:18:11.9548742Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-04-25T04:18:11.9549663Z ) 2025-04-25T04:18:11.9550053Z enabled = True 2025-04-25T04:18:11.9550343Z 2025-04-25T04:18:11.9550505Z if enabled: 2025-04-25T04:18:11.9550913Z label = experiment_name 2025-04-25T04:18:11.9551447Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-04-25T04:18:11.9552475Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-04-25T04:18:11.9553388Z # - If it's enabled, then we always list it's prefix first 2025-04-25T04:18:11.9554265Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-04-25T04:18:11.9554940Z if is_canary: 2025-04-25T04:18:11.9555417Z label += CANARY_FLEET_SUFFIX 2025-04-25T04:18:11.9555951Z fleet_prefix = label 2025-04-25T04:18:11.9556105Z else: 2025-04-25T04:18:11.9556300Z prefixes.append(label) 2025-04-25T04:18:11.9556309Z 2025-04-25T04:18:11.9556483Z if len(prefixes) > 1: 2025-04-25T04:18:11.9556639Z log.error( 2025-04-25T04:18:11.9557451Z 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-04-25T04:18:11.9557602Z ) 2025-04-25T04:18:11.9557781Z prefixes = prefixes[:1] 2025-04-25T04:18:11.9557794Z 2025-04-25T04:18:11.9557980Z # Fleet always comes first 2025-04-25T04:18:11.9558147Z if fleet_prefix: 2025-04-25T04:18:11.9558342Z prefixes.insert(0, fleet_prefix) 2025-04-25T04:18:11.9558349Z 2025-04-25T04:18:11.9558597Z return ".".join(prefixes) + "." if prefixes else "" 2025-04-25T04:18:11.9558606Z 2025-04-25T04:18:11.9558618Z 2025-04-25T04:18:11.9559050Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-04-25T04:18:11.9559198Z """ 2025-04-25T04:18:11.9559583Z Gets the first comment of the issue, which contains the desired rollout state. 2025-04-25T04:18:11.9559591Z 2025-04-25T04:18:11.9559980Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-04-25T04:18:11.9560132Z """ 2025-04-25T04:18:11.9560312Z gh = get_gh_client(github_token) 2025-04-25T04:18:11.9560523Z issue = get_issue(gh, repo, issue_num) 2025-04-25T04:18:11.9560795Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-04-25T04:18:11.9560807Z 2025-04-25T04:18:11.9560813Z 2025-04-25T04:18:11.9561203Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-04-25T04:18:11.9561390Z for _ in range(num_retries): 2025-04-25T04:18:11.9561548Z try: 2025-04-25T04:18:11.9561759Z req = Request(url=url, headers=headers) 2025-04-25T04:18:11.9562041Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-04-25T04:18:11.9562400Z return json.loads(content) 2025-04-25T04:18:11.9562648Z except Exception as e: 2025-04-25T04:18:11.9562887Z log.warning(f"Could not download {url}: {e}") 2025-04-25T04:18:11.9562896Z 2025-04-25T04:18:11.9563276Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-04-25T04:18:11.9563433Z return {} 2025-04-25T04:18:11.9563440Z 2025-04-25T04:18:11.9563446Z 2025-04-25T04:18:11.9563593Z @cache 2025-04-25T04:18:11.9564028Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-04-25T04:18:11.9565138Z """ 2025-04-25T04:18:11.9565333Z Dynamically get PR information 2025-04-25T04:18:11.9565489Z """ 2025-04-25T04:18:11.9565783Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-04-25T04:18:11.9565943Z headers = { 2025-04-25T04:18:11.9566162Z "Accept": "application/vnd.github.v3+json", 2025-04-25T04:18:11.9566377Z "Authorization": f"token {github_token}", 2025-04-25T04:18:11.9566525Z } 2025-04-25T04:18:11.9566745Z json_response: dict[str, Any] = download_json( 2025-04-25T04:18:11.9566955Z url=f"{github_api}/issues/{pr_number}", 2025-04-25T04:18:11.9567120Z headers=headers, 2025-04-25T04:18:11.9567271Z ) 2025-04-25T04:18:11.9567280Z 2025-04-25T04:18:11.9567454Z if not json_response: 2025-04-25T04:18:11.9567734Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-04-25T04:18:11.9567883Z return {} 2025-04-25T04:18:11.9567896Z 2025-04-25T04:18:11.9568068Z return json_response 2025-04-25T04:18:11.9568076Z 2025-04-25T04:18:11.9568086Z 2025-04-25T04:18:11.9568476Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-04-25T04:18:11.9568744Z """ 2025-04-25T04:18:11.9569069Z Dynamically get the latest list of labels from the pull request 2025-04-25T04:18:11.9569224Z """ 2025-04-25T04:18:11.9569493Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-04-25T04:18:11.9569653Z return { 2025-04-25T04:18:11.9570014Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-04-25T04:18:11.9570165Z } 2025-04-25T04:18:11.9570173Z 2025-04-25T04:18:11.9570180Z 2025-04-25T04:18:11.9570348Z def main() -> None: 2025-04-25T04:18:11.9570518Z args = parse_args() 2025-04-25T04:18:11.9570529Z 2025-04-25T04:18:11.9570738Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-04-25T04:18:11.9570747Z 2025-04-25T04:18:11.9570935Z # Check if the PR is opt-out 2025-04-25T04:18:11.9571101Z if args.pr_number: 2025-04-25T04:18:11.9571487Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-04-25T04:18:11.9571671Z if OPT_OUT_LABEL in labels: 2025-04-25T04:18:11.9571826Z log.info( 2025-04-25T04:18:11.9572382Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-04-25T04:18:11.9572539Z ) 2025-04-25T04:18:11.9572869Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-25T04:18:11.9573033Z sys.exit() 2025-04-25T04:18:11.9573040Z 2025-04-25T04:18:11.9573196Z try: 2025-04-25T04:18:11.9573428Z rollout_state = get_rollout_state_from_issue( 2025-04-25T04:18:11.9573739Z args.github_token, args.github_issue_repo, args.github_issue 2025-04-25T04:18:11.9573896Z ) 2025-04-25T04:18:11.9573905Z 2025-04-25T04:18:11.9574102Z username = get_potential_pr_author( 2025-04-25T04:18:11.9574284Z args.github_token, 2025-04-25T04:18:11.9574462Z args.github_repo, 2025-04-25T04:18:11.9574631Z args.github_actor, 2025-04-25T04:18:11.9574808Z args.github_ref_type, 2025-04-25T04:18:11.9574986Z args.github_branch, 2025-04-25T04:18:11.9575144Z ) 2025-04-25T04:18:11.9575151Z 2025-04-25T04:18:11.9575437Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-04-25T04:18:11.9575445Z 2025-04-25T04:18:11.9575651Z runner_label_prefix = get_runner_prefix( 2025-04-25T04:18:11.9575821Z rollout_state, 2025-04-25T04:18:11.9576021Z (args.github_issue_owner, username), 2025-04-25T04:18:11.9576189Z args.github_branch, 2025-04-25T04:18:11.9576377Z args.eligible_experiments, 2025-04-25T04:18:11.9576537Z is_canary, 2025-04-25T04:18:11.9576686Z ) 2025-04-25T04:18:11.9576694Z 2025-04-25T04:18:11.9576871Z except Exception as e: 2025-04-25T04:18:11.9577156Z log.error( 2025-04-25T04:18:11.9577589Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-04-25T04:18:11.9577740Z ) 2025-04-25T04:18:11.9577748Z 2025-04-25T04:18:11.9578079Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-25T04:18:11.9578087Z 2025-04-25T04:18:11.9578094Z 2025-04-25T04:18:11.9578265Z if __name__ == "__main__": 2025-04-25T04:18:11.9578417Z main() 2025-04-25T04:18:11.9578426Z 2025-04-25T04:18:11.9665890Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-04-25T04:18:11.9666253Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-04-25T04:18:11.9695231Z shell: /usr/bin/bash -e {0} 2025-04-25T04:18:11.9695390Z env: 2025-04-25T04:18:11.9695806Z GITHUB_TOKEN: *** 2025-04-25T04:18:11.9695977Z ISSUE_NUMBER: 5132 2025-04-25T04:18:11.9696166Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-04-25T04:18:11.9696338Z ISSUE_OWNER: 2025-04-25T04:18:11.9696506Z CHECK_EXPERIMENTS: 2025-04-25T04:18:11.9696667Z PR_NUMBER: 2025-04-25T04:18:11.9696818Z ##[endgroup] 2025-04-25T04:18:12.3108900Z Defaulting to user installation because normal site-packages is not writeable 2025-04-25T04:18:12.6423154Z Collecting urllib3==1.26.18 2025-04-25T04:18:12.6869855Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-04-25T04:18:12.7073305Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.9 MB/s eta 0:00:00 2025-04-25T04:18:12.7328612Z Collecting PyGithub==2.3.0 2025-04-25T04:18:12.7399395Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-04-25T04:18:12.7864462Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-04-25T04:18:12.7935067Z 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-04-25T04:18:12.7977856Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-04-25T04:18:12.7993752Z 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-04-25T04:18:12.8008299Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-04-25T04:18:12.8284935Z Collecting Deprecated (from PyGithub==2.3.0) 2025-04-25T04:18:12.8353311Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-04-25T04:18:12.8582412Z 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-04-25T04:18:12.9737506Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-04-25T04:18:12.9808567Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-04-25T04:18:13.0863904Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-04-25T04:18:13.0937276Z 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-04-25T04:18:13.1144722Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-04-25T04:18:13.1211116Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-04-25T04:18:13.1486131Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-04-25T04:18:13.1594096Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 16.4 MB/s eta 0:00:00 2025-04-25T04:18:13.1661358Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-04-25T04:18:13.1773078Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 40.5 MB/s eta 0:00:00 2025-04-25T04:18:13.1852002Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-04-25T04:18:13.1984100Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 75.5 MB/s eta 0:00:00 2025-04-25T04:18:13.2057120Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-04-25T04:18:13.2148083Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-04-25T04:18:13.2212478Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 96.9 MB/s eta 0:00:00 2025-04-25T04:18:13.2281352Z 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-04-25T04:18:13.2320931Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 33.4 MB/s eta 0:00:00 2025-04-25T04:18:13.2388405Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-04-25T04:18:13.2430121Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 41.3 MB/s eta 0:00:00 2025-04-25T04:18:13.5318746Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-04-25T04:18:14.0570264Z 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-04-25T04:18:14.1296565Z ##[group]Run curr_branch="ciflow/trunk/148893" 2025-04-25T04:18:14.1296946Z curr_branch="ciflow/trunk/148893" 2025-04-25T04:18:14.1297197Z curr_ref_type="tag" 2025-04-25T04:18:14.1297442Z echo "Current branch is '$curr_branch'" 2025-04-25T04:18:14.1297693Z  2025-04-25T04:18:14.1297883Z python3 runner_determinator.py \ 2025-04-25T04:18:14.1298166Z  --github-token "$GITHUB_TOKEN" \ 2025-04-25T04:18:14.1298440Z  --github-issue "$ISSUE_NUMBER" \ 2025-04-25T04:18:14.1298720Z  --github-branch "$curr_branch" \ 2025-04-25T04:18:14.1298981Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-04-25T04:18:14.1299266Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-04-25T04:18:14.1299540Z  --github-ref-type "$curr_ref_type" \ 2025-04-25T04:18:14.1299814Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-04-25T04:18:14.1300148Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-04-25T04:18:14.1300460Z  --pr-number "${PR_NUMBER}" 2025-04-25T04:18:14.1332587Z shell: /usr/bin/bash -e {0} 2025-04-25T04:18:14.1332818Z env: 2025-04-25T04:18:14.1333349Z GITHUB_TOKEN: *** 2025-04-25T04:18:14.1333537Z ISSUE_NUMBER: 5132 2025-04-25T04:18:14.1333742Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-04-25T04:18:14.1333969Z ISSUE_OWNER: 2025-04-25T04:18:14.1334148Z CHECK_EXPERIMENTS: 2025-04-25T04:18:14.1334331Z PR_NUMBER: 2025-04-25T04:18:14.1334497Z ##[endgroup] 2025-04-25T04:18:14.1384772Z Current branch is 'ciflow/trunk/148893' 2025-04-25T04:18:16.5806994Z INFO : Based on rollout percentage of 100%, enabling experiment ephemeral. 2025-04-25T04:18:16.5807659Z INFO : Setting output: label-type='ephemeral.' 2025-04-25T04:18:16.6106567Z Evaluate and set job outputs 2025-04-25T04:18:16.6113288Z Set output 'label-type' 2025-04-25T04:18:16.6115070Z Cleaning up orphan processes