コード例 #1
0
    def get_events_per_time(self, parameters=None):
        if parameters is None:
            parameters = {}
        list_logs = self.get_list_logs()
        for key in self.init_parameters:
            if key not in parameters:
                parameters[key] = self.init_parameters[key]
        parameters["filters"] = self.filters

        ret = parquet_handler.get_events_per_time(".", self.distr_log_path, list_logs, parameters=parameters)
        ret = [datetime.fromtimestamp(x) for x in ret]

        x, y = attributes_common.get_kde_date_attribute(ret)

        return x, y
コード例 #2
0
def get_events_per_time():
    try:
        process = request.args.get('process', type=str)
        keyphrase = request.args.get('keyphrase', type=str)
        session = request.args.get('session', type=str)

        use_transition = request.args.get(PARAMETER_USE_TRANSITION,
                                          type=str,
                                          default=str(DEFAULT_USE_TRANSITION))
        no_samples = request.args.get(PARAMETER_NO_SAMPLES,
                                      type=int,
                                      default=DEFAULT_MAX_NO_SAMPLES)
        max_no_ret_items = request.args.get(PARAMETER_NUM_RET_ITEMS,
                                            type=int,
                                            default=100000)
        timestamp_key = request.args.get('timestamp_key',
                                         type=str,
                                         default=xes.DEFAULT_TIMESTAMP_KEY)

        if use_transition == "True":
            use_transition = True
        else:
            use_transition = False

        if keyphrase == configuration.KEYPHRASE:
            filters = get_filters_per_session(process, session)
            parameters = {}
            parameters["filters"] = filters
            parameters[PARAMETER_USE_TRANSITION] = use_transition
            parameters[PARAMETER_NO_SAMPLES] = no_samples
            parameters[PARAMETER_NUM_RET_ITEMS] = max_no_ret_items
            parameters["max_no_of_points_to_sample"] = max_no_ret_items
            parameters["timestamp_key"] = timestamp_key

            returned_list = parquet_handler.get_events_per_time(
                SlaveVariableContainer.conf,
                process,
                SlaveVariableContainer.managed_logs[process],
                parameters=parameters)

            return jsonify({"points": returned_list})

        return jsonify({})
    except:
        return traceback.format_exc()