From 937c3b73c1f90b30179a2d0df8a1ee912c762e11 Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Thu, 21 Mar 2024 10:10:02 +0100 Subject: [PATCH] fix: restored JobWrapper initialValues --- .../JobWrapper/Watchdog.py | 2 ++ .../JobWrapper/test/Test_JobWrapper.py | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/DIRAC/WorkloadManagementSystem/JobWrapper/Watchdog.py b/src/DIRAC/WorkloadManagementSystem/JobWrapper/Watchdog.py index 442206cd3db..ed514288158 100755 --- a/src/DIRAC/WorkloadManagementSystem/JobWrapper/Watchdog.py +++ b/src/DIRAC/WorkloadManagementSystem/JobWrapper/Watchdog.py @@ -718,6 +718,8 @@ def calibrate(self): self.initialValues["RSS"] = result["Value"] self.log.verbose("RSS(MB)", f"{result['Value']:.1f}") self.parameters["RSS"] = [] + self.initialValues["MemoryUsed"] = result["Value"] + self.parameters["MemoryUsed"] = [] # We exclude fuse so that mountpoints can be cleaned up by automount after a period unused # (specific request from CERN batch service). diff --git a/src/DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapper.py b/src/DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapper.py index 01b7311620f..4f292797a4f 100644 --- a/src/DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapper.py +++ b/src/DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapper.py @@ -4,20 +4,18 @@ import shutil import tempfile import time -import pytest from unittest.mock import MagicMock -from DIRAC import gLogger +import pytest + import DIRAC +from DIRAC import gLogger from DIRAC.Core.Utilities import DErrno -from DIRAC.Core.Utilities.ReturnValues import S_ERROR, S_OK - +from DIRAC.Core.Utilities.ReturnValues import S_ERROR from DIRAC.DataManagementSystem.Client.test.mock_DM import dm_mock from DIRAC.Resources.Catalog.test.mock_FC import fc_mock - +from DIRAC.WorkloadManagementSystem.Client import JobMinorStatus, JobStatus from DIRAC.WorkloadManagementSystem.JobWrapper.JobWrapper import JobWrapper -from DIRAC.WorkloadManagementSystem.JobWrapper.Watchdog import Watchdog -from DIRAC.WorkloadManagementSystem.Client import JobStatus, JobMinorStatus getSystemSectionMock = MagicMock() getSystemSectionMock.return_value = "aValue" @@ -196,7 +194,7 @@ def test_processSuccessfulCommand(mocker): assert result["Value"]["cpuTimeConsumed"][0] > 0 assert not result["Value"]["watchdogError"] assert "LastUpdateCPU(s)" in result["Value"]["watchdogStats"] - assert "MemoryUsed(kb)" in result["Value"]["watchdogStats"] + assert "MemoryUsed(MB)" in result["Value"]["watchdogStats"] @pytest.mark.slow @@ -254,7 +252,7 @@ def test_processFailedCommand(mocker): assert result["Value"]["cpuTimeConsumed"][0] > 0 assert not result["Value"]["watchdogError"] assert "LastUpdateCPU(s)" in result["Value"]["watchdogStats"] - assert "MemoryUsed(kb)" in result["Value"]["watchdogStats"] + assert "MemoryUsed(MB)" in result["Value"]["watchdogStats"] @pytest.mark.slow @@ -357,7 +355,7 @@ def set_param_side_effect(*args, **kwargs): "payloadExecutorError": None, "cpuTimeConsumed": [100, 200, 300, 400, 500], "watchdogError": None, - "watchdogStats": {"LastUpdateCPU(s)": "100", "MemoryUsed(kb)": "100"}, + "watchdogStats": {"LastUpdateCPU(s)": "100", "MemoryUsed(MB)": "100"}, } jw.executionResults["CPU"] = payloadResult["cpuTimeConsumed"] @@ -378,7 +376,7 @@ def set_param_side_effect(*args, **kwargs): "payloadExecutorError": None, "cpuTimeConsumed": [100, 200, 300, 400, 500], "watchdogError": None, - "watchdogStats": {"LastUpdateCPU(s)": "100", "MemoryUsed(kb)": "100"}, + "watchdogStats": {"LastUpdateCPU(s)": "100", "MemoryUsed(MB)": "100"}, } jw.executionResults["CPU"] = payloadResult["cpuTimeConsumed"] @@ -399,7 +397,7 @@ def set_param_side_effect(*args, **kwargs): "payloadExecutorError": None, "cpuTimeConsumed": [100, 200, 300, 400, 500], "watchdogError": None, - "watchdogStats": {"LastUpdateCPU(s)": "100", "MemoryUsed(kb)": "100"}, + "watchdogStats": {"LastUpdateCPU(s)": "100", "MemoryUsed(MB)": "100"}, } jw.executionResults["CPU"] = payloadResult["cpuTimeConsumed"] @@ -422,7 +420,7 @@ def set_param_side_effect(*args, **kwargs): "payloadExecutorError": None, "cpuTimeConsumed": [100, 200, 300, 400, 500], "watchdogError": None, - "watchdogStats": {"LastUpdateCPU(s)": "100", "MemoryUsed(kb)": "100"}, + "watchdogStats": {"LastUpdateCPU(s)": "100", "MemoryUsed(MB)": "100"}, } jw.executionResults["CPU"] = payloadResult["cpuTimeConsumed"] @@ -443,7 +441,7 @@ def set_param_side_effect(*args, **kwargs): "payloadExecutorError": None, "cpuTimeConsumed": [100, 200, 300, 400, 500], "watchdogError": "Watchdog error", - "watchdogStats": {"LastUpdateCPU(s)": "100", "MemoryUsed(kb)": "100"}, + "watchdogStats": {"LastUpdateCPU(s)": "100", "MemoryUsed(MB)": "100"}, } jw.executionResults["CPU"] = payloadResult["cpuTimeConsumed"]