当前位置: 首页>>代码示例>>Python>>正文


Python ComponentProxy.wait_process_groups方法代码示例

本文整理汇总了Python中Cobalt.Proxy.ComponentProxy.wait_process_groups方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentProxy.wait_process_groups方法的具体用法?Python ComponentProxy.wait_process_groups怎么用?Python ComponentProxy.wait_process_groups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cobalt.Proxy.ComponentProxy的用法示例。


在下文中一共展示了ComponentProxy.wait_process_groups方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1:

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import wait_process_groups [as 别名]
            
            # we'll give it 90 seconds to get started
            if time.time() - start > 90:
                break
            
            time.sleep(5)
        
        while True:
            r = system.get_process_groups([{'id':pgid, 'state':'*'}])
            if r and r[0]['state'] == 'running':
                time.sleep(5)
                continue
            else:
                break
        print "process group %s has completed" % (pgid)
        result = system.wait_process_groups([{'id':pgid, 'exit_status':'*'}])
        
        raise SystemExit, result[0].get('exit_status')
        

    except ComponentLookupError:
        logger.error("Trouble communicating with Cobalt components")
        raise SystemExit, 1
#    except xmlrpclib.Fault, flt:
#        if flt.faultCode == 31:
#            logger.error("System draining. Try again later")
#            raise SystemExit, 1
#        elif flt.faultCode == 30:
#            logger.error("Job submission failed because: \n%s\nCheck 'cqstat -q' and the cqstat manpage for more details." % flt.faultString)
#            raise SystemExit, 1
#        elif flt.faultCode == 1:
开发者ID:zzhou,项目名称:Qsim_PowerAware,代码行数:33,代码来源:cobalt-mpirun.py

示例2: ComponentProxy

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import wait_process_groups [as 别名]
"""Tests the pm functions"""

import optparse
import sys
import Cobalt
import Cobalt.Util
from Cobalt.Proxy import ComponentProxy
from Cobalt.Exceptions import ComponentLookupError

if __name__ == "__main__":
    p = optparse.OptionParser(usage="%prog [--wait]")
    p.add_option("--wait", action="store_true", dest="wait",
                 help="Wait on terminated processes")
    opt, args = p.parse_args()

    try:
        pm = ComponentProxy("system", defer=False)
    except ComponentLookupError:
        print >> sys.stderr, "Failed to connect to system"
        raise SystemExit(1)
    if opt.wait:
        pm.wait_process_groups([{"state":"terminated"}])
    pgroups = pm.get_process_groups([{"id":"*", "user":"*", "state":"*", "location":"*"}])
    header = [['Id', 'User', 'State', 'Location']]
    # build output list
    output = []
    for pg in pgroups:
        output.append([pg["id"], pg["user"], pg["state"], pg["location"]])
    Cobalt.Util.printTabular(header + output)
开发者ID:zzhou,项目名称:Qsim_PowerAware,代码行数:31,代码来源:pstat.py


注:本文中的Cobalt.Proxy.ComponentProxy.wait_process_groups方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。