Skip to content

Commit

Permalink
fix: restored JobWrapper initialValues
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Mar 21, 2024
1 parent 7d419a7 commit 937c3b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/DIRAC/WorkloadManagementSystem/JobWrapper/Watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"]

Expand All @@ -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"]

Expand All @@ -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"]

Expand All @@ -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"]

Expand All @@ -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"]

Expand Down

0 comments on commit 937c3b7

Please sign in to comment.