Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-20 07:59:01

0001 #
0002 # This file is used to call the dbproxy and get the list of all jobs in the database
0003 #
0004 import logging
0005 import os
0006 import sys
0007 
0008 from pandaharvester.harvestercore.db_proxy_pool import DBProxyPool as DBProxy
0009 from pandaharvester.harvestercore.queue_config_mapper import QueueConfigMapper
0010 
0011 for loggerName, loggerObj in logging.Logger.manager.loggerDict.items():
0012     if loggerName.startswith("panda.log"):
0013         if len(loggerObj.handlers) == 0:
0014             continue
0015         if loggerName.split(".")[-1] in ["db_proxy"]:
0016             continue
0017         stdoutHandler = logging.StreamHandler(sys.stdout)
0018         stdoutHandler.setFormatter(loggerObj.handlers[0].formatter)
0019         loggerObj.addHandler(stdoutHandler)
0020 
0021 queueName = sys.argv[1]
0022 queueConfigMapper = QueueConfigMapper()
0023 queueConfig = queueConfigMapper.get_queue(queueName)
0024 
0025 proxy = DBProxy()
0026 
0027 # get all jobs in table
0028 print("try to get all jobs")
0029 alljobs = proxy.get_jobs()
0030 print(f"got {len(alljobs)} jobs")
0031 # loop over all found jobs
0032 if len(alljobs) > 0:
0033     for jobSpec in alljobs:
0034         print(" PandaID = %d status = %s subStatus = %s lockedBy = %s" % (jobSpec.PandaID, jobSpec.status, jobSpec.subStatus, jobSpec.lockedBy))