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


Python ComponentProxy.get_queues方法代码示例

本文整理汇总了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)
开发者ID:yfan000,项目名称:cobalt,代码行数:28,代码来源:bgsched.py

示例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)
开发者ID:zzhou,项目名称:Qsim_Topology,代码行数:13,代码来源:bgsched.py

示例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)
开发者ID:zzhou,项目名称:Qsim_Topology,代码行数:14,代码来源:bgsched.py

示例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)
开发者ID:ido,项目名称:cobalt-svn-old,代码行数:19,代码来源:bgsched.py

示例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)
开发者ID:yfan000,项目名称:cobalt,代码行数:21,代码来源:bgsched.py

示例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:
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:partadm.py

示例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
开发者ID:wtangiit,项目名称:Qsim,代码行数:33,代码来源:qstat.py

示例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 = []
开发者ID:ido,项目名称:cobalt,代码行数:32,代码来源:cqstat.py

示例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
开发者ID:ido,项目名称:cobalt,代码行数:33,代码来源:qstat.py


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