From 3796ecfb55d73dfe622de84c3983d9218f5ec160 Mon Sep 17 00:00:00 2001 From: Praneeth Bedapudi Date: Fri, 1 Nov 2024 23:18:04 +0530 Subject: [PATCH] remove counter Signed-off-by: Praneeth Bedapudi --- fastdeploy/_monitor.py | 76 ------------------------------------------ fastdeploy/_rest.py | 8 ----- setup.py | 2 +- 3 files changed, 1 insertion(+), 85 deletions(-) delete mode 100644 fastdeploy/_monitor.py diff --git a/fastdeploy/_monitor.py b/fastdeploy/_monitor.py deleted file mode 100644 index 54cf401..0000000 --- a/fastdeploy/_monitor.py +++ /dev/null @@ -1,76 +0,0 @@ -import psutil -import time -import os -from . import _utils - - -def monitor_processes(interval=1): - try: - pids = [] - - processes = {pid: psutil.Process(pid) for pid in pids} - - # Try to initialize GPU monitoring - try: - import pynvml - - pynvml.nvmlInit() - num_gpus = pynvml.nvmlDeviceGetCount() - handles = [pynvml.nvmlDeviceGetHandleByIndex(i) for i in range(num_gpus)] - gpu_monitoring = True - except (ImportError, pynvml.NVMLError): - gpu_monitoring = False - print("GPU monitoring is not available.") - - while True: - data = {} - - # Monitor each process - for pid, process in processes.items(): - try: - with process.oneshot(): - cpu_percent = process.cpu_percent(interval=None) - memory_info = process.memory_info() - create_time = process.create_time() - - data[pid] = { - "name": process.name(), - "cmdline": process.cmdline(), - "status": process.status(), - "cpu_percent": cpu_percent, - "memory_mb": memory_info.rss / 1024 / 1024, - "uptime": time.time() - create_time, - "num_threads": process.num_threads(), - "username": process.username(), - "nice": process.nice(), - "io_counters": process.io_counters()._asdict() - if hasattr(process, "io_counters") - else None, - } - except psutil.NoSuchProcess: - data[pid] = {"error": "Process not found"} - except psutil.AccessDenied: - data[pid] = {"error": "Access denied"} - - # GPU monitoring (if available) - if gpu_monitoring: - for i, handle in enumerate(handles): - try: - gpu_util = pynvml.nvmlDeviceGetUtilizationRates(handle) - gpu_memory = pynvml.nvmlDeviceGetMemoryInfo(handle) - data[f"gpu_{i}"] = { - "utilization": gpu_util.gpu, - "memory_used_mb": gpu_memory.used / 1024 / 1024, - "memory_total_mb": gpu_memory.total / 1024 / 1024, - } - except pynvml.NVMLError: - data[f"gpu_{i}"] = {"error": "GPU information not available"} - - yield data - time.sleep(interval) - - except: - print("Monitoring stopped.") - finally: - if gpu_monitoring: - pynvml.nvmlShutdown() diff --git a/fastdeploy/_rest.py b/fastdeploy/_rest.py index 811db8c..76c5597 100644 --- a/fastdeploy/_rest.py +++ b/fastdeploy/_rest.py @@ -255,14 +255,6 @@ def on_get(self, req, resp): ) / requests_received_in_last_x_seconds_that_are_successful prometheus_text = f""" -# HELP total_predictor_run_for_hours Total hours the predictor has been actively running predictions since start. -# TYPE total_predictor_run_for_hours counter -total_predictor_run_for_hours {_utils.GLOBAL_METRICS_INDEX["total_predictor_run_for_hours"]} - -# HELP total_predictor_up_for_hours Total hours the predictor has been up since start. -# TYPE total_predictor_up_for_hours counter -total_predictor_up_for_hours {_utils.GLOBAL_METRICS_INDEX["total_predictor_up_for_hours"]} - # HELP requests_received_in_last_x_seconds The number of requests received in last {_LAST_X_SECONDS} seconds. # TYPE requests_received_in_last_x_seconds gauge requests_received_in_last_x_seconds {requests_received_in_last_x_seconds} diff --git a/setup.py b/setup.py index 3b97640..6c0b705 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ EMAIL = "praneeth@bpraneeth.com" AUTHOR = "BEDAPUDI PRANEETH" REQUIRES_PYTHON = ">=3.6.0" -VERSION = "3.0.26" +VERSION = "3.0.27" # What packages are required for this module to be executed? REQUIRED = ["falcon", "liteindex==0.0.3.2.dev4", "zstandard", "gunicorn[gevent]", "msgpack"]