Skip to content

Commit

Permalink
Reduce WQE status mask && Include docs for elementsByWorkflow couch view
Browse files Browse the repository at this point in the history
  • Loading branch information
todor-ivanov committed Jan 31, 2025
1 parent 180e27d commit 2fa90a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/python/WMComponent/WorkflowUpdater/SiteListPoller.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def algorithm(self, parameters=None):
try:
# update local WorkQueue first
params = {'SiteWhitelist': siteWhiteList, 'SiteBlacklist': siteBlackList}
self.localWQ.updateElementsByWorkflow(wHelper, params, status=['Available', 'Negotiating', 'Acquired', 'Running'])
self.localWQ.updateElementsByWorkflow(wHelper, params, status=['Available'])
self.logger.info("successfully updated workqueue elements for workflow %s", wflow)
except Exception as ex:
logging.exception("Unexpected exception while updating elements in local workqueue Details:\n%s", str(ex))
Expand Down
14 changes: 5 additions & 9 deletions src/python/WMCore/Services/WorkQueue/WorkQueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,12 @@ def getWQElementsByWorkflow(self, workflowNames, inboxFlag=False):
options = {}
options["stale"] = "ok"
options["reduce"] = False
options['include_docs'] = True

wqeList = []
result = couchdb.loadView("WorkQueue", "elementsByWorkflow", options, workflowNames)

ids = []
for entry in result["rows"]:
ids.append(entry["id"])

for id in ids:
wqeList.append(couchdb.get(uri=f"/workqueue/_design/WorkQueue/_rewrite/element/{id}"))
data = couchdb.loadView("WorkQueue", "elementsByWorkflow", options, workflowNames)
wqeList=[]
for wqe in data['rows']:
wqeList.append(wqe['doc'])
return wqeList

def getElementsCountAndJobsByWorkflow(self, inboxFlag=False, stale=True):
Expand Down

0 comments on commit 2fa90a2

Please sign in to comment.