Ejemplo n.º 1
0
    def handle_PartitionStatusReq(self, req):
        ''' Return the entire contents of the UVE DB for the 
            requested partitions
        '''
        if req.partition == -1:
            parts = self._workers.keys()
        else:
            parts = [req.partition]

        self._logger.info("Got PartitionStatusReq: %s" % str(parts))
        np = 1
        for pt in parts:
            resp = PartitionStatusResp()
            resp.partition = pt
            if self._workers.has_key(pt):
                resp.enabled = True
                resp.offset = self._workers[pt]._partoffset
                resp.uves = []
                for kcoll, coll in self._workers[pt].contents().iteritems():
                    uci = UVECollInfo()
                    uci.collector = kcoll
                    uci.uves = []
                    for kgen, gen in coll.iteritems():
                        ugi = UVEGenInfo()
                        ugi.generator = kgen
                        ugi.uves = []
                        for tabk, tabc in gen.iteritems():
                            for uk, uc in tabc.iteritems():
                                ukc = UVEKeyInfo()
                                ukc.key = tabk + ":" + uk
                                ukc.types = []
                                for tk, tc in uc.iteritems():
                                    uvtc = UVETypeCount()
                                    uvtc.type = tk
                                    uvtc.count = tc["c"]
                                    uvtc.agg_uuid = str(tc["u"])
                                    ukc.types.append(uvtc)
                                ugi.uves.append(ukc)
                        uci.uves.append(ugi)
                    resp.uves.append(uci)
            else:
                resp.enabled = False
            if np == len(parts):
                mr = False
            else:
                mr = True
            resp.response(req.context(), mr)
            np = np + 1
Ejemplo n.º 2
0
    def handle_PartitionStatusReq(self, req):
        """ Return the entire contents of the UVE DB for the 
            requested partitions
        """
        if req.partition == -1:
            parts = self._workers.keys()
        else:
            parts = [req.partition]

        self._logger.info("Got PartitionStatusReq: %s" % str(parts))
        np = 1
        for pt in parts:
            resp = PartitionStatusResp()
            resp.partition = pt
            if self._workers.has_key(pt):
                resp.enabled = True
                resp.offset = self._workers[pt]._partoffset
                resp.uves = []
                for kcoll, coll in self._workers[pt].contents().iteritems():
                    uci = UVECollInfo()
                    uci.collector = kcoll
                    uci.uves = []
                    for kgen, gen in coll.iteritems():
                        ugi = UVEGenInfo()
                        ugi.generator = kgen
                        ugi.uves = []
                        for tabk, tabc in gen.iteritems():
                            for uk, uc in tabc.iteritems():
                                ukc = UVEKeyInfo()
                                ukc.key = tabk + ":" + uk
                                ukc.types = []
                                for tk, tc in uc.iteritems():
                                    uvtc = UVETypeCount()
                                    uvtc.type = tk
                                    uvtc.count = tc["c"]
                                    uvtc.agg_uuid = str(tc["u"])
                                    ukc.types.append(uvtc)
                                ugi.uves.append(ukc)
                        uci.uves.append(ugi)
                    resp.uves.append(uci)
            else:
                resp.enabled = False
            if np == len(parts):
                mr = False
            else:
                mr = True
            resp.response(req.context(), mr)
            np = np + 1
Ejemplo n.º 3
0
    def process_stats(self):
        ''' Go through the UVEKey-Count stats collected over 
            the previous time period over all partitions
            and send it out
        '''
        for pk,pc in self._workers.iteritems():
            din, dout = pc.stats()
            for ktab,tab in dout.iteritems():
                au = AlarmgenUpdate()
                au.name = self._hostname
                au.instance =  self._instance_id
                au.table = ktab
                au.partition = pk
                au.keys = []
                for uk,uc in tab.iteritems():
                    ukc = UVEKeyInfo()
                    ukc.key = uk
                    ukc.count = uc
                    au.keys.append(ukc)
                au_trace = AlarmgenUpdateTrace(data=au)
                self._logger.debug('send key stats: %s' % (au_trace.log()))
                au_trace.send()

            for ktab,tab in din.iteritems():
                au = AlarmgenUpdate()
                au.name = self._hostname
                au.instance =  self._instance_id
                au.table = ktab
                au.partition = pk
                au.notifs = []
                for kcoll,coll in tab.iteritems():
                    for kgen,gen in coll.iteritems():
                        for tk,tc in gen.iteritems():
                            tkc = UVETypeInfo()
                            tkc.type= tk
                            tkc.count = tc
                            tkc.generator = kgen
                            tkc.collector = kcoll
                            au.notifs.append(tkc)
                au_trace = AlarmgenUpdateTrace(data=au)
                self._logger.debug('send notif stats: %s' % (au_trace.log()))
                au_trace.send()
