Skip to content

Commit 5aea4d7

Browse files
committed
fix: fixed some old non-sense
1 parent 54eb7c5 commit 5aea4d7

File tree

2 files changed

+19
-36
lines changed

2 files changed

+19
-36
lines changed

src/DIRAC/MonitoringSystem/Service/WebAppHandler.py

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,9 @@ def export_getJobPageSummaryWeb(self, selectDict, sortList, startItem, maxItems,
188188
)
189189
summaryJobList = validJobs
190190

191-
res = self.jobDB.getJobsAttributes(summaryJobList)
192-
if not res["OK"]:
193-
return res
194-
return S_OK(strToIntDict(res["Value"]))
191+
result = self.jobDB.getJobsAttributes(summaryJobList)
192+
if not result["OK"]:
193+
return result
195194

196195
summaryDict = result["Value"]
197196
# If no jobs can be selected after the properties check
@@ -352,14 +351,9 @@ def export_getDistinctAttributeValues(cls, attribute, selectDict):
352351

353352
@classmethod
354353
def export_getTransformationFilesSummaryWeb(cls, selectDict, sortList, startItem, maxItems):
355-
selectColumns = (["TransformationID", "Status", "UsedSE", "TargetSE"],)
356-
timeStamp = ("LastUpdate",)
357-
statusColumn = ("Status",)
358354
fromDate = selectDict.get("FromDate", None)
359355
if fromDate:
360356
del selectDict["FromDate"]
361-
# if not fromDate:
362-
# fromDate = last_update
363357
toDate = selectDict.get("ToDate", None)
364358
if toDate:
365359
del selectDict["ToDate"]
@@ -369,26 +363,21 @@ def export_getTransformationFilesSummaryWeb(cls, selectDict, sortList, startItem
369363
else:
370364
orderAttribute = None
371365
# Get the columns that match the selection
372-
fcn = None
373-
fcnName = "getTransformationFiles"
374-
if hasattr(cls.transformationDB, fcnName) and callable(getattr(cls.transformationDB, fcnName)):
375-
fcn = getattr(cls.transformationDB, fcnName)
376-
if not fcn:
377-
return S_ERROR(f"Unable to invoke gTransformationDB.{fcnName}, it isn't a member function")
378-
res = fcn(condDict=selectDict, older=toDate, newer=fromDate, timeStamp=timeStamp, orderAttribute=orderAttribute)
366+
res = cls.transformationDB.getTransformationFiles(
367+
condDict=selectDict, older=toDate, newer=fromDate, timeStamp="LastUpdate", orderAttribute=orderAttribute
368+
)
379369
if not res["OK"]:
380370
return res
381-
382-
# The full list of columns in contained here
383371
allRows = res["Value"]
372+
384373
# Prepare the standard structure now within the resultDict dictionary
385374
resultDict = {}
386-
# Create the total records entry
387375
resultDict["TotalRecords"] = len(allRows)
388376

389-
# Get the rows which are within the selected window
390-
if resultDict["TotalRecords"] == 0:
377+
if not allRows:
391378
return S_OK(resultDict)
379+
380+
# Get the rows which are within the selected window
392381
ini = startItem
393382
last = ini + maxItems
394383
if ini >= resultDict["TotalRecords"]:
@@ -403,25 +392,25 @@ def export_getTransformationFilesSummaryWeb(cls, selectDict, sortList, startItem
403392

404393
# Create the ParameterNames entry
405394
resultDict["ParameterNames"] = list(selectedRows[0].keys())
406-
# Find which element in the tuple contains the requested status
407-
if statusColumn not in resultDict["ParameterNames"]:
408-
return S_ERROR("Provided status column not present")
409395

410396
# Generate the status dictionary
411397
statusDict = {}
412398
for row in selectedRows:
413-
status = row[statusColumn]
399+
status = row["Status"]
414400
statusDict[status] = statusDict.setdefault(status, 0) + 1
415401
resultDict["Extras"] = statusDict
416402

417403
# Obtain the distinct values of the selection parameters
418404
res = cls.transformationDB.getTableDistinctAttributeValues(
419-
"TransformationFiles", selectColumns, selectDict, older=toDate, newer=fromDate
405+
"TransformationFiles",
406+
["TransformationID", "Status", "UsedSE", "TargetSE"],
407+
selectDict,
408+
older=toDate,
409+
newer=fromDate,
420410
)
421-
distinctSelections = zip(selectColumns, [])
422-
if res["OK"]:
423-
distinctSelections = res["Value"]
424-
resultDict["Selections"] = distinctSelections
411+
if not res["OK"]:
412+
return res
413+
resultDict["Selections"] = res["Value"]
425414

426415
return S_OK(resultDict)
427416

tests/Integration/FutureClient/WorkloadManagement/Test_JobMonitoring.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,6 @@ def test_getJobSite():
108108
pytest.skip()
109109

110110

111-
def test_getJobStats():
112-
# JobMonitoringClient().getJobStats(attribute: str, selectDict: dict)
113-
method = JobMonitoringClient().getJobStats
114-
pytest.skip()
115-
116-
117111
def test_getJobSummary():
118112
# JobMonitoringClient().getJobSummary(jobID: int)
119113
method = JobMonitoringClient().getJobSummary

0 commit comments

Comments
 (0)