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


Python ComponentProxy.set_queues方法代码示例

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


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

示例1: update

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_queues [as 别名]
    def update (self, spec):
        if spec.has_key("users"):
            qm = ComponentProxy("queue-manager")
            try:
                qm.set_queues([{'name':self.queue,}], {'users':spec['users']}, "bgsched")
            except ComponentLookupError:
                logger.error("unable to contact queue manager when updating reservation users")
                raise
        # try the above first -- if we can't contact the queue-manager, don't update the users
        if spec.has_key('cycle') and not self.cycle:
            #we have just turned this into a cyclic reservation and need a cycle_id.
            spec['cycle_id'] = self.cycle_id_gen.get()
        #get the user name of whoever issued the command
        user_name = None
        if spec.has_key('__cmd_user'):
            user_name = spec['__cmd_user']
            del spec['__cmd_user']

        #if we're defering, pull out the 'defer' entry and send a cobalt db message.
        #there really isn't a corresponding field to update
        deferred = False
        if spec.has_key('defer'):
            logger.info("Res %s/%s: Deferring cyclic reservation: %s",
                        self.res_id, self.cycle_id, self.name) 
            dbwriter.log_to_db(user_name, "deferred", "reservation", self)
            del spec['defer']
            deferred = True

        Data.update(self, spec)

        if not deferred or not self.running:
            #we only want this if we aren't defering.  If we are, the cycle will 
            #take care of the new data object creation.
            dbwriter.log_to_db(user_name, "modifying", "reservation", self)
开发者ID:ido,项目名称:cobalt-svn-old,代码行数:36,代码来源:bgsched.py

示例2: update

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_queues [as 别名]
 def update (self, spec):
     if spec.has_key("users"):
         qm = ComponentProxy(self.COMP_QUEUE_MANAGER)
         try:
             qm.set_queues([{'name':self.queue,}], {'users':spec['users']}, "bgsched")
         except ComponentLookupError:
             logger.error("unable to contact queue manager when updating reservation users")
             raise
     # try the above first -- if we can't contact the queue-manager, don't update the users
     Data.update(self, spec)
开发者ID:zzhou,项目名称:Qsim_Topology,代码行数:12,代码来源:bgsched.py

示例3: q_del

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_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

示例4: q_del

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_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

示例5: int

# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_queues [as 别名]
                        try:
                            if i != '*':
                                dummy = int(i)
                        except:
                            print prop + ' value is not a number'
                            raise SystemExit, 1
                    if val.count(':') == 2:
                        t = val.split(':')
                        val = str(int(t[0])*60 + int(t[1]))
                    elif val.count(':') == 0:
                        pass
                else:
                    print 'Time for ' + prop + ' is not valid, must be in hh:mm:ss or mm format'
            updates.update({prop.lower():val})
        try:
            response = cqm.set_queues(spec, updates, whoami)
        except xmlrpclib.Fault, flt:
            if flt.faultCode == QueueError.fault_code:
                print flt.faultString
                sys.exit(1)
    elif opts['unsetq']:
        updates = {}
        for prop in opts['unsetq'].split(' '):
            updates[prop.lower()] = None

        response = cqm.set_queues(spec, updates, whoami)
    elif opts['stopq']:
        response = cqm.set_queues(spec, {'state':'stopped'}, whoami)
    elif opts['startq']:
        response = cqm.set_queues(spec, {'state':'running'}, whoami)
    elif opts['drainq']:
开发者ID:zzhou,项目名称:Qsim_PowerAware,代码行数:33,代码来源:cqadm.py


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