Ejemplo n.º 4
0
    def process_stats(self):
        ''' Go through the UVEKey-Count stats collected over 
            the previous time period over all partitions
            and send it out
        '''
        for pk,pc in self._workers.iteritems():
            din, dout = pc.stats()
            for ktab,tab in dout.iteritems():
                au = AlarmgenUpdate()
                au.name = self._hostname
                au.instance =  self._instance_id
                au.table = ktab
                au.partition = pk
                au.keys = []
                for uk,uc in tab.iteritems():
                    ukc = UVEKeyInfo()
                    ukc.key = uk
                    ukc.count = uc
                    au.keys.append(ukc)
                au_trace = AlarmgenUpdateTrace(data=au)
                self._logger.debug('send key stats: %s' % (au_trace.log()))
                au_trace.send()

            for ktab,tab in din.iteritems():
                au = AlarmgenUpdate()
                au.name = self._hostname
                au.instance =  self._instance_id
                au.table = ktab
                au.partition = pk
                au.notifs = []
                for kcoll,coll in tab.iteritems():
                    for kgen,gen in coll.iteritems():
                        for tk,tc in gen.iteritems():
                            tkc = UVETypeInfo()
                            tkc.type= tk
                            tkc.count = tc
                            tkc.generator = kgen
                            tkc.collector = kcoll
                            au.notifs.append(tkc)
                au_trace = AlarmgenUpdateTrace(data=au)
                self._logger.debug('send notif stats: %s' % (au_trace.log()))
                au_trace.send()
Ejemplo n.º 5
0
 def handle_PartitionStatusReq(self, req):
     ''' Return the entire contents of the UVE DB for the 
         requested partitions
     '''
     if req.partition == -1:
         parts = self._workers.keys()
     else:
         parts = [req.partition]
     
     self._logger.info("Got PartitionStatusReq: %s" % str(parts))
     np = 1
     for pt in parts:
         resp = PartitionStatusResp()
         resp.partition = pt
         if self._workers.has_key(pt):
             resp.enabled = True
             resp.offset = self._workers[pt]._partoffset
             resp.uves = []
             for kcoll,coll in self._workers[pt].contents().iteritems():
                 uci = UVECollInfo()
                 uci.collector = kcoll
                 uci.uves = []
                 for kgen,gen in coll.iteritems():
                     ugi = UVEGenInfo()
                     ugi.generator = kgen
                     ugi.uves = []
                     for uk,uc in gen.iteritems():
                         ukc = UVEKeyInfo()
                         ukc.key = uk
                         ukc.count = uc
                         ugi.uves.append(ukc)
                     uci.uves.append(ugi)
                 resp.uves.append(uci)
         else:
             resp.enabled = False
         if np == len(parts):
             mr = False
         else:
             mr = True
         resp.response(req.context(), mr)
         np = np + 1
