-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcar.ts
112 lines (104 loc) · 2.98 KB
/
car.ts
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import { ExecutionEngine } from '../src';
import { writeTrace } from './common/writeTrace';
export function run() {
const executionEngine = new ExecutionEngine();
executionEngine.run(() => 'init ok !', ['projectX'], {
trace: { label: 'Project Initiation' }
});
const res = executionEngine.run(
() => {
executionEngine.run(() => 'Vehicle Design ok!', ['projectX'], {
trace: {
label: 'Vehicle Design'
},
config: {
parallel: true
}
});
executionEngine.run(() => 'Production Planning ok!', ['projectX'], {
trace: {
label: 'Production Planning'
},
config: {
parallel: true
}
});
return 'design and planning results';
},
['projectX'],
{ trace: { label: 'Design and Planning', id: 'designAndPlanning' } }
).outputs;
const res2 = executionEngine.run(
() => {
executionEngine.run(() => 'Engine Manufacturing ok!', ['plans'], {
trace: {
label: 'Engine Manufacturing',
parent: 'ComponentManufacturing'
},
config: {
parallel: true
}
});
executionEngine.run(() => 'Body and Chassis ok!', ['plans'], {
trace: {
label: 'Body and Chassis Production',
parent: 'ComponentManufacturing'
},
config: {
parallel: true
}
});
return ['engine', 'chassis'];
},
[res],
{ trace: { label: 'Component Manufacturing', id: 'ComponentManufacturing' } }
).outputs;
executionEngine.run(
() => {
executionEngine.run(
() => {
executionEngine.run(() => 'ok!', ['plans'], {
trace: {
label: 'Engine installation',
parent: 'assembly',
parallel: true
}
});
executionEngine.run(() => 'ok!', ['plans'], {
trace: {
label: 'Chassis integration',
parent: 'assembly',
parallel: true
}
});
executionEngine.run(() => 'ok!', ['plans'], {
trace: {
label: 'Interior assembly',
parent: 'assembly',
parallel: true
}
});
},
[res],
{ trace: { label: '', id: 'assembly', parent: 'VehicleAssembly' } }
);
executionEngine.run(() => 'ok!', ['plans'], {
trace: { label: 'Final Assembly', parent: 'VehicleAssembly' }
});
return ['engine', 'chassis'];
},
['assembly documents', res2],
{ trace: { label: 'Vehicle Assembly', id: 'VehicleAssembly' } }
);
executionEngine.run(() => 'bip bip', ['model X'], {
trace: { label: 'Quality Assurance and Testing' }
});
executionEngine.run(() => 'bip bip', ['model X'], {
trace: { label: 'Delivery' }
});
// Retrieve the trace
const finalTrace = executionEngine.getTrace();
const jsonString = JSON.stringify(finalTrace, null, 2);
writeTrace(jsonString);
}
run();