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


Python ComponentProxy.get_process_groups方法代码示例

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


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

示例1: ComponentProxy

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_process_groups [as 别名]
               'walltime':j['walltime'], 'args':[], 'location':j['location'], 'outputdir':j['outputdir'], }
    for key in io_redirect:
        if io_redirect[key]:
            jobspec.update({key: io_redirect[key]})
               
    try:
        scriptm = ComponentProxy("script-manager", defer=False)
        system = ComponentProxy("system", defer=False)

        # try adding job to queue_manager
        pgid = int(scriptm.invoke_mpi_from_script(jobspec))
        
        # give the process a chance to get started before we check for it
        start = time.time()
        while True:
            r = system.get_process_groups([{'id':pgid, 'state':'*'}])
            if r:
                break
            
            # 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:
开发者ID:zzhou,项目名称:Qsim_PowerAware,代码行数:33,代码来源:cobalt-mpirun.py

示例2: ComponentProxy

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_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.get_process_groups方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。