Skip to content

Commit 8e33649

Browse files
committed
fix: faster queries for DISTINCT values
1 parent d263910 commit 8e33649

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/DIRAC/WorkloadManagementSystem/Agent/JobCleaningAgent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def initialize(self):
8787

8888
def _getAllowedJobTypes(self):
8989
"""Get valid jobTypes"""
90-
result = self.jobDB.getDistinctJobAttributes("JobType")
90+
result = self.jobDB._query("SELECT DISTINCT JobType FROM JobsHistorySummary")
9191
if not result["OK"]:
9292
return result
9393
cleanJobTypes = []

src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_JobCleaningAgent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def jca(mocker):
2727
)
2828
mocker.patch("DIRAC.WorkloadManagementSystem.Agent.JobCleaningAgent.AgentModule.am_getOption", return_value=mockAM)
2929
mocker.patch(
30-
"DIRAC.WorkloadManagementSystem.Agent.JobCleaningAgent.JobDB.getDistinctJobAttributes", side_effect=mockReply
30+
"DIRAC.WorkloadManagementSystem.Agent.JobCleaningAgent.JobDB._query", side_effect=mockReply
3131
)
3232
mocker.patch("DIRAC.WorkloadManagementSystem.Agent.JobCleaningAgent.JobDB.selectJobs", side_effect=mockReply)
3333
mocker.patch("DIRAC.WorkloadManagementSystem.Agent.JobCleaningAgent.JobDB.__init__", side_effect=mockNone)

src/DIRAC/WorkloadManagementSystem/DB/JobDB.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ def getSiteSummary(self):
11971197
waitingList = ['"Submitted"', '"Assigned"', '"Waiting"', '"Matched"']
11981198
waitingString = ",".join(waitingList)
11991199

1200-
result = self.getDistinctJobAttributes("Site")
1200+
result = self._query("SELECT DISTINCT Site FROM JobsHistorySummary")
12011201
if not result["OK"]:
12021202
return result
12031203

0 commit comments

Comments
 (0)