From 98fc4f0fb9039f543d88e808ea82db82b3e8eb4d Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Wed, 20 Dec 2023 17:49:33 +0200 Subject: [PATCH] Add `agent.resource_monitoring.disk_use_path` configuration option to allow monitoring a different volume than the one containing the home folder --- clearml_agent/helper/resource_monitor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clearml_agent/helper/resource_monitor.py b/clearml_agent/helper/resource_monitor.py index df6ff76..c96a0a1 100644 --- a/clearml_agent/helper/resource_monitor.py +++ b/clearml_agent/helper/resource_monitor.py @@ -79,6 +79,7 @@ class ResourceMonitor(object): self._gpustat_fail = 0 self._gpustat = gpustat self._active_gpus = None + self._disk_use_path = str(session.config.get("agent.resource_monitoring.disk_use_path", None) or Path.home()) if not worker_tags and ENV_WORKER_TAGS.get(): worker_tags = shlex.split(ENV_WORKER_TAGS.get()) self._worker_tags = worker_tags @@ -242,7 +243,7 @@ class ResourceMonitor(object): virtual_memory = psutil.virtual_memory() stats["memory_used"] = BytesSizes.megabytes(virtual_memory.used) stats["memory_free"] = BytesSizes.megabytes(virtual_memory.available) - disk_use_percentage = psutil.disk_usage(Text(Path.home())).percent + disk_use_percentage = psutil.disk_usage(self._disk_use_path).percent stats["disk_free_percent"] = 100 - disk_use_percentage sensor_stat = ( psutil.sensors_temperatures()