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


Python ComponentProxy.set_jobs方法代码示例

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


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

示例1: str

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_jobs [as 别名]
#            for c in copy:
#                c['state'] = 'user hold'
#            spec += copy
        if opts['queue']:
            updates['queue'] = opts['queue']
        if opts['index']:
            updates['index'] = opts['index']
        if opts['time']:
            try:
                minutes = Cobalt.Util.get_time(opts['time'])
            except Cobalt.Exceptions.TimeFormatError, e:
                print "invalid time specification: %s" % e.args[0]
                sys.exit(1)
            updates['walltime'] = str(minutes)
        try:
            response = []
            if updates:
                response = cqm.set_jobs(spec, updates, whoami)
        except xmlrpclib.Fault, flt:
            response = []
            if flt.faultCode == 30 or flt.faultCode == 42:
                print flt.faultString
                raise SystemExit, 1
            else:
                print flt.faultString
                raise SystemExit, 1
    if not response:
        Cobalt.Logging.logging.error("Failed to match any jobs or queues")
    else:
        Cobalt.Logging.logging.debug(response)
开发者ID:zzhou,项目名称:Qsim_PowerAware,代码行数:32,代码来源:cqadm.py

示例2:

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_jobs [as 别名]
    except ConfigParser.NoOptionError:
        filters = []

    try:
        jobdata = cqm.get_jobs(spec)
    except xmlrpclib.Fault, flt:
        print flt.faultString
        raise SystemExit, 1

    if not jobdata:
        print "Failed to match any jobs"
        sys.exit(1)

    response = []
    for jobinfo in jobdata:
        original_spec = jobinfo.copy()
        jobinfo.update({'queue': queue})
        for filt in filters:
            Cobalt.Util.processfilter(filt, jobinfo)
        try:
            [job] = cqm.set_jobs([original_spec], jobinfo, user)
            response.append("moved job %d to queue '%s'" % (job.get('jobid'), job.get('queue')))
        except xmlrpclib.Fault, flt:
            response.append(flt.faultString)

    if not response:
        logger.error("Failed to match any jobs or queues")
    else:
        logger.debug(response)
        for line in response:
            print line
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:33,代码来源:qmove.py

示例3: list

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_jobs [as 别名]
        check_response = cqm.get_jobs(check_specs)
    except xmlrpclib.Fault, flt:
        print flt.faultString
        raise SystemExit, 1

    jobs_existed = [j.get('jobid') for j in check_response]
    all_jobs = all_jobs.union(set(jobs_existed))
    update_specs = [{'tag':'job', 'user':user, 'jobid':jobid, 'user_hold':"*", 'is_active':"*"} for jobid in jobs_existed]
    
    if opt.deps:
        updates = {'all_dependencies': []}
    else:
        updates = {'user_hold':False}

    try:
        update_response = cqm.set_jobs(update_specs, updates, user)
    except xmlrpclib.Fault, flt:
        print flt.faultString
        raise SystemExit, 1
    
    if opt.deps:
        print "   Removed dependencies from jobs: "
        for j in update_response:
            print "      %s" % j.get("jobid")
        sys.exit(0)

    jobs_found = [j.get('jobid') for j in update_response]
    jobs_not_found = list(all_jobs.difference(set(jobs_existed)))
    jobs_completed = [j.get('jobid') for j in update_response if j.get('has_completed')] + \
        list(set(jobs_existed).difference(set(jobs_found)))
    jobs_had_hold = [j.get('jobid') for j in check_response if j.get('user_hold') and j.get('jobid') in jobs_found]
开发者ID:zzhou,项目名称:Qsim_PowerAware,代码行数:33,代码来源:qrls.py


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