Example #1
0
    def get(self, cluster, environ, topology):

        start_time = time.time()
        lplan = yield access.get_logical_plan(cluster, environ, topology)

        if not lplan:
            self.write(dict())
            return

        if not lplan.has_key('spouts') or  not lplan.has_key('bolts'):
            self.write(dict())
            return

        # format the logical plan as required by the web (because of Ambrose)
        # first, spouts followed by bolts
        spouts_map = dict()
        for sn, sv in lplan['spouts'].items():
            spouts_map[sn] = dict(
                outputs = sv["outputs"],
                spout_type = sv["type"],
                spout_source = sv["source"],
            )

        bolts_map = dict()
        for bn, bv in lplan['bolts'].items():
            bolts_map[bn] = dict(
                inputComponents = [i['component_name'] for i in bv['inputs']],
                inputs = bv["inputs"],
                outputs = bv["outputs"]
            )

        diameter = common.graph.TopologyDAG(lplan).diameter()
        # construct the result
        result = dict(
            status = "success",
            message = "",
            version = common.VERSION,
            executiontime = time.time() - start_time,
            result = dict(
                stages = diameter,
                spouts = spouts_map,
                bolts = bolts_map
            )
        )

        self.write(result)
Example #2
0
    def get(self, cluster, environ, topology, comp_name):
        start_time = time.time()
        comp_names = []
        if comp_name == "All":
            lplan = yield access.get_logical_plan(cluster, environ, topology)
            if not lplan:
                self.write(dict())
                return

            if not lplan.has_key('spouts') or not lplan.has_key('bolts'):
                self.write(dict())
                return
            comp_names = lplan['spouts'].keys()
            comp_names.extend(lplan['bolts'].keys())
        else:
            comp_names = [comp_name]
        exception_infos = dict()
        for comp_name in comp_names:
            exception_infos[
                comp_name] = yield access.get_component_exceptionsummary(
                    cluster, environ, topology, comp_name)

        # Combine exceptions from multiple component
        aggregate_exceptions = dict()
        for comp_name, exception_logs in exception_infos.items():
            for exception_log in exception_logs:
                class_name = exception_log['class_name']
                if class_name != '':
                    if not class_name in aggregate_exceptions:
                        aggregate_exceptions[class_name] = 0
                    aggregate_exceptions[class_name] += int(
                        exception_log['count'])
        # Put the exception value in a table
        aggregate_exceptions_table = []
        for key in aggregate_exceptions.keys():
            aggregate_exceptions_table.append(
                [key, str(aggregate_exceptions[key])])
        result = dict(status="success",
                      executiontime=time.time() - start_time,
                      result=aggregate_exceptions_table)
        self.write(result)
Example #3
0
    def get(self, cluster, environ, topology):

        start_time = time.time()
        lplan = yield access.get_logical_plan(cluster, environ, topology)

        if not lplan:
            self.write(dict())
            return

        if not lplan.has_key('spouts') or not lplan.has_key('bolts'):
            self.write(dict())
            return

        # format the logical plan as required by the web (because of Ambrose)
        # first, spouts followed by bolts
        spouts_map = dict()
        for sn, sv in lplan['spouts'].items():
            spouts_map[sn] = dict(
                outputs=sv["outputs"],
                spout_type=sv["type"],
                spout_source=sv["source"],
            )

        bolts_map = dict()
        for bn, bv in lplan['bolts'].items():
            bolts_map[bn] = dict(
                inputComponents=[i['component_name'] for i in bv['inputs']],
                inputs=bv["inputs"],
                outputs=bv["outputs"])

        diameter = common.graph.TopologyDAG(lplan).diameter()
        # construct the result
        result = dict(status="success",
                      message="",
                      version=common.VERSION,
                      executiontime=time.time() - start_time,
                      result=dict(stages=diameter,
                                  spouts=spouts_map,
                                  bolts=bolts_map))

        self.write(result)
Example #4
0
    def get(self, cluster, environ, topology, comp_name):
        start_time = time.time()
        comp_names = []
        if comp_name == "All":
            lplan = yield access.get_logical_plan(cluster, environ, topology)
            if not lplan:
                self.write(dict())
                return

            if not lplan.has_key('spouts') or not lplan.has_key('bolts'):
                self.write(dict())
                return
            comp_names = lplan['spouts'].keys()
            comp_names.extend(lplan['bolts'].keys())
        else:
            comp_names = [comp_name]
        exception_infos = dict()
        for comp_name in comp_names:
            exception_infos[comp_name] = yield access.get_component_exceptionsummary(
                cluster, environ, topology, comp_name)

        # Combine exceptions from multiple component
        aggregate_exceptions = dict()
        for comp_name, exception_logs in exception_infos.items():
            for exception_log in exception_logs:
                class_name = exception_log['class_name'];
                if class_name != '':
                    if not class_name in aggregate_exceptions:
                        aggregate_exceptions[class_name] = 0;
                    aggregate_exceptions[class_name] += int(exception_log['count'])
        # Put the exception value in a table
        aggregate_exceptions_table = []
        for key in aggregate_exceptions.keys():
            aggregate_exceptions_table.append([key, str(aggregate_exceptions[key])])
        result = dict(
            status = "success",
            executiontime = time.time() - start_time,
            result = aggregate_exceptions_table)
        self.write(result)