(self, result)
This function group statistics of same tasks by adding them.
        It also add 'instances_count' statistic to get information about
        how many instances is running on the server

        Args:
            result: result of mesos query. List of dictionaries with
            'executor_id', 'framework_id' as a strings and 'statistics'
            as dictionary of labeled numbers
This function group statistics of same tasks by adding them.
        It also add 'instances_count' statistic to get information about
        how many instances is running on the server
This function group statistics of same tasks by adding them . It also add instances_count statistic to get information about how many instances is running on the server
def _group_and_publish_tasks_statistics(self, result):
        """This function group statistics of same tasks by adding them.
        It also add 'instances_count' statistic to get information about
        how many instances is running on the server

        Args:
            result: result of mesos query. List of dictionaries with
            'executor_id', 'framework_id' as a strings and 'statistics'
            as dictionary of labeled numbers
        """
        for i in result:
            executor_id = i['executor_id']
            i['executor_id'] = executor_id[:executor_id.rfind('.')]
            i['statistics']['instances_count'] = 1

        r = {}
        for i in result:
            executor_id = i['executor_id']
            r[executor_id] = r.get(executor_id, {})
            r[executor_id]['framework_id'] = i['framework_id']
            r[executor_id]['statistics'] = r[executor_id].get('statistics', {})
            r[executor_id]['statistics'] = self._sum_statistics(
                i['statistics'], r[executor_id]['statistics'])

        self._add_cpu_usage(r)
        self._add_cpu_percent(r)
        self._add_mem_percent(r)
        self._publish(r)
def _group_and_publish_tasks_statistics ( self , result ) : for i in result : executor_id = i [ 'executor_id' ] i [ 'executor_id' ] = executor_id [ : executor_id . rfind ( '.' ) ] i [ 'statistics' ] [ 'instances_count' ] = 1 r = { } for i in result : executor_id = i [ 'executor_id' ] r [ executor_id ] = r . get ( executor_id , { } ) r [ executor_id ] [ 'framework_id' ] = i [ 'framework_id' ] r [ executor_id ] [ 'statistics' ] = r [ executor_id ] . get ( 'statistics' , { } ) r [ executor_id ] [ 'statistics' ] = self . _sum_statistics ( i [ 'statistics' ] , r [ executor_id ] [ 'statistics' ] ) self . _add_cpu_usage ( r ) self . _add_cpu_percent ( r ) self . _add_mem_percent ( r ) self . _publish ( r )