コード例 #1
0
 def perform_alignments_net_variants(self, net, im, fm, var_list=None, parameters=None):
     if parameters is None:
         parameters = {}
     if var_list is None:
         variants = self.get_variants(parameters=parameters)
         var_list = [[x, y] for x,y in variants.items()]
     petri_string = pnml_exporter.export_petri_as_string(net, im, fm, parameters=parameters)
     align = slave.perform_alignments(petri_string, var_list, parameters=parameters)
     return align
コード例 #2
0
def perform_alignments():
    try:
        from pm4pydistr.slave import slave

        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)

        try:
            content = json.loads(request.data)
        except:
            content = json.loads(request.data.decode('utf-8'))

        petri_string = content["petri_string"]
        var_list = content["var_list"]
        max_align_time = content["max_align_time"]
        max_align_time_trace = content["max_align_time_trace"]
        align_variant = content["align_variant"]
        classic_alignments_variant = content["classic_alignments_variant"]
        tree_align_variant = content["tree_align_variant"]
        petri_conversion_version = content["petri_conversion_version"]
        require_ilp_computation = content["require_ilp_computation"]

        if keyphrase == configuration.KEYPHRASE:
            parameters = {}
            parameters["max_align_time"] = max_align_time
            parameters["max_align_time_trace"] = max_align_time_trace
            parameters["align_variant"] = align_variant
            parameters[
                "classic_alignments_variant"] = classic_alignments_variant
            parameters["tree_align_variant"] = tree_align_variant
            parameters["petri_conversion_version"] = petri_conversion_version
            parameters["require_ilp_computation"] = require_ilp_computation

            align = slave.perform_alignments(petri_string,
                                             var_list,
                                             parameters=parameters)

            return jsonify({"alignments": align})

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