From 47b9b41d72be79d11b73ed10fedf5172d6b193c5 Mon Sep 17 00:00:00 2001 From: aldbr Date: Fri, 10 Nov 2023 15:53:37 +0100 Subject: [PATCH] feat: add batchSystem type in jobParameters --- .../BatchSystems/TimeLeft/test/Test_PBSResourceUsage.py | 1 - .../BatchSystems/TimeLeft/test/Test_SGEResourceUsage.py | 2 +- .../Computing/BatchSystems/TimeLeft/test/Test_TimeLeft.py | 2 +- src/DIRAC/WorkloadManagementSystem/Agent/JobAgent.py | 3 +++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_PBSResourceUsage.py b/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_PBSResourceUsage.py index 0f08189a65d..30b2097f9bb 100644 --- a/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_PBSResourceUsage.py +++ b/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_PBSResourceUsage.py @@ -76,7 +76,6 @@ def test_getResourcUsage(mocker): side_effect=[S_OK(RRCKI_OUT)], ) mocker.patch("os.path.isfile", return_value=True) - mocker.patch.dict(os.environ, {"PBS_O_QUEUE": "lhcb", "PBS_O_QPATH": "/some/path"}) pbsRU = PBSResourceUsage("55755440.seer.t1.grid.kiae.ru", {"Queue": "lhcb", "BinaryPath": "/some/path"}) res = pbsRU.getResourceUsage() diff --git a/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_SGEResourceUsage.py b/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_SGEResourceUsage.py index 3aac6ddb5dc..70461e091c0 100644 --- a/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_SGEResourceUsage.py +++ b/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_SGEResourceUsage.py @@ -46,7 +46,7 @@ def test_getResourceUsage(mocker): return_value=S_OK(RESULT_FROM_SGE), ) - sgeResourceUsage = SGEResourceUsage() + sgeResourceUsage = SGEResourceUsage("1234", {"Queue": "Test"}) res = sgeResourceUsage.getResourceUsage() assert res["OK"] diff --git a/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_TimeLeft.py b/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_TimeLeft.py index 2a6f5e7fcac..1fb0df86b23 100644 --- a/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_TimeLeft.py +++ b/src/DIRAC/Resources/Computing/BatchSystems/TimeLeft/test/Test_TimeLeft.py @@ -24,7 +24,7 @@ def test_batchSystemNotDefined(mocker): tl.cpuPower = 10 res = tl.getTimeLeft() assert not res["OK"] - assert res["Message"] == "Current batch system is not supported" + assert res["Errno"] == 2002 def test_getScaledCPU(mocker): diff --git a/src/DIRAC/WorkloadManagementSystem/Agent/JobAgent.py b/src/DIRAC/WorkloadManagementSystem/Agent/JobAgent.py index a568bc957d3..ed796474f7e 100755 --- a/src/DIRAC/WorkloadManagementSystem/Agent/JobAgent.py +++ b/src/DIRAC/WorkloadManagementSystem/Agent/JobAgent.py @@ -285,6 +285,9 @@ def execute(self): if queue: self.jobReport.setJobParameter(par_name="CEQueue", par_value=queue, sendFlag=False) + if batchSystem := gConfig.getValue("/LocalSite/BatchSystem/Type", ""): + self.jobReport.setJobParameter(par_name="BatchSystem", par_value=batchSystem, sendFlag=False) + self.log.debug(f"Before self._submitJob() ({self.ceName}CE)") result = self._submitJob( jobID=jobID,