2025-05-06T20:01:59.2593660Z Current runner version: '2.323.0' 2025-05-06T20:01:59.2617148Z ##[group]Operating System 2025-05-06T20:01:59.2618289Z Ubuntu 2025-05-06T20:01:59.2618800Z 24.04.2 2025-05-06T20:01:59.2619300Z LTS 2025-05-06T20:01:59.2619837Z ##[endgroup] 2025-05-06T20:01:59.2620326Z ##[group]Runner Image 2025-05-06T20:01:59.2620961Z Image: ubuntu-24.04 2025-05-06T20:01:59.2621506Z Version: 20250427.1.0 2025-05-06T20:01:59.2622493Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250427.1/images/ubuntu/Ubuntu2404-Readme.md 2025-05-06T20:01:59.2623896Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250427.1 2025-05-06T20:01:59.2624783Z ##[endgroup] 2025-05-06T20:01:59.2625332Z ##[group]Runner Image Provisioner 2025-05-06T20:01:59.2625962Z 2.0.422.1 2025-05-06T20:01:59.2626393Z ##[endgroup] 2025-05-06T20:01:59.2627249Z ##[group]GITHUB_TOKEN Permissions 2025-05-06T20:01:59.2629436Z Metadata: read 2025-05-06T20:01:59.2629935Z ##[endgroup] 2025-05-06T20:01:59.2632129Z Secret source: Actions 2025-05-06T20:01:59.2632875Z Prepare workflow directory 2025-05-06T20:01:59.3198786Z Prepare all required actions 2025-05-06T20:01:59.3276819Z Complete job name: get-label-type / runner-determinator 2025-05-06T20:02:00.0544179Z ##[group]Run cat < runner_determinator.py 2025-05-06T20:02:00.0546399Z cat < runner_determinator.py 2025-05-06T20:02:00.0547074Z # flake8: noqa: G004 2025-05-06T20:02:00.0547741Z  2025-05-06T20:02:00.0548523Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-05-06T20:02:00.0549577Z # must be kept in sync. You can do it easily by running the following command: 2025-05-06T20:02:00.0550470Z # python .github/scripts/update_runner_determinator.py 2025-05-06T20:02:00.0551201Z  2025-05-06T20:02:00.0551624Z """ 2025-05-06T20:02:00.0552321Z This runner determinator is used to determine which set of runners to run a 2025-05-06T20:02:00.0553374Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-05-06T20:02:00.0554496Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-05-06T20:02:00.0555408Z of which runners should be used to run which job. 2025-05-06T20:02:00.0556109Z  2025-05-06T20:02:00.0556783Z The configuration has two parts, the settings and a list of opted-in users, 2025-05-06T20:02:00.0557931Z separated by a line containing "---". If the line is not present, the 2025-05-06T20:02:00.0559026Z settings are considered to be empty with only the second part, the user 2025-05-06T20:02:00.0559779Z list, defined. 2025-05-06T20:02:00.0560309Z  2025-05-06T20:02:00.0561163Z The first part is a YAML block that defines the rollout settings. This can be 2025-05-06T20:02:00.0562147Z used to define any settings that are needed to determine which runners to use. 2025-05-06T20:02:00.0563116Z It's fields are defined by the RolloutSettings class below. 2025-05-06T20:02:00.0563809Z  2025-05-06T20:02:00.0564524Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-05-06T20:02:00.0565498Z The user list is also a comma separated list of additional features or 2025-05-06T20:02:00.0566345Z experiments which the user could be opted in to. 2025-05-06T20:02:00.0567021Z  2025-05-06T20:02:00.0567574Z The user list has the following rules: 2025-05-06T20:02:00.0568221Z  2025-05-06T20:02:00.0568878Z - Users are GitHub usernames, which must start with the @ prefix 2025-05-06T20:02:00.0569787Z - Each user is also a comma-separated list of features/experiments to enable 2025-05-06T20:02:00.0570692Z - A "#" prefix opts the user out of all experiments 2025-05-06T20:02:00.0571312Z  2025-05-06T20:02:00.0571859Z Example config: 2025-05-06T20:02:00.0572747Z  # A list of experiments that can be opted into. 2025-05-06T20:02:00.0573547Z  # This defines the behavior they'll induce when opted into. 2025-05-06T20:02:00.0574280Z  # Expected syntax is: 2025-05-06T20:02:00.0575002Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-05-06T20:02:00.0576130Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-05-06T20:02:00.0576959Z  2025-05-06T20:02:00.0577358Z  experiments: 2025-05-06T20:02:00.0578328Z  lf: 2025-05-06T20:02:00.0578787Z  rollout_percent: 25 2025-05-06T20:02:00.0579341Z  all_branches: false 2025-05-06T20:02:00.0579941Z  default: true 2025-05-06T20:02:00.0580474Z  --- 2025-05-06T20:02:00.0580891Z  2025-05-06T20:02:00.0581403Z  # Opt-ins: 2025-05-06T20:02:00.0582123Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-05-06T20:02:00.0583216Z  # and specifying experiments to enable in a comma-separated list. 2025-05-06T20:02:00.0584189Z  # To always opt out of an experiment, prefix it with a "-". 2025-05-06T20:02:00.0584922Z  # Experiments should be from the above list. 2025-05-06T20:02:00.0585540Z  2025-05-06T20:02:00.0586070Z  @User1,-lf,split_build 2025-05-06T20:02:00.0586640Z  @User2,lf 2025-05-06T20:02:00.0587148Z  @User3,split_build 2025-05-06T20:02:00.0587833Z """ 2025-05-06T20:02:00.0588302Z  2025-05-06T20:02:00.0588708Z import json 2025-05-06T20:02:00.0589302Z import logging 2025-05-06T20:02:00.0589780Z import os 2025-05-06T20:02:00.0590250Z import random 2025-05-06T20:02:00.0590778Z import re 2025-05-06T20:02:00.0591245Z import sys 2025-05-06T20:02:00.0591790Z from argparse import ArgumentParser 2025-05-06T20:02:00.0592434Z from collections.abc import Iterable 2025-05-06T20:02:00.0593150Z from functools import cache 2025-05-06T20:02:00.0593717Z from logging import LogRecord 2025-05-06T20:02:00.0594344Z from typing import Any, NamedTuple 2025-05-06T20:02:00.0595078Z from urllib.request import Request, urlopen 2025-05-06T20:02:00.0595674Z  2025-05-06T20:02:00.0596126Z import yaml 2025-05-06T20:02:00.0668358Z from github import Auth, Github 2025-05-06T20:02:00.0669341Z from github.Issue import Issue 2025-05-06T20:02:00.0670178Z  2025-05-06T20:02:00.0670757Z  2025-05-06T20:02:00.0671518Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-05-06T20:02:00.0672828Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-05-06T20:02:00.0674042Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-05-06T20:02:00.0674750Z  2025-05-06T20:02:00.0675203Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-05-06T20:02:00.0675796Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-05-06T20:02:00.0676347Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-05-06T20:02:00.0676927Z OPT_OUT_LABEL = "no-runner-experiments" 2025-05-06T20:02:00.0677722Z  2025-05-06T20:02:00.0678143Z SETTING_EXPERIMENTS = "experiments" 2025-05-06T20:02:00.0678671Z  2025-05-06T20:02:00.0679049Z LF_FLEET_EXPERIMENT = "lf" 2025-05-06T20:02:00.0679545Z CANARY_FLEET_SUFFIX = ".c" 2025-05-06T20:02:00.0679999Z  2025-05-06T20:02:00.0680333Z  2025-05-06T20:02:00.0680717Z class Experiment(NamedTuple): 2025-05-06T20:02:00.0681237Z  rollout_perc: float = ( 2025-05-06T20:02:00.0681929Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-05-06T20:02:00.0682876Z  ) 2025-05-06T20:02:00.0683253Z  all_branches: bool = ( 2025-05-06T20:02:00.0683925Z  False # If True, the experiment is also enabled on the exception branches 2025-05-06T20:02:00.0684638Z  ) 2025-05-06T20:02:00.0685018Z  default: bool = ( 2025-05-06T20:02:00.0685639Z  True # If True, the experiment is enabled by default for all queries 2025-05-06T20:02:00.0686266Z  ) 2025-05-06T20:02:00.0686655Z  2025-05-06T20:02:00.0687032Z  # Add more fields as needed 2025-05-06T20:02:00.0687887Z  2025-05-06T20:02:00.0688236Z  2025-05-06T20:02:00.0688610Z class Settings(NamedTuple): 2025-05-06T20:02:00.0689085Z  """ 2025-05-06T20:02:00.0689573Z  Settings for the experiments that can be opted into. 2025-05-06T20:02:00.0690153Z  """ 2025-05-06T20:02:00.0690520Z  2025-05-06T20:02:00.0690927Z  experiments: dict[str, Experiment] = {} 2025-05-06T20:02:00.0691442Z  2025-05-06T20:02:00.0691935Z  2025-05-06T20:02:00.0692364Z class ColorFormatter(logging.Formatter): 2025-05-06T20:02:00.0693016Z  """Color codes the log messages based on the log level""" 2025-05-06T20:02:00.0693601Z  2025-05-06T20:02:00.0693938Z  COLORS = { 2025-05-06T20:02:00.0694381Z  "WARNING": "\033[33m", # Yellow 2025-05-06T20:02:00.0694908Z  "ERROR": "\033[31m", # Red 2025-05-06T20:02:00.0695429Z  "CRITICAL": "\033[31m", # Red 2025-05-06T20:02:00.0695967Z  "INFO": "\033[0m", # Reset 2025-05-06T20:02:00.0696470Z  "DEBUG": "\033[0m", # Reset 2025-05-06T20:02:00.0696944Z  } 2025-05-06T20:02:00.0697292Z  2025-05-06T20:02:00.0697904Z  def format(self, record: LogRecord) -> str: 2025-05-06T20:02:00.0698691Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-05-06T20:02:00.0699476Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-05-06T20:02:00.0700068Z  return super().format(record) 2025-05-06T20:02:00.0700555Z  2025-05-06T20:02:00.0700885Z  2025-05-06T20:02:00.0701262Z handler = logging.StreamHandler() 2025-05-06T20:02:00.0702004Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-05-06T20:02:00.0702718Z  2025-05-06T20:02:00.0703179Z log = logging.getLogger(os.path.basename(__file__)) 2025-05-06T20:02:00.0703787Z log.addHandler(handler) 2025-05-06T20:02:00.0704269Z log.setLevel(logging.INFO) 2025-05-06T20:02:00.0704733Z  2025-05-06T20:02:00.0705059Z  2025-05-06T20:02:00.0705521Z def set_github_output(key: str, value: str) -> None: 2025-05-06T20:02:00.0706107Z  """ 2025-05-06T20:02:00.0706647Z  Defines outputs of the github action that invokes this script 2025-05-06T20:02:00.0707273Z  """ 2025-05-06T20:02:00.0707826Z  if not GITHUB_OUTPUT: 2025-05-06T20:02:00.0708912Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-05-06T20:02:00.0709987Z  log.warning( 2025-05-06T20:02:00.0710854Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-05-06T20:02:00.0711748Z  ) 2025-05-06T20:02:00.0712204Z  print(f"::set-output name={key}::{value}") 2025-05-06T20:02:00.0712743Z  return 2025-05-06T20:02:00.0713133Z  2025-05-06T20:02:00.0713524Z  with open(GITHUB_OUTPUT, "a") as f: 2025-05-06T20:02:00.0714271Z  log.info(f"Setting output: {key}='{value}'") 2025-05-06T20:02:00.0714847Z  f.write(f"{key}={value}\n") 2025-05-06T20:02:00.0715324Z  2025-05-06T20:02:00.0715667Z  2025-05-06T20:02:00.0716166Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-05-06T20:02:00.0716810Z  return frozenset( 2025-05-06T20:02:00.0717662Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-05-06T20:02:00.0718333Z  ) 2025-05-06T20:02:00.0718694Z  2025-05-06T20:02:00.0719020Z  2025-05-06T20:02:00.0719382Z def parse_args() -> Any: 2025-05-06T20:02:00.0719973Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-05-06T20:02:00.0720837Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-05-06T20:02:00.0721584Z  parser.add_argument( 2025-05-06T20:02:00.0722065Z  "--github-issue-repo", 2025-05-06T20:02:00.0722546Z  type=str, 2025-05-06T20:02:00.0722968Z  required=False, 2025-05-06T20:02:00.0723580Z  default="pytorch/test-infra", 2025-05-06T20:02:00.0724137Z  help="GitHub repo to get the issue", 2025-05-06T20:02:00.0724642Z  ) 2025-05-06T20:02:00.0725020Z  parser.add_argument( 2025-05-06T20:02:00.0725493Z  "--github-repo", 2025-05-06T20:02:00.0725952Z  type=str, 2025-05-06T20:02:00.0726379Z  required=True, 2025-05-06T20:02:00.0726891Z  help="GitHub repo where CI is running", 2025-05-06T20:02:00.0727394Z  ) 2025-05-06T20:02:00.0727965Z  parser.add_argument( 2025-05-06T20:02:00.0728607Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-05-06T20:02:00.0729261Z  ) 2025-05-06T20:02:00.0729658Z  parser.add_argument( 2025-05-06T20:02:00.0730311Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-05-06T20:02:00.0730978Z  ) 2025-05-06T20:02:00.0731359Z  parser.add_argument( 2025-05-06T20:02:00.0732031Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-05-06T20:02:00.0732695Z  ) 2025-05-06T20:02:00.0733074Z  parser.add_argument( 2025-05-06T20:02:00.0733761Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-05-06T20:02:00.0734465Z  ) 2025-05-06T20:02:00.0734858Z  parser.add_argument( 2025-05-06T20:02:00.0735331Z  "--github-ref-type", 2025-05-06T20:02:00.0735800Z  type=str, 2025-05-06T20:02:00.0736230Z  required=True, 2025-05-06T20:02:00.0736758Z  help="Current GitHub ref type, branch or tag", 2025-05-06T20:02:00.0737295Z  ) 2025-05-06T20:02:00.0737835Z  parser.add_argument( 2025-05-06T20:02:00.0738328Z  "--eligible-experiments", 2025-05-06T20:02:00.0738873Z  type=_str_comma_separated_to_set, 2025-05-06T20:02:00.0739393Z  required=False, 2025-05-06T20:02:00.0739842Z  default="", 2025-05-06T20:02:00.0740704Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-05-06T20:02:00.0741599Z  ) 2025-05-06T20:02:00.0741977Z  parser.add_argument( 2025-05-06T20:02:00.0742443Z  "--pr-number", 2025-05-06T20:02:00.0742884Z  type=str, 2025-05-06T20:02:00.0743316Z  required=False, 2025-05-06T20:02:00.0743760Z  default="", 2025-05-06T20:02:00.0744276Z  help="the optional PR number where this is run", 2025-05-06T20:02:00.0744949Z  ) 2025-05-06T20:02:00.0745300Z  2025-05-06T20:02:00.0745669Z  return parser.parse_args() 2025-05-06T20:02:00.0746139Z  2025-05-06T20:02:00.0746471Z  2025-05-06T20:02:00.0747074Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-05-06T20:02:00.0747996Z  auth = Auth.Token(github_token) 2025-05-06T20:02:00.0748505Z  return Github(auth=auth) 2025-05-06T20:02:00.0748984Z  2025-05-06T20:02:00.0749310Z  2025-05-06T20:02:00.0749954Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-05-06T20:02:00.0750742Z  repo = gh.get_repo(repo) 2025-05-06T20:02:00.0751280Z  return repo.get_issue(number=issue_num) 2025-05-06T20:02:00.0751786Z  2025-05-06T20:02:00.0752107Z  2025-05-06T20:02:00.0752475Z def get_potential_pr_author( 2025-05-06T20:02:00.0753141Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-05-06T20:02:00.0753810Z ) -> str: 2025-05-06T20:02:00.0754799Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-05-06T20:02:00.0755611Z  # Fetch the actual username from the original PR. The PR number is 2025-05-06T20:02:00.0756354Z  # embedded in the tag name: ciflow// 2025-05-06T20:02:00.0756918Z  2025-05-06T20:02:00.0757292Z  gh = get_gh_client(github_token) 2025-05-06T20:02:00.0757995Z  2025-05-06T20:02:00.0758459Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-05-06T20:02:00.0759097Z  split_tag = ref_name.split("/") 2025-05-06T20:02:00.0759604Z  if ( 2025-05-06T20:02:00.0760012Z  len(split_tag) == 3 2025-05-06T20:02:00.0760526Z  and split_tag[0] == "ciflow" 2025-05-06T20:02:00.0761066Z  and split_tag[2].isnumeric() 2025-05-06T20:02:00.0761563Z  ): 2025-05-06T20:02:00.0761977Z  pr_number = split_tag[2] 2025-05-06T20:02:00.0762470Z  try: 2025-05-06T20:02:00.0762947Z  repository = gh.get_repo(repo) 2025-05-06T20:02:00.0763575Z  pull = repository.get_pull(number=int(pr_number)) 2025-05-06T20:02:00.0764185Z  except Exception as e: 2025-05-06T20:02:00.0764739Z  raise Exception( # noqa: TRY002 2025-05-06T20:02:00.0765413Z  f"issue with pull request {pr_number} from repo {repository}" 2025-05-06T20:02:00.0766046Z  ) from e 2025-05-06T20:02:00.0766625Z  return pull.user.login # type: ignore[no-any-return] 2025-05-06T20:02:00.0767336Z  # In all other cases, return the original input username 2025-05-06T20:02:00.0768380Z  return username 2025-05-06T20:02:00.0768791Z  2025-05-06T20:02:00.0769108Z  2025-05-06T20:02:00.0769541Z def is_exception_branch(branch: str) -> bool: 2025-05-06T20:02:00.0770061Z  """ 2025-05-06T20:02:00.0770729Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-05-06T20:02:00.0771476Z  """ 2025-05-06T20:02:00.0772034Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-05-06T20:02:00.0772684Z  2025-05-06T20:02:00.0773015Z  2025-05-06T20:02:00.0773404Z def load_yaml(yaml_text: str) -> Any: 2025-05-06T20:02:00.0773902Z  try: 2025-05-06T20:02:00.0774312Z  data = yaml.safe_load(yaml_text) 2025-05-06T20:02:00.0774828Z  return data 2025-05-06T20:02:00.0775287Z  except yaml.YAMLError: 2025-05-06T20:02:00.0775951Z  log.exception("Error loading YAML") 2025-05-06T20:02:00.0776465Z  raise 2025-05-06T20:02:00.0776858Z  2025-05-06T20:02:00.0777188Z  2025-05-06T20:02:00.0777921Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-05-06T20:02:00.0778642Z  """ 2025-05-06T20:02:00.0779290Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-05-06T20:02:00.0780025Z  2025-05-06T20:02:00.0780560Z  If the issue body contains "---" then the text above that is the settings 2025-05-06T20:02:00.0781334Z  and the text below is the list of opted in users. 2025-05-06T20:02:00.0781882Z  2025-05-06T20:02:00.0782450Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-05-06T20:02:00.0783130Z  """ 2025-05-06T20:02:00.0783601Z  rollout_state_parts = rollout_state.split("---") 2025-05-06T20:02:00.0784205Z  if len(rollout_state_parts) >= 2: 2025-05-06T20:02:00.0784946Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-05-06T20:02:00.0785552Z  else: 2025-05-06T20:02:00.0785955Z  return "", rollout_state 2025-05-06T20:02:00.0786457Z  2025-05-06T20:02:00.0786785Z  2025-05-06T20:02:00.0787181Z class UserOptins(dict[str, list[str]]): 2025-05-06T20:02:00.0787780Z  """ 2025-05-06T20:02:00.0788325Z  Dictionary of users with a list of features they have opted into 2025-05-06T20:02:00.0788952Z  """ 2025-05-06T20:02:00.0789307Z  2025-05-06T20:02:00.0789629Z  2025-05-06T20:02:00.0790318Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-05-06T20:02:00.0791036Z  """ 2025-05-06T20:02:00.0791757Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-05-06T20:02:00.0792568Z  2025-05-06T20:02:00.0793355Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-05-06T20:02:00.0794318Z  - Example line: "@User1,lf,split_build" 2025-05-06T20:02:00.0795009Z  - A "#" prefix indicates the user is opted out of all experiments 2025-05-06T20:02:00.0795627Z  2025-05-06T20:02:00.0795954Z  2025-05-06T20:02:00.0796276Z  """ 2025-05-06T20:02:00.0796654Z  optins = UserOptins() 2025-05-06T20:02:00.0797165Z  for user in user_optin_text.split("\n"): 2025-05-06T20:02:00.0797865Z  user = user.strip("\r\n\t -") 2025-05-06T20:02:00.0798433Z  if not user or not user.startswith("@"): 2025-05-06T20:02:00.0798991Z  # Not a valid user. Skip 2025-05-06T20:02:00.0799511Z  continue 2025-05-06T20:02:00.0799918Z  2025-05-06T20:02:00.0800260Z  if user: 2025-05-06T20:02:00.0800725Z  usr_name = user.split(",")[0].strip("@") 2025-05-06T20:02:00.0801425Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-05-06T20:02:00.0802048Z  2025-05-06T20:02:00.0802386Z  return optins 2025-05-06T20:02:00.0802799Z  2025-05-06T20:02:00.0803123Z  2025-05-06T20:02:00.0803620Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-05-06T20:02:00.0804218Z  """ 2025-05-06T20:02:00.0804646Z  Check if the experiment name is valid. 2025-05-06T20:02:00.0805199Z  A valid name: 2025-05-06T20:02:00.0805867Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-05-06T20:02:00.0806784Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-05-06T20:02:00.0807708Z  - Cannot contain spaces 2025-05-06T20:02:00.0808184Z  """ 2025-05-06T20:02:00.0808534Z  2025-05-06T20:02:00.0808984Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-05-06T20:02:00.0809707Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-05-06T20:02:00.0810284Z  2025-05-06T20:02:00.0810616Z  if valid: 2025-05-06T20:02:00.0811011Z  return True 2025-05-06T20:02:00.0811424Z  2025-05-06T20:02:00.0811752Z  log.error( 2025-05-06T20:02:00.0813164Z  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-05-06T20:02:00.0814626Z  ) 2025-05-06T20:02:00.0814992Z  return False 2025-05-06T20:02:00.0815386Z  2025-05-06T20:02:00.0815701Z  2025-05-06T20:02:00.0816325Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-05-06T20:02:00.0817084Z  """ 2025-05-06T20:02:00.0817895Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-05-06T20:02:00.0818587Z  """ 2025-05-06T20:02:00.0818945Z  try: 2025-05-06T20:02:00.0819317Z  if settings_text: 2025-05-06T20:02:00.0820048Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-05-06T20:02:00.0820816Z  # for easy reading 2025-05-06T20:02:00.0821614Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-05-06T20:02:00.0822494Z  # the backtick character in shell commands. 2025-05-06T20:02:00.0823112Z  backtick = chr(96) # backtick character 2025-05-06T20:02:00.0823777Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-05-06T20:02:00.0824451Z  settings = load_yaml(settings_text) 2025-05-06T20:02:00.0824947Z  2025-05-06T20:02:00.0825532Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-05-06T20:02:00.0826250Z  experiments = {} 2025-05-06T20:02:00.0826699Z  2025-05-06T20:02:00.0827259Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-05-06T20:02:00.0828125Z  if not is_valid_experiment_name(exp_name): 2025-05-06T20:02:00.0829191Z  # 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-05-06T20:02:00.0830184Z  continue 2025-05-06T20:02:00.0830636Z  2025-05-06T20:02:00.0831004Z  valid_settings = {} 2025-05-06T20:02:00.0831532Z  for setting in exp_settings: 2025-05-06T20:02:00.0832114Z  if setting not in Experiment._fields: 2025-05-06T20:02:00.0832665Z  log.warning( 2025-05-06T20:02:00.0833377Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-05-06T20:02:00.0834076Z  ) 2025-05-06T20:02:00.0834508Z  else: 2025-05-06T20:02:00.0835055Z  valid_settings[setting] = exp_settings[setting] 2025-05-06T20:02:00.0835608Z  2025-05-06T20:02:00.0836074Z  experiments[exp_name] = Experiment(**valid_settings) 2025-05-06T20:02:00.0836704Z  return Settings(experiments) 2025-05-06T20:02:00.0837336Z  2025-05-06T20:02:00.0837832Z  except Exception: 2025-05-06T20:02:00.0838361Z  log.exception("Failed to parse settings") 2025-05-06T20:02:00.0838898Z  2025-05-06T20:02:00.0839240Z  return Settings() 2025-05-06T20:02:00.0839664Z  2025-05-06T20:02:00.0839982Z  2025-05-06T20:02:00.0840431Z def parse_settings(rollout_state: str) -> Settings: 2025-05-06T20:02:00.0840989Z  """ 2025-05-06T20:02:00.0841441Z  Parse settings, if any, from the rollout state. 2025-05-06T20:02:00.0841971Z  2025-05-06T20:02:00.0842505Z  If the issue body contains "---" then the text above that is the settings 2025-05-06T20:02:00.0843263Z  and the text below is the list of opted in users. 2025-05-06T20:02:00.0843794Z  2025-05-06T20:02:00.0844382Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-05-06T20:02:00.0845081Z  """ 2025-05-06T20:02:00.0845656Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-05-06T20:02:00.0846534Z  return parse_settings_from_text(settings_text) 2025-05-06T20:02:00.0847079Z  2025-05-06T20:02:00.0847992Z  2025-05-06T20:02:00.0848460Z def parse_users(rollout_state: str) -> UserOptins: 2025-05-06T20:02:00.0849017Z  """ 2025-05-06T20:02:00.0849417Z  Parse users from the rollout state. 2025-05-06T20:02:00.0849910Z  2025-05-06T20:02:00.0850233Z  """ 2025-05-06T20:02:00.0850780Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-05-06T20:02:00.0851513Z  return parse_user_opt_in_from_text(users_text) 2025-05-06T20:02:00.0852033Z  2025-05-06T20:02:00.0852349Z  2025-05-06T20:02:00.0852948Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-05-06T20:02:00.0853675Z  """ 2025-05-06T20:02:00.0854108Z  Check if a user is opted into an experiment 2025-05-06T20:02:00.0854638Z  """ 2025-05-06T20:02:00.0855118Z  return experiment_name in user_optins.get(user, []) 2025-05-06T20:02:00.0855682Z  2025-05-06T20:02:00.0856010Z  2025-05-06T20:02:00.0856617Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-05-06T20:02:00.0857344Z  """ 2025-05-06T20:02:00.0857925Z  Check if a user explicitly opted out of an experiment 2025-05-06T20:02:00.0858490Z  """ 2025-05-06T20:02:00.0859010Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-05-06T20:02:00.0859708Z  experiment_optout = "-" + experiment_name 2025-05-06T20:02:00.0860353Z  if experiment_optout not in user_optins.get(user, []): 2025-05-06T20:02:00.0860940Z  return False 2025-05-06T20:02:00.0861357Z  2025-05-06T20:02:00.0861816Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-05-06T20:02:00.0862401Z  log.warning( 2025-05-06T20:02:00.0863197Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-05-06T20:02:00.0864029Z  ) 2025-05-06T20:02:00.0864389Z  2025-05-06T20:02:00.0864721Z  return True 2025-05-06T20:02:00.0865122Z  2025-05-06T20:02:00.0865446Z  2025-05-06T20:02:00.0865800Z def get_runner_prefix( 2025-05-06T20:02:00.0866259Z  rollout_state: str, 2025-05-06T20:02:00.0866755Z  workflow_requestors: Iterable[str], 2025-05-06T20:02:00.0867261Z  branch: str, 2025-05-06T20:02:00.0867889Z  eligible_experiments: frozenset[str] = frozenset(), 2025-05-06T20:02:00.0868633Z  is_canary: bool = False, 2025-05-06T20:02:00.0869085Z ) -> str: 2025-05-06T20:02:00.0869533Z  settings = parse_settings(rollout_state) 2025-05-06T20:02:00.0870113Z  user_optins = parse_users(rollout_state) 2025-05-06T20:02:00.0870623Z  2025-05-06T20:02:00.0870966Z  fleet_prefix = "" 2025-05-06T20:02:00.0871406Z  prefixes = [] 2025-05-06T20:02:00.0872045Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-05-06T20:02:00.0872969Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-05-06T20:02:00.0873660Z  log.info( 2025-05-06T20:02:00.0874352Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-05-06T20:02:00.0875077Z  ) 2025-05-06T20:02:00.0875467Z  continue 2025-05-06T20:02:00.0875883Z  2025-05-06T20:02:00.0876241Z  if eligible_experiments: 2025-05-06T20:02:00.0876929Z  if experiment_name not in eligible_experiments: 2025-05-06T20:02:00.0877673Z  exp_list = ", ".join(eligible_experiments) 2025-05-06T20:02:00.0878215Z  log.info( 2025-05-06T20:02:00.0878993Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-05-06T20:02:00.0879782Z  ) 2025-05-06T20:02:00.0880206Z  continue 2025-05-06T20:02:00.0880715Z  elif not experiment_settings.default: 2025-05-06T20:02:00.0881241Z  log.info( 2025-05-06T20:02:00.0881919Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-05-06T20:02:00.0882622Z  ) 2025-05-06T20:02:00.0883021Z  continue 2025-05-06T20:02:00.0883427Z  2025-05-06T20:02:00.0883891Z  # Is any workflow_requestor opted out to this experiment? 2025-05-06T20:02:00.0884514Z  opted_out_users = [ 2025-05-06T20:02:00.0884979Z  requestor 2025-05-06T20:02:00.0885467Z  for requestor in workflow_requestors 2025-05-06T20:02:00.0886133Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-05-06T20:02:00.0886774Z  ] 2025-05-06T20:02:00.0887131Z  2025-05-06T20:02:00.0887766Z  if opted_out_users: 2025-05-06T20:02:00.0888242Z  log.info( 2025-05-06T20:02:00.0888895Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-05-06T20:02:00.0889566Z  ) 2025-05-06T20:02:00.0889958Z  continue 2025-05-06T20:02:00.0890372Z  2025-05-06T20:02:00.0890833Z  # Is any workflow_requestor opted in to this experiment? 2025-05-06T20:02:00.0891426Z  opted_in_users = [ 2025-05-06T20:02:00.0891881Z  requestor 2025-05-06T20:02:00.0892367Z  for requestor in workflow_requestors 2025-05-06T20:02:00.0893026Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-05-06T20:02:00.0893625Z  ] 2025-05-06T20:02:00.0893981Z  2025-05-06T20:02:00.0894317Z  enabled = False 2025-05-06T20:02:00.0894772Z  if opted_in_users: 2025-05-06T20:02:00.0895219Z  log.info( 2025-05-06T20:02:00.0895844Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-05-06T20:02:00.0896499Z  ) 2025-05-06T20:02:00.0896897Z  enabled = True 2025-05-06T20:02:00.0897337Z  2025-05-06T20:02:00.0897997Z  elif experiment_settings.rollout_perc: 2025-05-06T20:02:00.0898840Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-05-06T20:02:00.0899749Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-05-06T20:02:00.0900387Z  log.info( 2025-05-06T20:02:00.0901255Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-05-06T20:02:00.0902130Z  ) 2025-05-06T20:02:00.0902564Z  enabled = True 2025-05-06T20:02:00.0903017Z  2025-05-06T20:02:00.0903363Z  if enabled: 2025-05-06T20:02:00.0903812Z  label = experiment_name 2025-05-06T20:02:00.0904378Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-05-06T20:02:00.0905181Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-05-06T20:02:00.0906144Z  # - If it's enabled, then we always list it's prefix first 2025-05-06T20:02:00.0906918Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-05-06T20:02:00.0907660Z  if is_canary: 2025-05-06T20:02:00.0908179Z  label += CANARY_FLEET_SUFFIX 2025-05-06T20:02:00.0908717Z  fleet_prefix = label 2025-05-06T20:02:00.0909203Z  else: 2025-05-06T20:02:00.0909656Z  prefixes.append(label) 2025-05-06T20:02:00.0910142Z  2025-05-06T20:02:00.0910498Z  if len(prefixes) > 1: 2025-05-06T20:02:00.0910953Z  log.error( 2025-05-06T20:02:00.0911973Z  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-05-06T20:02:00.0913017Z  ) 2025-05-06T20:02:00.0913421Z  prefixes = prefixes[:1] 2025-05-06T20:02:00.0913895Z  2025-05-06T20:02:00.0914256Z  # Fleet always comes first 2025-05-06T20:02:00.0914746Z  if fleet_prefix: 2025-05-06T20:02:00.0915212Z  prefixes.insert(0, fleet_prefix) 2025-05-06T20:02:00.0915704Z  2025-05-06T20:02:00.0916143Z  return ".".join(prefixes) + "." if prefixes else "" 2025-05-06T20:02:00.0916688Z  2025-05-06T20:02:00.0917013Z  2025-05-06T20:02:00.0917754Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-05-06T20:02:00.0918514Z  """ 2025-05-06T20:02:00.0919102Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-05-06T20:02:00.0919786Z  2025-05-06T20:02:00.0920349Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-05-06T20:02:00.0921042Z  """ 2025-05-06T20:02:00.0921453Z  gh = get_gh_client(github_token) 2025-05-06T20:02:00.0921998Z  issue = get_issue(gh, repo, issue_num) 2025-05-06T20:02:00.0922637Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-05-06T20:02:00.0923202Z  2025-05-06T20:02:00.0923531Z  2025-05-06T20:02:00.0924105Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-05-06T20:02:00.0924833Z  for _ in range(num_retries): 2025-05-06T20:02:00.0925311Z  try: 2025-05-06T20:02:00.0925753Z  req = Request(url=url, headers=headers) 2025-05-06T20:02:00.0926411Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-05-06T20:02:00.0927045Z  return json.loads(content) 2025-05-06T20:02:00.0927812Z  except Exception as e: 2025-05-06T20:02:00.0928372Z  log.warning(f"Could not download {url}: {e}") 2025-05-06T20:02:00.0928916Z  2025-05-06T20:02:00.0929476Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-05-06T20:02:00.0930156Z  return {} 2025-05-06T20:02:00.0930541Z  2025-05-06T20:02:00.0930858Z  2025-05-06T20:02:00.0931181Z @cache 2025-05-06T20:02:00.0931802Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-05-06T20:02:00.0932526Z  """ 2025-05-06T20:02:00.0932934Z  Dynamically get PR information 2025-05-06T20:02:00.0933409Z  """ 2025-05-06T20:02:00.0933928Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-05-06T20:02:00.0934532Z  headers = { 2025-05-06T20:02:00.0935015Z  "Accept": "application/vnd.github.v3+json", 2025-05-06T20:02:00.0935621Z  "Authorization": f"token {github_token}", 2025-05-06T20:02:00.0936133Z  } 2025-05-06T20:02:00.0936688Z  json_response: dict[str, Any] = download_json( 2025-05-06T20:02:00.0937312Z  url=f"{github_api}/issues/{pr_number}", 2025-05-06T20:02:00.0937948Z  headers=headers, 2025-05-06T20:02:00.0938379Z  ) 2025-05-06T20:02:00.0938727Z  2025-05-06T20:02:00.0939071Z  if not json_response: 2025-05-06T20:02:00.0939666Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-05-06T20:02:00.0940266Z  return {} 2025-05-06T20:02:00.0940667Z  2025-05-06T20:02:00.0941017Z  return json_response 2025-05-06T20:02:00.0941457Z  2025-05-06T20:02:00.0941778Z  2025-05-06T20:02:00.0942349Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-05-06T20:02:00.0943047Z  """ 2025-05-06T20:02:00.0943575Z  Dynamically get the latest list of labels from the pull request 2025-05-06T20:02:00.0944207Z  """ 2025-05-06T20:02:00.0944697Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-05-06T20:02:00.0945287Z  return { 2025-05-06T20:02:00.0945880Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-05-06T20:02:00.0946529Z  } 2025-05-06T20:02:00.0946880Z  2025-05-06T20:02:00.0947201Z  2025-05-06T20:02:00.0947645Z def main() -> None: 2025-05-06T20:02:00.0948080Z  args = parse_args() 2025-05-06T20:02:00.0948511Z  2025-05-06T20:02:00.0948920Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-05-06T20:02:00.0949442Z  2025-05-06T20:02:00.0949805Z  # Check if the PR is opt-out 2025-05-06T20:02:00.0950301Z  if args.pr_number: 2025-05-06T20:02:00.0950964Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-05-06T20:02:00.0951685Z  if OPT_OUT_LABEL in labels: 2025-05-06T20:02:00.0952177Z  log.info( 2025-05-06T20:02:00.0952877Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-05-06T20:02:00.0953609Z  ) 2025-05-06T20:02:00.0954182Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-05-06T20:02:00.0954821Z  sys.exit() 2025-05-06T20:02:00.0955241Z  2025-05-06T20:02:00.0955563Z  try: 2025-05-06T20:02:00.0956014Z  rollout_state = get_rollout_state_from_issue( 2025-05-06T20:02:00.0956713Z  args.github_token, args.github_issue_repo, args.github_issue 2025-05-06T20:02:00.0957321Z  ) 2025-05-06T20:02:00.0957911Z  2025-05-06T20:02:00.0958294Z  username = get_potential_pr_author( 2025-05-06T20:02:00.0958826Z  args.github_token, 2025-05-06T20:02:00.0959312Z  args.github_repo, 2025-05-06T20:02:00.0959802Z  args.github_actor, 2025-05-06T20:02:00.0960297Z  args.github_ref_type, 2025-05-06T20:02:00.0960793Z  args.github_branch, 2025-05-06T20:02:00.0961246Z  ) 2025-05-06T20:02:00.0961612Z  2025-05-06T20:02:00.0962086Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-05-06T20:02:00.0962676Z  2025-05-06T20:02:00.0963089Z  runner_label_prefix = get_runner_prefix( 2025-05-06T20:02:00.0963628Z  rollout_state, 2025-05-06T20:02:00.0964143Z  (args.github_issue_owner, username), 2025-05-06T20:02:00.0964673Z  args.github_branch, 2025-05-06T20:02:00.0965196Z  args.eligible_experiments, 2025-05-06T20:02:00.0965700Z  is_canary, 2025-05-06T20:02:00.0966234Z  ) 2025-05-06T20:02:00.0966603Z  2025-05-06T20:02:00.0966954Z  except Exception as e: 2025-05-06T20:02:00.0967517Z  log.error( 2025-05-06T20:02:00.0968203Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-05-06T20:02:00.0968929Z  ) 2025-05-06T20:02:00.0969289Z  2025-05-06T20:02:00.0969802Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-05-06T20:02:00.0970431Z  2025-05-06T20:02:00.0970748Z  2025-05-06T20:02:00.0971094Z if __name__ == "__main__": 2025-05-06T20:02:00.0971539Z  main() 2025-05-06T20:02:00.0971908Z  2025-05-06T20:02:00.0972227Z EOF 2025-05-06T20:02:00.0972575Z  2025-05-06T20:02:00.0972930Z cat runner_determinator.py 2025-05-06T20:02:00.1216892Z shell: /usr/bin/bash -e {0} 2025-05-06T20:02:00.1217971Z env: 2025-05-06T20:02:00.1218612Z GITHUB_TOKEN: *** 2025-05-06T20:02:00.1218999Z ISSUE_NUMBER: 5132 2025-05-06T20:02:00.1219416Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-05-06T20:02:00.1219885Z ISSUE_OWNER: 2025-05-06T20:02:00.1220256Z CHECK_EXPERIMENTS: 2025-05-06T20:02:00.1220635Z PR_NUMBER: 2025-05-06T20:02:00.1220997Z ##[endgroup] 2025-05-06T20:02:00.1417318Z # flake8: noqa: G004 2025-05-06T20:02:00.1417868Z 2025-05-06T20:02:00.1418288Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-05-06T20:02:00.1419175Z # must be kept in sync. You can do it easily by running the following command: 2025-05-06T20:02:00.1419921Z # python .github/scripts/update_runner_determinator.py 2025-05-06T20:02:00.1420341Z 2025-05-06T20:02:00.1420488Z """ 2025-05-06T20:02:00.1421039Z This runner determinator is used to determine which set of runners to run a 2025-05-06T20:02:00.1421849Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-05-06T20:02:00.1422683Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-05-06T20:02:00.1423440Z of which runners should be used to run which job. 2025-05-06T20:02:00.1423809Z 2025-05-06T20:02:00.1424156Z The configuration has two parts, the settings and a list of opted-in users, 2025-05-06T20:02:00.1424978Z separated by a line containing "---". If the line is not present, the 2025-05-06T20:02:00.1425769Z settings are considered to be empty with only the second part, the user 2025-05-06T20:02:00.1426390Z list, defined. 2025-05-06T20:02:00.1426599Z 2025-05-06T20:02:00.1426931Z The first part is a YAML block that defines the rollout settings. This can be 2025-05-06T20:02:00.1427932Z used to define any settings that are needed to determine which runners to use. 2025-05-06T20:02:00.1428702Z It's fields are defined by the RolloutSettings class below. 2025-05-06T20:02:00.1429311Z 2025-05-06T20:02:00.1429654Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-05-06T20:02:00.1430441Z The user list is also a comma separated list of additional features or 2025-05-06T20:02:00.1431108Z experiments which the user could be opted in to. 2025-05-06T20:02:00.1431474Z 2025-05-06T20:02:00.1431656Z The user list has the following rules: 2025-05-06T20:02:00.1431985Z 2025-05-06T20:02:00.1432267Z - Users are GitHub usernames, which must start with the @ prefix 2025-05-06T20:02:00.1433054Z - Each user is also a comma-separated list of features/experiments to enable 2025-05-06T20:02:00.1433748Z - A "#" prefix opts the user out of all experiments 2025-05-06T20:02:00.1434109Z 2025-05-06T20:02:00.1434266Z Example config: 2025-05-06T20:02:00.1434670Z # A list of experiments that can be opted into. 2025-05-06T20:02:00.1435279Z # This defines the behavior they'll induce when opted into. 2025-05-06T20:02:00.1435859Z # Expected syntax is: 2025-05-06T20:02:00.1436453Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-05-06T20:02:00.1438080Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-05-06T20:02:00.1438737Z 2025-05-06T20:02:00.1438891Z experiments: 2025-05-06T20:02:00.1439251Z lf: 2025-05-06T20:02:00.1439592Z rollout_percent: 25 2025-05-06T20:02:00.1440017Z all_branches: false 2025-05-06T20:02:00.1440413Z default: true 2025-05-06T20:02:00.1440784Z --- 2025-05-06T20:02:00.1440968Z 2025-05-06T20:02:00.1441117Z # Opt-ins: 2025-05-06T20:02:00.1441649Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-05-06T20:02:00.1442439Z # and specifying experiments to enable in a comma-separated list. 2025-05-06T20:02:00.1443149Z # To always opt out of an experiment, prefix it with a "-". 2025-05-06T20:02:00.1443760Z # Experiments should be from the above list. 2025-05-06T20:02:00.1444112Z 2025-05-06T20:02:00.1444276Z @User1,-lf,split_build 2025-05-06T20:02:00.1444669Z @User2,lf 2025-05-06T20:02:00.1445018Z @User3,split_build 2025-05-06T20:02:00.1445386Z """ 2025-05-06T20:02:00.1445559Z 2025-05-06T20:02:00.1445704Z import json 2025-05-06T20:02:00.1446044Z import logging 2025-05-06T20:02:00.1446380Z import os 2025-05-06T20:02:00.1446715Z import random 2025-05-06T20:02:00.1447054Z import re 2025-05-06T20:02:00.1447381Z import sys 2025-05-06T20:02:00.1447930Z from argparse import ArgumentParser 2025-05-06T20:02:00.1448414Z from collections.abc import Iterable 2025-05-06T20:02:00.1448899Z from functools import cache 2025-05-06T20:02:00.1449321Z from logging import LogRecord 2025-05-06T20:02:00.1449795Z from typing import Any, NamedTuple 2025-05-06T20:02:00.1450275Z from urllib.request import Request, urlopen 2025-05-06T20:02:00.1450623Z 2025-05-06T20:02:00.1450769Z import yaml 2025-05-06T20:02:00.1451120Z from github import Auth, Github 2025-05-06T20:02:00.1451563Z from github.Issue import Issue 2025-05-06T20:02:00.1451840Z 2025-05-06T20:02:00.1451847Z 2025-05-06T20:02:00.1452049Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-05-06T20:02:00.1452667Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-05-06T20:02:00.1453459Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-05-06T20:02:00.1453969Z 2025-05-06T20:02:00.1454178Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-05-06T20:02:00.1454704Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-05-06T20:02:00.1455166Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-05-06T20:02:00.1455670Z OPT_OUT_LABEL = "no-runner-experiments" 2025-05-06T20:02:00.1455993Z 2025-05-06T20:02:00.1456171Z SETTING_EXPERIMENTS = "experiments" 2025-05-06T20:02:00.1456474Z 2025-05-06T20:02:00.1456636Z LF_FLEET_EXPERIMENT = "lf" 2025-05-06T20:02:00.1457056Z CANARY_FLEET_SUFFIX = ".c" 2025-05-06T20:02:00.1457314Z 2025-05-06T20:02:00.1457610Z 2025-05-06T20:02:00.1457814Z class Experiment(NamedTuple): 2025-05-06T20:02:00.1458260Z rollout_perc: float = ( 2025-05-06T20:02:00.1458852Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-05-06T20:02:00.1459486Z ) 2025-05-06T20:02:00.1459824Z all_branches: bool = ( 2025-05-06T20:02:00.1460399Z False # If True, the experiment is also enabled on the exception branches 2025-05-06T20:02:00.1461017Z ) 2025-05-06T20:02:00.1461337Z default: bool = ( 2025-05-06T20:02:00.1461855Z True # If True, the experiment is enabled by default for all queries 2025-05-06T20:02:00.1462438Z ) 2025-05-06T20:02:00.1462616Z 2025-05-06T20:02:00.1462779Z # Add more fields as needed 2025-05-06T20:02:00.1463056Z 2025-05-06T20:02:00.1463061Z 2025-05-06T20:02:00.1463237Z class Settings(NamedTuple): 2025-05-06T20:02:00.1463635Z """ 2025-05-06T20:02:00.1464051Z Settings for the experiments that can be opted into. 2025-05-06T20:02:00.1464580Z """ 2025-05-06T20:02:00.1464755Z 2025-05-06T20:02:00.1464951Z experiments: dict[str, Experiment] = {} 2025-05-06T20:02:00.1465287Z 2025-05-06T20:02:00.1465293Z 2025-05-06T20:02:00.1465599Z class ColorFormatter(logging.Formatter): 2025-05-06T20:02:00.1466198Z """Color codes the log messages based on the log level""" 2025-05-06T20:02:00.1466597Z 2025-05-06T20:02:00.1466747Z COLORS = { 2025-05-06T20:02:00.1467102Z "WARNING": "\033[33m", # Yellow 2025-05-06T20:02:00.1467795Z "ERROR": "\033[31m", # Red 2025-05-06T20:02:00.1468255Z "CRITICAL": "\033[31m", # Red 2025-05-06T20:02:00.1468714Z "INFO": "\033[0m", # Reset 2025-05-06T20:02:00.1469148Z "DEBUG": "\033[0m", # Reset 2025-05-06T20:02:00.1469578Z } 2025-05-06T20:02:00.1469756Z 2025-05-06T20:02:00.1469953Z def format(self, record: LogRecord) -> str: 2025-05-06T20:02:00.1470646Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-05-06T20:02:00.1471374Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-05-06T20:02:00.1471905Z return super().format(record) 2025-05-06T20:02:00.1472214Z 2025-05-06T20:02:00.1472220Z 2025-05-06T20:02:00.1472405Z handler = logging.StreamHandler() 2025-05-06T20:02:00.1473050Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-05-06T20:02:00.1473570Z 2025-05-06T20:02:00.1473798Z log = logging.getLogger(os.path.basename(__file__)) 2025-05-06T20:02:00.1474327Z log.addHandler(handler) 2025-05-06T20:02:00.1474737Z log.setLevel(logging.INFO) 2025-05-06T20:02:00.1474999Z 2025-05-06T20:02:00.1475005Z 2025-05-06T20:02:00.1475233Z def set_github_output(key: str, value: str) -> None: 2025-05-06T20:02:00.1475736Z """ 2025-05-06T20:02:00.1476196Z Defines outputs of the github action that invokes this script 2025-05-06T20:02:00.1476763Z """ 2025-05-06T20:02:00.1477098Z if not GITHUB_OUTPUT: 2025-05-06T20:02:00.1478279Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-05-06T20:02:00.1479321Z log.warning( 2025-05-06T20:02:00.1480099Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-05-06T20:02:00.1480935Z ) 2025-05-06T20:02:00.1490821Z print(f"::set-output name={key}::{value}") 2025-05-06T20:02:00.1491375Z return 2025-05-06T20:02:00.1491596Z 2025-05-06T20:02:00.1491784Z with open(GITHUB_OUTPUT, "a") as f: 2025-05-06T20:02:00.1492314Z log.info(f"Setting output: {key}='{value}'") 2025-05-06T20:02:00.1492842Z f.write(f"{key}={value}\n") 2025-05-06T20:02:00.1493138Z 2025-05-06T20:02:00.1493145Z 2025-05-06T20:02:00.1493435Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-05-06T20:02:00.1494010Z return frozenset( 2025-05-06T20:02:00.1494578Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-05-06T20:02:00.1495408Z ) 2025-05-06T20:02:00.1495594Z 2025-05-06T20:02:00.1495600Z 2025-05-06T20:02:00.1495759Z def parse_args() -> Any: 2025-05-06T20:02:00.1496262Z parser = ArgumentParser("Get dynamic rollout settings") 2025-05-06T20:02:00.1497083Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-05-06T20:02:00.1498113Z parser.add_argument( 2025-05-06T20:02:00.1498525Z "--github-issue-repo", 2025-05-06T20:02:00.1498942Z type=str, 2025-05-06T20:02:00.1499297Z required=False, 2025-05-06T20:02:00.1499704Z default="pytorch/test-infra", 2025-05-06T20:02:00.1500192Z help="GitHub repo to get the issue", 2025-05-06T20:02:00.1500652Z ) 2025-05-06T20:02:00.1500978Z parser.add_argument( 2025-05-06T20:02:00.1501386Z "--github-repo", 2025-05-06T20:02:00.1501765Z type=str, 2025-05-06T20:02:00.1502121Z required=True, 2025-05-06T20:02:00.1502537Z help="GitHub repo where CI is running", 2025-05-06T20:02:00.1503022Z ) 2025-05-06T20:02:00.1503355Z parser.add_argument( 2025-05-06T20:02:00.1503896Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-05-06T20:02:00.1504623Z ) 2025-05-06T20:02:00.1504961Z parser.add_argument( 2025-05-06T20:02:00.1505527Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-05-06T20:02:00.1506134Z ) 2025-05-06T20:02:00.1506461Z parser.add_argument( 2025-05-06T20:02:00.1507041Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-05-06T20:02:00.1507886Z ) 2025-05-06T20:02:00.1508213Z parser.add_argument( 2025-05-06T20:02:00.1508828Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-05-06T20:02:00.1509484Z ) 2025-05-06T20:02:00.1509812Z parser.add_argument( 2025-05-06T20:02:00.1510225Z "--github-ref-type", 2025-05-06T20:02:00.1510632Z type=str, 2025-05-06T20:02:00.1510999Z required=True, 2025-05-06T20:02:00.1511430Z help="Current GitHub ref type, branch or tag", 2025-05-06T20:02:00.1511938Z ) 2025-05-06T20:02:00.1512268Z parser.add_argument( 2025-05-06T20:02:00.1512687Z "--eligible-experiments", 2025-05-06T20:02:00.1513148Z type=_str_comma_separated_to_set, 2025-05-06T20:02:00.1513615Z required=False, 2025-05-06T20:02:00.1513991Z default="", 2025-05-06T20:02:00.1514762Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-05-06T20:02:00.1515601Z ) 2025-05-06T20:02:00.1515927Z parser.add_argument( 2025-05-06T20:02:00.1516317Z "--pr-number", 2025-05-06T20:02:00.1516676Z type=str, 2025-05-06T20:02:00.1517030Z required=False, 2025-05-06T20:02:00.1517395Z default="", 2025-05-06T20:02:00.1517997Z help="the optional PR number where this is run", 2025-05-06T20:02:00.1518505Z ) 2025-05-06T20:02:00.1518685Z 2025-05-06T20:02:00.1518856Z return parser.parse_args() 2025-05-06T20:02:00.1519135Z 2025-05-06T20:02:00.1519141Z 2025-05-06T20:02:00.1519512Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-05-06T20:02:00.1520208Z auth = Auth.Token(github_token) 2025-05-06T20:02:00.1520668Z return Github(auth=auth) 2025-05-06T20:02:00.1520931Z 2025-05-06T20:02:00.1520937Z 2025-05-06T20:02:00.1521352Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-05-06T20:02:00.1522083Z repo = gh.get_repo(repo) 2025-05-06T20:02:00.1522541Z return repo.get_issue(number=issue_num) 2025-05-06T20:02:00.1522872Z 2025-05-06T20:02:00.1522878Z 2025-05-06T20:02:00.1523047Z def get_potential_pr_author( 2025-05-06T20:02:00.1523629Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-05-06T20:02:00.1524233Z ) -> str: 2025-05-06T20:02:00.1524707Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-05-06T20:02:00.1525586Z # Fetch the actual username from the original PR. The PR number is 2025-05-06T20:02:00.1526284Z # embedded in the tag name: ciflow// 2025-05-06T20:02:00.1526668Z 2025-05-06T20:02:00.1526843Z gh = get_gh_client(github_token) 2025-05-06T20:02:00.1527147Z 2025-05-06T20:02:00.1527386Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-05-06T20:02:00.1528132Z split_tag = ref_name.split("/") 2025-05-06T20:02:00.1528581Z if ( 2025-05-06T20:02:00.1528926Z len(split_tag) == 3 2025-05-06T20:02:00.1529354Z and split_tag[0] == "ciflow" 2025-05-06T20:02:00.1529837Z and split_tag[2].isnumeric() 2025-05-06T20:02:00.1530283Z ): 2025-05-06T20:02:00.1530624Z pr_number = split_tag[2] 2025-05-06T20:02:00.1531057Z try: 2025-05-06T20:02:00.1531477Z repository = gh.get_repo(repo) 2025-05-06T20:02:00.1532045Z pull = repository.get_pull(number=int(pr_number)) 2025-05-06T20:02:00.1580091Z except Exception as e: 2025-05-06T20:02:00.1580729Z raise Exception( # noqa: TRY002 2025-05-06T20:02:00.1581654Z f"issue with pull request {pr_number} from repo {repository}" 2025-05-06T20:02:00.1582270Z ) from e 2025-05-06T20:02:00.1582768Z return pull.user.login # type: ignore[no-any-return] 2025-05-06T20:02:00.1583417Z # In all other cases, return the original input username 2025-05-06T20:02:00.1583957Z return username 2025-05-06T20:02:00.1584179Z 2025-05-06T20:02:00.1584186Z 2025-05-06T20:02:00.1584392Z def is_exception_branch(branch: str) -> bool: 2025-05-06T20:02:00.1584882Z """ 2025-05-06T20:02:00.1585463Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-05-06T20:02:00.1586195Z """ 2025-05-06T20:02:00.1586692Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-05-06T20:02:00.1587185Z 2025-05-06T20:02:00.1587191Z 2025-05-06T20:02:00.1587367Z def load_yaml(yaml_text: str) -> Any: 2025-05-06T20:02:00.1588031Z try: 2025-05-06T20:02:00.1588385Z data = yaml.safe_load(yaml_text) 2025-05-06T20:02:00.1588855Z return data 2025-05-06T20:02:00.1589229Z except yaml.YAMLError: 2025-05-06T20:02:00.1589665Z log.exception("Error loading YAML") 2025-05-06T20:02:00.1590125Z raise 2025-05-06T20:02:00.1590323Z 2025-05-06T20:02:00.1590329Z 2025-05-06T20:02:00.1590704Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-05-06T20:02:00.1591379Z """ 2025-05-06T20:02:00.1591955Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-05-06T20:02:00.1592505Z 2025-05-06T20:02:00.1592827Z If the issue body contains "---" then the text above that is the settings 2025-05-06T20:02:00.1593517Z and the text below is the list of opted in users. 2025-05-06T20:02:00.1593896Z 2025-05-06T20:02:00.1594233Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-05-06T20:02:00.1594866Z """ 2025-05-06T20:02:00.1595270Z rollout_state_parts = rollout_state.split("---") 2025-05-06T20:02:00.1595808Z if len(rollout_state_parts) >= 2: 2025-05-06T20:02:00.1596370Z return rollout_state_parts[0], rollout_state_parts[1] 2025-05-06T20:02:00.1596902Z else: 2025-05-06T20:02:00.1597239Z return "", rollout_state 2025-05-06T20:02:00.1597726Z 2025-05-06T20:02:00.1597732Z 2025-05-06T20:02:00.1597925Z class UserOptins(dict[str, list[str]]): 2025-05-06T20:02:00.1598379Z """ 2025-05-06T20:02:00.1598858Z Dictionary of users with a list of features they have opted into 2025-05-06T20:02:00.1599442Z """ 2025-05-06T20:02:00.1599629Z 2025-05-06T20:02:00.1599635Z 2025-05-06T20:02:00.1599941Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-05-06T20:02:00.1600534Z """ 2025-05-06T20:02:00.1601346Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-05-06T20:02:00.1601971Z 2025-05-06T20:02:00.1602556Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-05-06T20:02:00.1603454Z - Example line: "@User1,lf,split_build" 2025-05-06T20:02:00.1604088Z - A "#" prefix indicates the user is opted out of all experiments 2025-05-06T20:02:00.1604532Z 2025-05-06T20:02:00.1604538Z 2025-05-06T20:02:00.1604685Z """ 2025-05-06T20:02:00.1605026Z optins = UserOptins() 2025-05-06T20:02:00.1605475Z for user in user_optin_text.split("\n"): 2025-05-06T20:02:00.1605973Z user = user.strip("\r\n\t -") 2025-05-06T20:02:00.1606472Z if not user or not user.startswith("@"): 2025-05-06T20:02:00.1606978Z # Not a valid user. Skip 2025-05-06T20:02:00.1607592Z continue 2025-05-06T20:02:00.1607844Z 2025-05-06T20:02:00.1607995Z if user: 2025-05-06T20:02:00.1608393Z usr_name = user.split(",")[0].strip("@") 2025-05-06T20:02:00.1609165Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-05-06T20:02:00.1609621Z 2025-05-06T20:02:00.1609778Z return optins 2025-05-06T20:02:00.1609992Z 2025-05-06T20:02:00.1610005Z 2025-05-06T20:02:00.1610262Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-05-06T20:02:00.1610802Z """ 2025-05-06T20:02:00.1611161Z Check if the experiment name is valid. 2025-05-06T20:02:00.1611624Z A valid name: 2025-05-06T20:02:00.1612201Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-05-06T20:02:00.1613058Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-05-06T20:02:00.1613703Z - Cannot contain spaces 2025-05-06T20:02:00.1614112Z """ 2025-05-06T20:02:00.1614289Z 2025-05-06T20:02:00.1614524Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-05-06T20:02:00.1615165Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-05-06T20:02:00.1615573Z 2025-05-06T20:02:00.1615715Z if valid: 2025-05-06T20:02:00.1616069Z return True 2025-05-06T20:02:00.1616284Z 2025-05-06T20:02:00.1616433Z log.error( 2025-05-06T20:02:00.1617904Z 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-05-06T20:02:00.1619357Z ) 2025-05-06T20:02:00.1619669Z return False 2025-05-06T20:02:00.1619887Z 2025-05-06T20:02:00.1619893Z 2025-05-06T20:02:00.1620167Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-05-06T20:02:00.1620729Z """ 2025-05-06T20:02:00.1621262Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-05-06T20:02:00.1621921Z """ 2025-05-06T20:02:00.1622235Z try: 2025-05-06T20:02:00.1622581Z if settings_text: 2025-05-06T20:02:00.1623231Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-05-06T20:02:00.1623965Z # for easy reading 2025-05-06T20:02:00.1624688Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-05-06T20:02:00.1625495Z # the backtick character in shell commands. 2025-05-06T20:02:00.1626051Z backtick = chr(96) # backtick character 2025-05-06T20:02:00.1626650Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-05-06T20:02:00.1627260Z settings = load_yaml(settings_text) 2025-05-06T20:02:00.1627699Z 2025-05-06T20:02:00.1628069Z # For now we just load experiments. We can expand this if/when we add more settings 2025-05-06T20:02:00.1628751Z experiments = {} 2025-05-06T20:02:00.1629019Z 2025-05-06T20:02:00.1629350Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-05-06T20:02:00.1630161Z if not is_valid_experiment_name(exp_name): 2025-05-06T20:02:00.1631172Z # 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-05-06T20:02:00.1632118Z continue 2025-05-06T20:02:00.1632388Z 2025-05-06T20:02:00.1632549Z valid_settings = {} 2025-05-06T20:02:00.1633017Z for setting in exp_settings: 2025-05-06T20:02:00.1633537Z if setting not in Experiment._fields: 2025-05-06T20:02:00.1634040Z log.warning( 2025-05-06T20:02:00.1634677Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-05-06T20:02:00.1635325Z ) 2025-05-06T20:02:00.1635703Z else: 2025-05-06T20:02:00.1636178Z valid_settings[setting] = exp_settings[setting] 2025-05-06T20:02:00.1636567Z 2025-05-06T20:02:00.1636820Z experiments[exp_name] = Experiment(**valid_settings) 2025-05-06T20:02:00.1637602Z return Settings(experiments) 2025-05-06T20:02:00.1637938Z 2025-05-06T20:02:00.1638103Z except Exception: 2025-05-06T20:02:00.1638526Z log.exception("Failed to parse settings") 2025-05-06T20:02:00.1638883Z 2025-05-06T20:02:00.1639031Z return Settings() 2025-05-06T20:02:00.1639263Z 2025-05-06T20:02:00.1639269Z 2025-05-06T20:02:00.1639495Z def parse_settings(rollout_state: str) -> Settings: 2025-05-06T20:02:00.1640013Z """ 2025-05-06T20:02:00.1640398Z Parse settings, if any, from the rollout state. 2025-05-06T20:02:00.1640765Z 2025-05-06T20:02:00.1641085Z If the issue body contains "---" then the text above that is the settings 2025-05-06T20:02:00.1641788Z and the text below is the list of opted in users. 2025-05-06T20:02:00.1642160Z 2025-05-06T20:02:00.1642559Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-05-06T20:02:00.1643227Z """ 2025-05-06T20:02:00.1643730Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-05-06T20:02:00.1644420Z return parse_settings_from_text(settings_text) 2025-05-06T20:02:00.1644779Z 2025-05-06T20:02:00.1644785Z 2025-05-06T20:02:00.1645012Z def parse_users(rollout_state: str) -> UserOptins: 2025-05-06T20:02:00.1645509Z """ 2025-05-06T20:02:00.1645856Z Parse users from the rollout state. 2025-05-06T20:02:00.1646171Z 2025-05-06T20:02:00.1646309Z """ 2025-05-06T20:02:00.1646783Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-05-06T20:02:00.1647542Z return parse_user_opt_in_from_text(users_text) 2025-05-06T20:02:00.1647909Z 2025-05-06T20:02:00.1647916Z 2025-05-06T20:02:00.1648287Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-05-06T20:02:00.1648961Z """ 2025-05-06T20:02:00.1649323Z Check if a user is opted into an experiment 2025-05-06T20:02:00.1649799Z """ 2025-05-06T20:02:00.1650197Z return experiment_name in user_optins.get(user, []) 2025-05-06T20:02:00.1650584Z 2025-05-06T20:02:00.1650590Z 2025-05-06T20:02:00.1650962Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-05-06T20:02:00.1651636Z """ 2025-05-06T20:02:00.1652044Z Check if a user explicitly opted out of an experiment 2025-05-06T20:02:00.1652570Z """ 2025-05-06T20:02:00.1653021Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-05-06T20:02:00.1653634Z experiment_optout = "-" + experiment_name 2025-05-06T20:02:00.1654204Z if experiment_optout not in user_optins.get(user, []): 2025-05-06T20:02:00.1654740Z return False 2025-05-06T20:02:00.1654962Z 2025-05-06T20:02:00.1655202Z if is_user_opted_in(user, user_optins, experiment_name): 2025-05-06T20:02:00.1655743Z log.warning( 2025-05-06T20:02:00.1656609Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-05-06T20:02:00.1657538Z ) 2025-05-06T20:02:00.1657733Z 2025-05-06T20:02:00.1657883Z return True 2025-05-06T20:02:00.1658093Z 2025-05-06T20:02:00.1658099Z 2025-05-06T20:02:00.1658257Z def get_runner_prefix( 2025-05-06T20:02:00.1658649Z rollout_state: str, 2025-05-06T20:02:00.1659056Z workflow_requestors: Iterable[str], 2025-05-06T20:02:00.1659518Z branch: str, 2025-05-06T20:02:00.1659949Z eligible_experiments: frozenset[str] = frozenset(), 2025-05-06T20:02:00.1660489Z is_canary: bool = False, 2025-05-06T20:02:00.1660891Z ) -> str: 2025-05-06T20:02:00.1661258Z settings = parse_settings(rollout_state) 2025-05-06T20:02:00.1661785Z user_optins = parse_users(rollout_state) 2025-05-06T20:02:00.1662116Z 2025-05-06T20:02:00.1662268Z fleet_prefix = "" 2025-05-06T20:02:00.1662654Z prefixes = [] 2025-05-06T20:02:00.1663218Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-05-06T20:02:00.1664067Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-05-06T20:02:00.1664826Z log.info( 2025-05-06T20:02:00.1665446Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-05-06T20:02:00.1666131Z ) 2025-05-06T20:02:00.1666457Z continue 2025-05-06T20:02:00.1666673Z 2025-05-06T20:02:00.1666845Z if eligible_experiments: 2025-05-06T20:02:00.1667340Z if experiment_name not in eligible_experiments: 2025-05-06T20:02:00.1668045Z exp_list = ", ".join(eligible_experiments) 2025-05-06T20:02:00.1668541Z log.info( 2025-05-06T20:02:00.1669248Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-05-06T20:02:00.1670000Z ) 2025-05-06T20:02:00.1670353Z continue 2025-05-06T20:02:00.1670777Z elif not experiment_settings.default: 2025-05-06T20:02:00.1671246Z log.info( 2025-05-06T20:02:00.1671845Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-05-06T20:02:00.1672504Z ) 2025-05-06T20:02:00.1672833Z continue 2025-05-06T20:02:00.1673049Z 2025-05-06T20:02:00.1673303Z # Is any workflow_requestor opted out to this experiment? 2025-05-06T20:02:00.1673864Z opted_out_users = [ 2025-05-06T20:02:00.1674261Z requestor 2025-05-06T20:02:00.1674661Z for requestor in workflow_requestors 2025-05-06T20:02:00.1675270Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-05-06T20:02:00.1675824Z ] 2025-05-06T20:02:00.1676009Z 2025-05-06T20:02:00.1676165Z if opted_out_users: 2025-05-06T20:02:00.1676562Z log.info( 2025-05-06T20:02:00.1677115Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-05-06T20:02:00.1677850Z ) 2025-05-06T20:02:00.1678181Z continue 2025-05-06T20:02:00.1678402Z 2025-05-06T20:02:00.1678654Z # Is any workflow_requestor opted in to this experiment? 2025-05-06T20:02:00.1679203Z opted_in_users = [ 2025-05-06T20:02:00.1679600Z requestor 2025-05-06T20:02:00.1680000Z for requestor in workflow_requestors 2025-05-06T20:02:00.1680597Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-05-06T20:02:00.1681150Z ] 2025-05-06T20:02:00.1681338Z 2025-05-06T20:02:00.1681491Z enabled = False 2025-05-06T20:02:00.1681873Z if opted_in_users: 2025-05-06T20:02:00.1682267Z log.info( 2025-05-06T20:02:00.1682807Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-05-06T20:02:00.1683412Z ) 2025-05-06T20:02:00.1683759Z enabled = True 2025-05-06T20:02:00.1684135Z 2025-05-06T20:02:00.1684326Z elif experiment_settings.rollout_perc: 2025-05-06T20:02:00.1685076Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-05-06T20:02:00.1685945Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-05-06T20:02:00.1686528Z log.info( 2025-05-06T20:02:00.1687312Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-05-06T20:02:00.1688259Z ) 2025-05-06T20:02:00.1688621Z enabled = True 2025-05-06T20:02:00.1688886Z 2025-05-06T20:02:00.1689025Z if enabled: 2025-05-06T20:02:00.1689402Z label = experiment_name 2025-05-06T20:02:00.1689886Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-05-06T20:02:00.1690637Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-05-06T20:02:00.1691446Z # - If it's enabled, then we always list it's prefix first 2025-05-06T20:02:00.1692248Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-05-06T20:02:00.1692850Z if is_canary: 2025-05-06T20:02:00.1693280Z label += CANARY_FLEET_SUFFIX 2025-05-06T20:02:00.1693769Z fleet_prefix = label 2025-05-06T20:02:00.1694193Z else: 2025-05-06T20:02:00.1694570Z prefixes.append(label) 2025-05-06T20:02:00.1694880Z 2025-05-06T20:02:00.1695046Z if len(prefixes) > 1: 2025-05-06T20:02:00.1695431Z log.error( 2025-05-06T20:02:00.1696362Z 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-05-06T20:02:00.1697367Z ) 2025-05-06T20:02:00.1697860Z prefixes = prefixes[:1] 2025-05-06T20:02:00.1698136Z 2025-05-06T20:02:00.1698306Z # Fleet always comes first 2025-05-06T20:02:00.1698720Z if fleet_prefix: 2025-05-06T20:02:00.1699111Z prefixes.insert(0, fleet_prefix) 2025-05-06T20:02:00.1699435Z 2025-05-06T20:02:00.1699661Z return ".".join(prefixes) + "." if prefixes else "" 2025-05-06T20:02:00.1700028Z 2025-05-06T20:02:00.1700034Z 2025-05-06T20:02:00.1700433Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-05-06T20:02:00.1701112Z """ 2025-05-06T20:02:00.1701628Z Gets the first comment of the issue, which contains the desired rollout state. 2025-05-06T20:02:00.1702128Z 2025-05-06T20:02:00.1702478Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-05-06T20:02:00.1703105Z """ 2025-05-06T20:02:00.1703447Z gh = get_gh_client(github_token) 2025-05-06T20:02:00.1703921Z issue = get_issue(gh, repo, issue_num) 2025-05-06T20:02:00.1704494Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-05-06T20:02:00.1704896Z 2025-05-06T20:02:00.1704901Z 2025-05-06T20:02:00.1705260Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-05-06T20:02:00.1705944Z for _ in range(num_retries): 2025-05-06T20:02:00.1706365Z try: 2025-05-06T20:02:00.1706742Z req = Request(url=url, headers=headers) 2025-05-06T20:02:00.1707338Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-05-06T20:02:00.1708041Z return json.loads(content) 2025-05-06T20:02:00.1708511Z except Exception as e: 2025-05-06T20:02:00.1708980Z log.warning(f"Could not download {url}: {e}") 2025-05-06T20:02:00.1709343Z 2025-05-06T20:02:00.1709680Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-05-06T20:02:00.1710310Z return {} 2025-05-06T20:02:00.1710512Z 2025-05-06T20:02:00.1710517Z 2025-05-06T20:02:00.1710657Z @cache 2025-05-06T20:02:00.1711213Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-05-06T20:02:00.1712018Z """ 2025-05-06T20:02:00.1712361Z Dynamically get PR information 2025-05-06T20:02:00.1712785Z """ 2025-05-06T20:02:00.1713240Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-05-06T20:02:00.1713791Z headers = { 2025-05-06T20:02:00.1714195Z "Accept": "application/vnd.github.v3+json", 2025-05-06T20:02:00.1714731Z "Authorization": f"token {github_token}", 2025-05-06T20:02:00.1715205Z } 2025-05-06T20:02:00.1715578Z json_response: dict[str, Any] = download_json( 2025-05-06T20:02:00.1716124Z url=f"{github_api}/issues/{pr_number}", 2025-05-06T20:02:00.1716630Z headers=headers, 2025-05-06T20:02:00.1716997Z ) 2025-05-06T20:02:00.1717173Z 2025-05-06T20:02:00.1717336Z if not json_response: 2025-05-06T20:02:00.1717953Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-05-06T20:02:00.1718504Z return {} 2025-05-06T20:02:00.1718712Z 2025-05-06T20:02:00.1718876Z return json_response 2025-05-06T20:02:00.1719123Z 2025-05-06T20:02:00.1719130Z 2025-05-06T20:02:00.1719486Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-05-06T20:02:00.1720257Z """ 2025-05-06T20:02:00.1720732Z Dynamically get the latest list of labels from the pull request 2025-05-06T20:02:00.1721312Z """ 2025-05-06T20:02:00.1721739Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-05-06T20:02:00.1722280Z return { 2025-05-06T20:02:00.1722792Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-05-06T20:02:00.1723413Z } 2025-05-06T20:02:00.1723590Z 2025-05-06T20:02:00.1723595Z 2025-05-06T20:02:00.1723750Z def main() -> None: 2025-05-06T20:02:00.1724113Z args = parse_args() 2025-05-06T20:02:00.1724350Z 2025-05-06T20:02:00.1724552Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-05-06T20:02:00.1724895Z 2025-05-06T20:02:00.1725063Z # Check if the PR is opt-out 2025-05-06T20:02:00.1725505Z if args.pr_number: 2025-05-06T20:02:00.1726088Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-05-06T20:02:00.1726775Z if OPT_OUT_LABEL in labels: 2025-05-06T20:02:00.1727207Z log.info( 2025-05-06T20:02:00.1727929Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-05-06T20:02:00.1728613Z ) 2025-05-06T20:02:00.1729096Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-05-06T20:02:00.1729691Z sys.exit() 2025-05-06T20:02:00.1729921Z 2025-05-06T20:02:00.1730062Z try: 2025-05-06T20:02:00.1730443Z rollout_state = get_rollout_state_from_issue( 2025-05-06T20:02:00.1731069Z args.github_token, args.github_issue_repo, args.github_issue 2025-05-06T20:02:00.1731638Z ) 2025-05-06T20:02:00.1731818Z 2025-05-06T20:02:00.1732003Z username = get_potential_pr_author( 2025-05-06T20:02:00.1732487Z args.github_token, 2025-05-06T20:02:00.1732914Z args.github_repo, 2025-05-06T20:02:00.1733332Z args.github_actor, 2025-05-06T20:02:00.1733759Z args.github_ref_type, 2025-05-06T20:02:00.1734196Z args.github_branch, 2025-05-06T20:02:00.1734600Z ) 2025-05-06T20:02:00.1734778Z 2025-05-06T20:02:00.1735030Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-05-06T20:02:00.1735441Z 2025-05-06T20:02:00.1735637Z runner_label_prefix = get_runner_prefix( 2025-05-06T20:02:00.1736124Z rollout_state, 2025-05-06T20:02:00.1736548Z (args.github_issue_owner, username), 2025-05-06T20:02:00.1737034Z args.github_branch, 2025-05-06T20:02:00.1737605Z args.eligible_experiments, 2025-05-06T20:02:00.1738063Z is_canary, 2025-05-06T20:02:00.1738414Z ) 2025-05-06T20:02:00.1738598Z 2025-05-06T20:02:00.1738757Z except Exception as e: 2025-05-06T20:02:00.1739147Z log.error( 2025-05-06T20:02:00.1739873Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-05-06T20:02:00.1740554Z ) 2025-05-06T20:02:00.1740737Z 2025-05-06T20:02:00.1741033Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-05-06T20:02:00.1741474Z 2025-05-06T20:02:00.1741480Z 2025-05-06T20:02:00.1741640Z if __name__ == "__main__": 2025-05-06T20:02:00.1742027Z main() 2025-05-06T20:02:00.1742213Z 2025-05-06T20:02:00.1826412Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-05-06T20:02:00.1827246Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-05-06T20:02:00.1857293Z shell: /usr/bin/bash -e {0} 2025-05-06T20:02:00.1857860Z env: 2025-05-06T20:02:00.1858415Z GITHUB_TOKEN: *** 2025-05-06T20:02:00.1858788Z ISSUE_NUMBER: 5132 2025-05-06T20:02:00.1859192Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-05-06T20:02:00.1859638Z ISSUE_OWNER: 2025-05-06T20:02:00.1859999Z CHECK_EXPERIMENTS: 2025-05-06T20:02:00.1860381Z PR_NUMBER: 2025-05-06T20:02:00.1860718Z ##[endgroup] 2025-05-06T20:02:00.5490088Z Defaulting to user installation because normal site-packages is not writeable 2025-05-06T20:02:00.8726752Z Collecting urllib3==1.26.18 2025-05-06T20:02:00.9048855Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-05-06T20:02:00.9283900Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.3 MB/s eta 0:00:00 2025-05-06T20:02:00.9494326Z Collecting PyGithub==2.3.0 2025-05-06T20:02:00.9521385Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-05-06T20:02:00.9927184Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-05-06T20:02:00.9953091Z 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-05-06T20:02:00.9998462Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-05-06T20:02:01.0014724Z 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-05-06T20:02:01.0029190Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-05-06T20:02:01.0273025Z Collecting Deprecated (from PyGithub==2.3.0) 2025-05-06T20:02:01.0422281Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-05-06T20:02:01.0655369Z 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-05-06T20:02:01.1761021Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-05-06T20:02:01.1789426Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-05-06T20:02:01.2838955Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-05-06T20:02:01.2865858Z 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-05-06T20:02:01.3040373Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-05-06T20:02:01.3069358Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-05-06T20:02:01.3286679Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-05-06T20:02:01.3425043Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 11.1 MB/s eta 0:00:00 2025-05-06T20:02:01.3450230Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-05-06T20:02:01.3540334Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 47.8 MB/s eta 0:00:00 2025-05-06T20:02:01.3564818Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-05-06T20:02:01.3709546Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 66.8 MB/s eta 0:00:00 2025-05-06T20:02:01.3792421Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-05-06T20:02:01.3838463Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-05-06T20:02:01.3924139Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 68.9 MB/s eta 0:00:00 2025-05-06T20:02:01.3948565Z 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-05-06T20:02:01.3996773Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 24.4 MB/s eta 0:00:00 2025-05-06T20:02:01.4020640Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-05-06T20:02:01.4064739Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 38.0 MB/s eta 0:00:00 2025-05-06T20:02:01.6916338Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-05-06T20:02:02.2184797Z 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-05-06T20:02:02.3005924Z ##[group]Run curr_branch="ciflow/trunk/147470" 2025-05-06T20:02:02.3006386Z curr_branch="ciflow/trunk/147470" 2025-05-06T20:02:02.3006752Z curr_ref_type="tag" 2025-05-06T20:02:02.3007044Z echo "Current branch is '$curr_branch'" 2025-05-06T20:02:02.3007334Z  2025-05-06T20:02:02.3007757Z python3 runner_determinator.py \ 2025-05-06T20:02:02.3008090Z  --github-token "$GITHUB_TOKEN" \ 2025-05-06T20:02:02.3008408Z  --github-issue "$ISSUE_NUMBER" \ 2025-05-06T20:02:02.3008716Z  --github-branch "$curr_branch" \ 2025-05-06T20:02:02.3009016Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-05-06T20:02:02.3009341Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-05-06T20:02:02.3009666Z  --github-ref-type "$curr_ref_type" \ 2025-05-06T20:02:02.3009983Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-05-06T20:02:02.3010382Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-05-06T20:02:02.3010726Z  --pr-number "${PR_NUMBER}" 2025-05-06T20:02:02.3041697Z shell: /usr/bin/bash -e {0} 2025-05-06T20:02:02.3041961Z env: 2025-05-06T20:02:02.3042510Z GITHUB_TOKEN: *** 2025-05-06T20:02:02.3042749Z ISSUE_NUMBER: 5132 2025-05-06T20:02:02.3042989Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-05-06T20:02:02.3043263Z ISSUE_OWNER: 2025-05-06T20:02:02.3043489Z CHECK_EXPERIMENTS: 2025-05-06T20:02:02.3043719Z PR_NUMBER: 2025-05-06T20:02:02.3043915Z ##[endgroup] 2025-05-06T20:02:02.3092951Z Current branch is 'ciflow/trunk/147470' 2025-05-06T20:02:04.9314216Z INFO : Based on rollout percentage of 100%, enabling experiment ephemeral. 2025-05-06T20:02:04.9315294Z INFO : Setting output: label-type='ephemeral.' 2025-05-06T20:02:04.9628502Z Evaluate and set job outputs 2025-05-06T20:02:04.9635154Z Set output 'label-type' 2025-05-06T20:02:04.9637128Z Cleaning up orphan processes