From 1f24c33d673bfc8223976a09cae64adc2dd71f5a Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Tue, 20 Aug 2024 15:35:18 +0200 Subject: [PATCH] fix: JobState does not need to push JobParameters --- .../Client/JobState/JobState.py | 10 +--------- .../WorkloadManagementSystem/DB/JobParametersDB.py | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/DIRAC/WorkloadManagementSystem/Client/JobState/JobState.py b/src/DIRAC/WorkloadManagementSystem/Client/JobState/JobState.py index 7a80d9f17bb..8280b6abe4a 100644 --- a/src/DIRAC/WorkloadManagementSystem/Client/JobState/JobState.py +++ b/src/DIRAC/WorkloadManagementSystem/Client/JobState/JobState.py @@ -5,7 +5,6 @@ from DIRAC.WorkloadManagementSystem.Client.JobState.JobManifest import JobManifest from DIRAC.WorkloadManagementSystem.DB.JobDB import JobDB from DIRAC.WorkloadManagementSystem.DB.JobLoggingDB import JobLoggingDB -from DIRAC.WorkloadManagementSystem.DB.JobParametersDB import JobParametersDB from DIRAC.WorkloadManagementSystem.DB.TaskQueueDB import TaskQueueDB, multiValueDefFields, singleValueDefFields from DIRAC.WorkloadManagementSystem.Service.JobPolicy import ( RIGHT_CHANGE_STATUS, @@ -26,7 +25,6 @@ def reset(self): self.jobDB = None self.logDB = None self.tqDB = None - self.jobParametersDB = None __db = DBHold() @@ -38,7 +36,6 @@ def checkDBAccess(cls): JobState.__db.jobDB = JobDB() JobState.__db.logDB = JobLoggingDB() JobState.__db.tqDB = TaskQueueDB() - JobState.__db.jpDB = JobParametersDB() def __init__(self, jid): self.__jid = jid @@ -103,7 +100,7 @@ def commitCache(self, initialState, cache, jobLog): return S_OK(False) gLogger.verbose(f"Job {self.__jid}: About to execute trace. Current state {initialState}") - data = {"att": [], "jobp": [], "optp": []} + data = {"att": [], "optp": []} for key in cache: for dk in data: if key.find(f"{dk}.") == 0: @@ -118,11 +115,6 @@ def commitCache(self, initialState, cache, jobLog): if not result["OK"]: return result - if data["jobp"]: - result = self.__retryFunction(5, JobState.__db.jpDB.setJobParameters, (self.__jid, data["jobp"])) - if not result["OK"]: - return result - for k, v in data["optp"]: result = self.__retryFunction(5, JobState.__db.jobDB.setJobOptParameter, (self.__jid, k, v)) if not result["OK"]: diff --git a/src/DIRAC/WorkloadManagementSystem/DB/JobParametersDB.py b/src/DIRAC/WorkloadManagementSystem/DB/JobParametersDB.py index c36ea010f71..84b9d9afbde 100644 --- a/src/DIRAC/WorkloadManagementSystem/DB/JobParametersDB.py +++ b/src/DIRAC/WorkloadManagementSystem/DB/JobParametersDB.py @@ -43,8 +43,8 @@ def __init__(self, parentLogger=None): try: # Connecting to the ES cluster super().__init__(self.fullname, self.index_name, parentLogger=parentLogger) - except Exception as ex: - RuntimeError("Can't connect to JobParameters index") from ex + except Exception: + RuntimeError("Can't connect to JobParameters index") self.addIndexTemplate("elasticjobparametersdb", index_patterns=[f"{self.index_name}_*"], mapping=mapping) def _indexName(self, jobID: int, vo: str) -> str: