Skip to content

Commit 57245b6

Browse files
committed
fix: much faster query of selectors for web
1 parent e70fdf2 commit 57245b6

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/DIRAC/MonitoringSystem/Service/WebAppHandler.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -336,25 +336,25 @@ def export_getSiteSummarySelectors(cls):
336336
types_getApplicationStates = []
337337

338338
@classmethod
339-
def export_getApplicationStates(cls, condDict=None, older=None, newer=None):
339+
def export_getApplicationStates(cls):
340340
"""Return Distinct Values of ApplicationStatus job Attribute in WMS"""
341-
return cls.jobDB.getDistinctJobAttributes("ApplicationStatus", condDict, older, newer)
341+
return cls.jobDB._query("SELECT DISTINCT ApplicationStatus FROM JobsHistorySummary")
342342

343343
types_getJobTypes = []
344344

345345
@classmethod
346-
def export_getJobTypes(cls, condDict=None, older=None, newer=None):
346+
def export_getJobTypes(cls):
347347
"""Return Distinct Values of JobType job Attribute in WMS"""
348-
return cls.jobDB.getDistinctJobAttributes("JobType", condDict, older, newer)
348+
return cls.jobDB._query("SELECT DISTINCT JobType FROM JobsHistorySummary")
349349

350350
types_getOwners = []
351351

352352
@classmethod
353-
def export_getOwners(cls, condDict=None, older=None, newer=None):
353+
def export_getOwners(cls):
354354
"""
355355
Return Distinct Values of Owner job Attribute in WMS
356356
"""
357-
return cls.jobDB.getDistinctJobAttributes("Owner", condDict, older, newer)
357+
return cls.jobDB._query("SELECT DISTINCT Owner FROM JobsHistorySummary")
358358

359359
types_getOwnerGroup = []
360360

@@ -363,43 +363,43 @@ def export_getOwnerGroup(cls):
363363
"""
364364
Return Distinct Values of OwnerGroup from the JobDB
365365
"""
366-
return cls.jobDB.getDistinctJobAttributes("OwnerGroup")
366+
return cls.jobDB._query("SELECT DISTINCT OwnerGroup FROM JobsHistorySummary")
367367

368368
types_getJobGroups = []
369369

370370
@classmethod
371-
def export_getJobGroups(cls, condDict=None, older=None, cutDate=None):
371+
def export_getJobGroups(cls):
372372
"""
373373
Return Distinct Values of ProductionId job Attribute in WMS
374374
"""
375-
return cls.jobDB.getDistinctJobAttributes("JobGroup", condDict, older, newer=cutDate)
375+
return cls.jobDB._query("SELECT DISTINCT JobGroup FROM JobsHistorySummary")
376376

377377
types_getSites = []
378378

379379
@classmethod
380-
def export_getSites(cls, condDict=None, older=None, newer=None):
380+
def export_getSites(cls):
381381
"""
382382
Return Distinct Values of Site job Attribute in WMS
383383
"""
384-
return cls.jobDB.getDistinctJobAttributes("Site", condDict, older, newer)
384+
return cls.jobDB._query("SELECT DISTINCT Site FROM JobsHistorySummary")
385385

386386
types_getStates = []
387387

388388
@classmethod
389-
def export_getStates(cls, condDict=None, older=None, newer=None):
389+
def export_getStates(cls):
390390
"""
391391
Return Distinct Values of Status job Attribute in WMS
392392
"""
393-
return cls.jobDB.getDistinctJobAttributes("Status", condDict, older, newer)
393+
return cls.jobDB._query("SELECT DISTINCT Status FROM JobsHistorySummary")
394394

395395
types_getMinorStates = []
396396

397397
@classmethod
398-
def export_getMinorStates(cls, condDict=None, older=None, newer=None):
398+
def export_getMinorStates(cls):
399399
"""
400400
Return Distinct Values of Minor Status job Attribute in WMS
401401
"""
402-
return cls.jobDB.getDistinctJobAttributes("MinorStatus", condDict, older, newer)
402+
return cls.jobDB._query("SELECT DISTINCT MinorStatus FROM JobsHistorySummary")
403403

404404
##############################################################################
405405
# Transformations

src/DIRAC/WorkloadManagementSystem/DB/JobDB.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def __getAttributeNames(self):
107107
def getDistinctJobAttributes(self, attribute, condDict=None, older=None, newer=None, timeStamp="LastUpdateTime"):
108108
"""Get distinct values of the job attribute under specified conditions"""
109109
return self.getDistinctAttributeValues(
110-
"JobsHistorySummary", attribute, condDict=condDict, older=older, newer=newer, timeStamp=timeStamp
110+
"Jobs", attribute, condDict=condDict, older=older, newer=newer, timeStamp=timeStamp
111111
)
112112

113113
#############################################################################

0 commit comments

Comments
 (0)