本文整理汇总了Python中Cobalt.Proxy.ComponentProxy.get_queues方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentProxy.get_queues方法的具体用法?Python ComponentProxy.get_queues怎么用?Python ComponentProxy.get_queues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cobalt.Proxy.ComponentProxy
的用法示例。
在下文中一共展示了ComponentProxy.get_queues方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: q_add
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_queues [as 别名]
def q_add (self, *args, **kwargs):
'''Add a reservation to tracking.
Side Efffects:
-Add a queue to be tracked
-If no cqm associated queue, create a reservation queue
-set policies for new queue
-emit numerous creation messages
'''
qm = ComponentProxy("queue-manager")
try:
queues = [spec['name'] for spec in qm.get_queues([{'name':"*"}])]
except ComponentLookupError:
logger.error("unable to contact queue manager when adding reservation")
raise
try:
specs = args[0]
for spec in specs:
if "res_id" not in spec or spec['res_id'] == '*':
spec['res_id'] = bgsched_id_gen.get()
reservations = Cobalt.Data.DataDict.q_add(self, *args, **kwargs)
except KeyError, err:
raise ReservationError("Error: a reservation named %s already exists" % err)
示例2: q_del
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_queues [as 别名]
def q_del (self, *args, **kwargs):
reservations = Cobalt.Data.DataDict.q_del(self, *args, **kwargs)
qm = ComponentProxy('queue-manager')
queues = [spec['name'] for spec in qm.get_queues([{'name':"*"}])]
spec = [{'name': reservation.queue} for reservation in reservations \
if reservation.createdQueue and reservation.queue in queues and \
not self.q_get([{'queue':reservation.queue}])]
try:
qm.set_queues(spec, {'state':"dead"}, "bgsched")
except Exception, e:
logger.error("problem disabling reservation queue (%s)" % e)
示例3: q_add
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_queues [as 别名]
def q_add (self, *args, **kwargs):
qm = ComponentProxy(self.COMP_QUEUE_MANAGER)
try:
queues = [spec['name'] for spec in qm.get_queues([{'name':"*"}])]
except ComponentLookupError:
logger.error("unable to contact queue manager when adding reservation")
raise
try:
reservations = Cobalt.Data.DataDict.q_add(self, *args, **kwargs)
except KeyError, e:
raise ReservationError("Error: a reservation named %s already exists" % e)
示例4: q_add
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_queues [as 别名]
def q_add (self, *args, **kwargs):
qm = ComponentProxy("queue-manager")
try:
queues = [spec['name'] for spec in qm.get_queues([{'name':"*"}])]
except ComponentLookupError:
logger.error("unable to contact queue manager when adding reservation")
raise
try:
specs = args[0]
for spec in specs:
if "res_id" not in spec or spec['res_id'] == '*':
spec['res_id'] = bgsched_id_gen.get()
reservations = Cobalt.Data.DataDict.q_add(self, *args, **kwargs)
except KeyError, e:
raise ReservationError("Error: a reservation named %s already exists" % e)
示例5: q_del
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_queues [as 别名]
def q_del (self, *args, **kwargs):
'''Delete a reservation from tracking.
Side Effects: Removes a queue from tracking.
Logs that the reservation has terminated.
Emits a terminated database record
Attempts to mark the queue dead in the queue-manager.
Marks the reservation as dying
'''
reservations = Cobalt.Data.DataDict.q_del(self, *args, **kwargs)
qm = ComponentProxy('queue-manager')
queues = [spec['name'] for spec in qm.get_queues([{'name':"*"}])]
spec = [{'name': reservation.queue} for reservation in reservations \
if reservation.createdQueue and reservation.queue in queues \
and not self.q_get([{'queue':reservation.queue}])]
try:
qm.set_queues(spec, {'state':"dead"}, "bgsched")
except Exception, err:
logger.error("problem disabling reservation queue (%s)" % err)
示例6: component_call
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_queues [as 别名]
args = (opts.savestate,)
parts = component_call(system.save, args)
elif opts.list_blocks:
func = system.get_partitions
if sys_type == 'bgq':
args = ([{'name':'*', 'size':'*', 'state':'*', 'scheduled':'*', 'functional':'*',
'queue':'*', 'relatives':'*', 'passthrough_blocks':'*', 'node_geometry':'*'}], )
if sys_type == 'bgp':
args = ([{'name':'*', 'size':'*', 'state':'*', 'scheduled':'*', 'functional':'*',
'queue':'*', 'parents':'*', 'children':'*'}], )
parts = component_call(system.get_partitions, args)
elif opts.queue:
try:
cqm = ComponentProxy("queue-manager", defer=False)
existing_queues = [q.get('name') for q in cqm.get_queues([ \
{'tag':'queue', 'name':'*'}])]
except:
print "Error getting queues from queue_manager"
raise SystemExit, 1
error_messages = []
for q in opts.queue.split(':'):
if not q in existing_queues:
error_messages.append('\'' + q + '\' is not an existing queue')
if error_messages:
for e in error_messages:
print e
raise SystemExit, 1
args = ([{'tag':'partition', 'name':partname} for partname in parts],
{'queue':opts.queue}, whoami)
parts = component_call(system.set_partitions, args)
elif opts.dump:
示例7: ComponentProxy
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_queues [as 别名]
custom_header = os.environ['QSTAT_HEADER'].split(':')
if 'CQSTAT_HEADER_FULL' in os.environ.keys():
custom_header_full = os.environ['CQSTAT_HEADER_FULL'].split(':')
elif 'QSTAT_HEADER_FULL' in os.environ.keys():
custom_header_full = os.environ['QSTAT_HEADER_FULL'].split(':')
if opts['header']:
custom_header = opts['header'].split(':')
try:
cqm = ComponentProxy("queue-manager", defer=False)
except ComponentLookupError:
print >> sys.stderr, "Failed to connect to queue manager"
sys.exit(2)
try:
queues = cqm.get_queues([{'name':"*", 'state':"*"}])
except:
print >> sys.stderr, "Failed to get queue list from queue manager"
sys.exit(2)
level = 30
if opts['debug']:
level = 10
if opts['version']:
print "qstat %s" % __revision__
sys.exit(0)
Cobalt.Logging.setup_logging('qstat', to_syslog=False, level=level)
jobid = None
示例8:
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_queues [as 别名]
user_name = '*'
if opts['user']:
user_name = opts['user']
if opts['q']: # querying for queues
query = [{'name' :qname, 'users':'*', 'groups':'*',
'mintime':'*', 'maxtime':'*', 'maxrunning':'*',
'maxqueued':'*', 'maxusernodes':'*',
'maxnodehours': '*',
'totalnodes':'*', 'state':'*', 'priority':'*'} for qname in names]
header = ['Name', 'State', 'Users', 'Groups', 'MinTime', 'MaxTime',
'MaxRunning', 'MaxQueued', 'MaxUserNodes',
'MaxNodeHours',
'TotalNodes', 'Priority']
response = cqm.get_queues(query)
else:
if opts['full'] and opts['long']:
header = long_header
elif opts['full'] and custom_header_full:
header = custom_header_full
elif opts['full'] and not opts['long']:
header = full_header
elif custom_header:
header = custom_header
else:
header = default_header
# build query from long_header (all fields) and fetch response
try:
query = []
示例9: ComponentProxy
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_queues [as 别名]
custom_header = os.environ["QSTAT_HEADER"].split(":")
if "CQSTAT_HEADER_FULL" in os.environ.keys():
custom_header_full = os.environ["CQSTAT_HEADER_FULL"].split(":")
elif "QSTAT_HEADER_FULL" in os.environ.keys():
custom_header_full = os.environ["QSTAT_HEADER_FULL"].split(":")
if opts["header"]:
custom_header = opts["header"].split(":")
try:
cqm = ComponentProxy("queue-manager", defer=False)
except ComponentLookupError:
print >> sys.stderr, "Failed to connect to queue manager"
sys.exit(2)
try:
queues = cqm.get_queues([{"name": "*", "state": "*"}])
except:
print >> sys.stderr, "Failed to get queue list from queue manager"
sys.exit(2)
level = 30
if opts["debug"]:
level = 10
if opts["version"]:
print "qstat %s" % __revision__
sys.exit(0)
Cobalt.Logging.setup_logging("qstat", to_syslog=False, level=level)
jobid = None