From f62d559b6ed58a15ed098afa11fe91607adef8fb Mon Sep 17 00:00:00 2001 From: Siddhant Sadangi Date: Mon, 19 Aug 2024 16:12:00 +0200 Subject: [PATCH] chore: Fixed tests --- src/neptune/common/hardware/gpu/gpu_monitor.py | 2 +- .../legacy/internal/hardware/gauges/test_gpu_gauges.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/neptune/common/hardware/gpu/gpu_monitor.py b/src/neptune/common/hardware/gpu/gpu_monitor.py index e67dd4eee..8c0007824 100644 --- a/src/neptune/common/hardware/gpu/gpu_monitor.py +++ b/src/neptune/common/hardware/gpu/gpu_monitor.py @@ -46,7 +46,7 @@ def get_card_used_memory_in_bytes(self, card_index): return self.__nvml_get_or_else(lambda: nvmlDeviceGetMemoryInfo(nvmlDeviceGetHandleByIndex(card_index)).used) def get_card_power_usage(self, card_index): - return self.__nvml_get_or_else(lambda: nvmlDeviceGetPowerUsage(nvmlDeviceGetHandleByIndex(card_index))) + return self.__nvml_get_or_else(lambda: nvmlDeviceGetPowerUsage(nvmlDeviceGetHandleByIndex(card_index)).used) def get_card_max_power_rating(self): def read_max_power_rating(): diff --git a/tests/unit/neptune/legacy/internal/hardware/gauges/test_gpu_gauges.py b/tests/unit/neptune/legacy/internal/hardware/gauges/test_gpu_gauges.py index be691dabd..d200fc596 100644 --- a/tests/unit/neptune/legacy/internal/hardware/gauges/test_gpu_gauges.py +++ b/tests/unit/neptune/legacy/internal/hardware/gauges/test_gpu_gauges.py @@ -20,7 +20,10 @@ patch, ) -from neptune.common.hardware.constants import BYTES_IN_ONE_GB +from neptune.common.hardware.constants import ( + BYTES_IN_ONE_GB, + MILLIWATTS_IN_ONE_WATT, +) from neptune.common.hardware.gauges.gpu import ( GpuMemoryGauge, GpuPowerGauge, @@ -79,7 +82,7 @@ def test_gpu_power_gauge(self, nvmlDeviceGetPowerUsage): gauge = GpuPowerGauge(card_index=self.card_index) # and gpu_power_info = MagicMock() - gpu_power_info.used = 15.0 + gpu_power_info.used = 15.0 * MILLIWATTS_IN_ONE_WATT nvmlDeviceGetPowerUsage.side_effect = lambda handle: ( gpu_power_info if handle == self.gpu_card_handle else None )