Skip to content

Commit

Permalink
fix: removed deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Jun 27, 2024
1 parent c9336a7 commit c2a033f
Showing 1 changed file with 2 additions and 62 deletions.
64 changes: 2 additions & 62 deletions src/DIRAC/WorkloadManagementSystem/DB/JobDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from DIRAC.Core.Base.DB import DB
from DIRAC.Core.Utilities import DErrno
from DIRAC.Core.Utilities.ClassAd.ClassAdLight import ClassAd
from DIRAC.Core.Utilities.Decorators import deprecated
from DIRAC.Core.Utilities.DErrno import EWMSJMAN, EWMSSUBM, cmpError
from DIRAC.Core.Utilities.ReturnValues import S_ERROR, S_OK
from DIRAC.ResourceStatusSystem.Client.SiteStatus import SiteStatus
Expand Down Expand Up @@ -264,6 +265,7 @@ def getJobAttribute(self, jobID, attribute):
return S_OK(result["Value"].get(attribute))

#############################################################################
@deprecated("Use JobParametersDB instead")
def getJobParameter(self, jobID, parameter):
"""Get the given parameter of a job specified by its jobID"""

Expand Down Expand Up @@ -668,50 +670,6 @@ def setStartExecTime(self, jobID, startDate=None):
req = f"UPDATE Jobs SET StartExecTime={startDate} WHERE JobID={jobID} AND StartExecTime IS NULL"
return self._update(req)

#############################################################################
def setJobParameter(self, jobID, key, value):
"""Set a parameter specified by name,value pair for the job JobID"""

ret = self._escapeString(key)
if not ret["OK"]:
return ret
e_key = ret["Value"]
ret = self._escapeString(value)
if not ret["OK"]:
return ret
e_value = ret["Value"]

cmd = "REPLACE JobParameters (JobID,Name,Value) VALUES (%d,%s,%s)" % (int(jobID), e_key, e_value)
return self._update(cmd)

#############################################################################
def setJobParameters(self, jobID, parameters):
"""Set parameters specified by a list of name/value pairs for the job JobID
:param int jobID: Job ID
:param list parameters: list of tuples (name, value) pairs
:return: S_OK/S_ERROR
"""

if not parameters:
return S_OK()

insertValueList = []
for name, value in parameters:
ret = self._escapeString(name)
if not ret["OK"]:
return ret
e_name = ret["Value"]
ret = self._escapeString(value)
if not ret["OK"]:
return ret
e_value = ret["Value"]
insertValueList.append(f"({jobID},{e_name},{e_value})")

cmd = f"REPLACE JobParameters (JobID,Name,Value) VALUES {', '.join(insertValueList)}"
return self._update(cmd)

#############################################################################
def setJobOptParameter(self, jobID, name, value):
"""Set an optimzer parameter specified by name,value pair for the job JobID"""
Expand Down Expand Up @@ -780,15 +738,6 @@ def setAtticJobParameter(self, jobID, key, value, rescheduleCounter):
)
return self._update(cmd)

#############################################################################
def __setInitialJobParameters(self, classadJob, jobID):
"""Set initial job parameters as was defined in the Classad"""

# Extract initital job parameters
parameters = {}
if classadJob.lookupAttribute("Parameters"):
parameters = classadJob.getDictionaryFromSubJDL("Parameters")
return self.setJobParameters(jobID, list(parameters.items()))

#############################################################################
def setJobJDL(self, jobID, jdl=None, originalJDL=None):
Expand Down Expand Up @@ -969,11 +918,6 @@ def insertNewJobIntoDB(
if not result["OK"]:
return result

# Setting the Job parameters
result = self.__setInitialJobParameters(classAdJob, jobID)
if not result["OK"]:
return result

# Looking for the Input Data
inputData = []
if classAdJob.lookupAttribute("InputData"):
Expand Down Expand Up @@ -1205,10 +1149,6 @@ def rescheduleJob(self, jobID):
if not result["OK"]:
return result

result = self.__setInitialJobParameters(classAdJob, jobID)
if not result["OK"]:
return result

result = self.setJobAttributes(jobID, list(jobAttrs), list(jobAttrs.values()), force=True)
if not result["OK"]:
return result
Expand Down

0 comments on commit c2a033f

Please sign in to comment.