本文整理汇总了Python中Cobalt.Proxy.ComponentProxy.create_processgroup方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentProxy.create_processgroup方法的具体用法?Python ComponentProxy.create_processgroup怎么用?Python ComponentProxy.create_processgroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cobalt.Proxy.ComponentProxy
的用法示例。
在下文中一共展示了ComponentProxy.create_processgroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ComponentProxy
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import create_processgroup [as 别名]
if '-d' in sys.argv:
level = 10
Cobalt.Logging.setup_logging('cmd', to_syslog=False, level=0)
user = pwd.getpwuid(os.getuid())[0]
try:
pm = ComponentProxy("bbsystem", defer=False)
except ComponentLookupError:
print >> sys.stderr, "Failed to connect to bbsystem"
raise SystemExit(1)
spec = {'tag':'process-group', 'user':user, 'args':['--arg'], 'env':{"FOO":"bar"},
'executable':'/home/andrew/dev/testscript.py', 'size':700,
'cwd':'/tmp', 'location':'*', 'nodes':1,
'outputfile':'/tmp/test1-output',
'errorfile':'/tmp/test1-error', 'id': '*'}
try:
r = pm.create_processgroup(spec)
except NodeAllocationError:
print >> sys.stderr, "Failed to allocate nodes"
raise SystemExit(1)
print "jobs : " + `len(r)`
pgid = r[0]['id']
while True:
query = {'tag':'process-group', 'id':pgid, 'state':'*'}
r = pm.get_processgroup(query)
state = r[0]['state']
if state == 'finished':
break
else:
time.sleep(5)
print "process group %s has completed" % (pgid)