Ejemplo n.º 6
0
    def process_stats(self):
        ''' Go through the UVEKey-Count stats collected over 
            the previous time period over all partitions
            and send it out
        '''
        s_partitions = set()
        s_keys = set()
        n_updates = 0
        for pk,pc in self._workers.iteritems():
            s_partitions.add(pk)
            din, dout = pc.stats()
            for ktab,tab in dout.iteritems():
                au_keys = []
                for uk,uc in tab.iteritems():
                    s_keys.add(uk)
                    n_updates += uc
                    ukc = UVEKeyInfo()
                    ukc.key = uk
                    ukc.count = uc
                    au_keys.append(ukc)
                au_obj = AlarmgenUpdate(name=sandesh_global._source + ':' + \
                        sandesh_global._node_type + ':' + \
                        sandesh_global._module + ':' + \
                        sandesh_global._instance_id,
                        partition = pk,
                        table = ktab,
                        keys = au_keys,
                        notifs = None)
                self._logger.debug('send key stats: %s' % (au_obj.log()))
                au_obj.send()

            for ktab,tab in din.iteritems():
                au_notifs = []
                for kcoll,coll in tab.iteritems():
                    for kgen,gen in coll.iteritems():
                        for tk,tc in gen.iteritems():
                            tkc = UVETypeInfo()
                            tkc.type= tk
                            tkc.count = tc
                            tkc.generator = kgen
                            tkc.collector = kcoll
                            au_notifs.append(tkc)
                au_obj = AlarmgenUpdate(name=sandesh_global._source + ':' + \
                        sandesh_global._node_type + ':' + \
                        sandesh_global._module + ':' + \
                        sandesh_global._instance_id,
                        partition = pk,
                        table = ktab,
                        keys = None,
                        notifs = au_notifs)
                self._logger.debug('send notif stats: %s' % (au_obj.log()))
                au_obj.send()

        au = AlarmgenStatus()
        au.name = self._hostname
        au.counters = []
        au.alarmgens = []
        ags = AlarmgenStats()
        ags.instance =  self._instance_id
        ags.partitions = len(s_partitions)
        ags.keys = len(s_keys)
        ags.updates = n_updates
        au.counters.append(ags)

        agname = sandesh_global._source + ':' + \
                        sandesh_global._node_type + ':' + \
                        sandesh_global._module + ':' + \
                        sandesh_global._instance_id
        au.alarmgens.append(agname)
 
        atrace = AlarmgenStatusTrace(data = au)
        self._logger.debug('send alarmgen status : %s' % (atrace.log()))
        atrace.send()
Ejemplo n.º 7
0
    def process_stats(self):
        ''' Go through the UVEKey-Count stats collected over 
            the previous time period over all partitions
            and send it out
        '''
        self.tab_perf_prev = copy.deepcopy(self.tab_perf)
        for kt in self.tab_perf.keys():
            #self.tab_perf_prev[kt] = copy.deepcopy(self.tab_perf[kt])
            self.tab_perf[kt].reset()

        s_partitions = set()
        s_keys = set()
        n_updates = 0
        for pk, pc in self._workers.iteritems():
            s_partitions.add(pk)
            din, dout = pc.stats()
            for ktab, tab in dout.iteritems():
                au_keys = []
                for uk, uc in tab.iteritems():
                    s_keys.add(uk)
                    n_updates += uc
                    ukc = UVEKeyInfo()
                    ukc.key = uk
                    ukc.count = uc
                    au_keys.append(ukc)
                au_obj = AlarmgenUpdate(name=self._sandesh._source + ':' + \
                        self._sandesh._node_type + ':' + \
                        self._sandesh._module + ':' + \
                        self._sandesh._instance_id,
                        partition = pk,
                        table = ktab,
                        keys = au_keys,
                        notifs = None,
                        sandesh=self._sandesh)
                self._logger.debug('send key stats: %s' % (au_obj.log()))
                au_obj.send(sandesh=self._sandesh)

            for ktab, tab in din.iteritems():
                au_notifs = []
                for kcoll, coll in tab.iteritems():
                    for kgen, gen in coll.iteritems():
                        for tk, tc in gen.iteritems():
                            tkc = UVETypeInfo()
                            tkc.type = tk
                            tkc.count = tc
                            tkc.generator = kgen
                            tkc.collector = kcoll
                            au_notifs.append(tkc)
                au_obj = AlarmgenUpdate(name=self._sandesh._source + ':' + \
                        self._sandesh._node_type + ':' + \
                        self._sandesh._module + ':' + \
                        self._sandesh._instance_id,
                        partition = pk,
                        table = ktab,
                        keys = None,
                        notifs = au_notifs,
                        sandesh=self._sandesh)
                self._logger.debug('send notif stats: %s' % (au_obj.log()))
                au_obj.send(sandesh=self._sandesh)

        au = AlarmgenStatus()
        au.name = self._hostname
        au.counters = []
        au.alarmgens = []
        ags = AlarmgenStats()
        ags.instance = self._instance_id
        ags.partitions = len(s_partitions)
        ags.keys = len(s_keys)
        ags.updates = n_updates
        au.counters.append(ags)

        agname = self._sandesh._source + ':' + \
                        self._sandesh._node_type + ':' + \
                        self._sandesh._module + ':' + \
                        self._sandesh._instance_id
        au.alarmgens.append(agname)

        atrace = AlarmgenStatusTrace(data=au, sandesh=self._sandesh)
        self._logger.debug('send alarmgen status : %s' % (atrace.log()))
        atrace.send(sandesh=self._sandesh)