Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-19 08:00:04

0001 import types
0002 
0003 from pandaharvester.harvestercore.queue_config_mapper import QueueConfigMapper
0004 
0005 qcm = QueueConfigMapper(update_db=False)
0006 
0007 
0008 def list_active_queues():
0009     """list all active queue names"""
0010     qs = qcm.get_active_queues()
0011     ks = sorted(qs.keys())
0012     for k in ks:
0013         print(k)
0014 
0015 
0016 def list_config_ids():
0017     """list all configIDs and queue names"""
0018     qs = qcm.get_all_queues_with_config_ids()
0019     ks = sorted(qs.keys())
0020     print("configID : queue name")
0021     print("--------- ------------")
0022     for k in ks:
0023         print(f"{k:8} : {qs[k].queueName}")
0024 
0025 
0026 def dump_active_queue(name, to_print=True):
0027     """dump configuration of an active queue with name"""
0028     if not qcm.has_queue(name):
0029         print(f"ERROR : {name} is not available")
0030         return
0031     q = qcm.get_queue(name)
0032     if to_print:
0033         print(q)
0034     else:
0035         return q
0036 
0037 
0038 def dump_all_active_queues(to_print=True):
0039     """dump configuration of all active queues"""
0040     qs = qcm.get_active_queues()
0041     if to_print:
0042         ks = sorted(qs.keys())
0043         for k in ks:
0044             print(qs[k])
0045     else:
0046         return list(qs.values())
0047 
0048 
0049 def dump_queue_with_config_id(config_id, to_print=True):
0050     """dump configuration of a queue with configID"""
0051     if not qcm.has_queue(None, config_id):
0052         print(f"ERROR : configID={config_id} is not available")
0053         return
0054     q = qcm.get_queue(None, config_id)
0055     if to_print:
0056         print(q)
0057     else:
0058         return q
0059 
0060 
0061 def help(o=None):
0062     """help() to list all functions. help(func_name) for the function"""
0063     if o is not None:
0064         __builtins__.help(o)
0065     else:
0066         maxLen = len(max(globals(), key=len))
0067         print(("{0:" + str(maxLen) + "} : {1}").format("function name", "description"))
0068         print("-" * maxLen + "- -" + "-" * maxLen)
0069         for i in sorted(globals()):
0070             v = globals()[i]
0071             if isinstance(v, types.FunctionType):
0072                 print(("{0:" + str(maxLen) + "} : {1}").format(i, v.__doc__))