-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcombination-replacement.bpmn
More file actions
71 lines (62 loc) · 3.59 KB
/
combination-replacement.bpmn
File metadata and controls
71 lines (62 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_00v8ddm" targetNamespace="http://bpmn.io/schema/bpmn" exporter="QuantME Modeler" exporterVersion="4.5.0-nightly.20221215">
<bpmn:process id="Process_0frghgx" isExecutable="true">
<bpmn:serviceTask id="Task_1ffvrj7" name="Combine Results">
<bpmn:extensionElements>
<camunda:connector>
<camunda:inputOutput>
<camunda:inputParameter name="method">POST</camunda:inputParameter>
<camunda:inputParameter name="headers">
<camunda:map>
<camunda:entry key="Accept">application/json</camunda:entry>
<camunda:entry key="Content-Type">application/json</camunda:entry>
</camunda:map>
</camunda:inputParameter>
<camunda:inputParameter name="url">http://quokka-gateway:6474/quokka/circuit-cutting/combineResultsQuokka</camunda:inputParameter>
<camunda:inputParameter name="payload">
<camunda:script scriptFormat="JavaScript">print("combine")
var counts = execution.getVariable("counts");
//counts = JSON.parse(counts)
//counts = counts["counts"]
counts = counts.prop("counts").elements()
print(execution.getVariable("counts"));
print(counts)
print(JSON.parse(counts[0]))
print(JSON.stringify(JSON.parse(counts[0])))
new_counts = []
for each (var val in counts) {
print(val)
print(JSON.stringify(JSON.parse(val)))
new_counts.push(JSON.parse(val));
}
print(new_counts)
var cuttingMetaData = JSON.parse(execution.getVariable("cuttingMetaData"));
print(cuttingMetaData)
var circuit = execution.getVariable("circuit");
circuit = circuit.prop("circuit").value()
var myJson = {"circuit": circuit, "subcircuit_results": new_counts, "cuts": cuttingMetaData, "unnormalized_results":"True", "shot_scaling_factor":1000, "circuit_format":"qiskit"};
myJson = JSON.stringify(myJson);
print(myJson);
myJson =myJson;</camunda:script>
</camunda:inputParameter>
<camunda:outputParameter name="counts">
<camunda:script scriptFormat="JavaScript">var resp = connector.getVariable("response")
resp = JSON.parse(resp)
print(resp);
var counts = S(JSON.stringify({"counts":resp.result}));
counts;</camunda:script>
</camunda:outputParameter>
</camunda:inputOutput>
<camunda:connectorId>http-connector</camunda:connectorId>
</camunda:connector>
</bpmn:extensionElements>
</bpmn:serviceTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0frghgx">
<bpmndi:BPMNShape id="ServiceTask_05zk3jf_di" bpmnElement="Task_1ffvrj7">
<dc:Bounds x="320" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>