This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkflow.js
85 lines (77 loc) · 5.2 KB
/
workflow.js
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
const cmps = require('openwhisk-composer')
// sorry for the hard-coded
// but i don't have enough time to learn composer
module.exports = cmps.sequence(
cmps.action('Step1'),
cmps.action('Step2'),
cmps.parallel(
cmps.function((args) => { return args; }),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['projTasks'][0] } }), cmps.action('Step3')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['projTasks'][1] } }), cmps.action('Step3')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['projTasks'][2] } }), cmps.action('Step3')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['projTasks'][3] } }), cmps.action('Step3')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['projTasks'][4] } }), cmps.action('Step3')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['projTasks'][5] } }), cmps.action('Step3')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['projTasks'][6] } }), cmps.action('Step3')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['projTasks'][7] } }), cmps.action('Step3')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['projTasks'][8] } }), cmps.action('Step3')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['projTasks'][9] } }), cmps.action('Step3'))
),
cmps.function((args) => {
var rst = args.value;
var org = rst.shift();
var logs = [];
for (const val of rst) {
logs.push(val.log);
}
org.projected = [];
for (const tasks of org.projTasks) {
org.projected.push(tasks.dst);
}
delete org.projTasks;
org.log.push(logs);
return org;
}),
cmps.action('Step4'),
cmps.action('Step5'),
cmps.action('Step6'),
cmps.parallel(
cmps.function((args) => { return args; }),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][0] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][1] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][2] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][3] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][4] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][5] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][6] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][7] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][8] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][9] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][10] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][11] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][12] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][13] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][14] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][15] } }), cmps.action('Step7')),
cmps.sequence(cmps.function((args) => { return { 'serverURL': args['serverURL'], 'task': args['diffTasks'][16] } }), cmps.action('Step7'))
),
cmps.function((args) => {
var rst = args.value;
var org = rst.shift();
var logs = [];
for (const val of rst) {
logs.push(val.log);
}
org.diffs = [];
for (const tasks of org.diffTasks) {
org.diffs.push(tasks.dst);
}
delete org.diffTasks;
org.log.push(logs);
return org;
}),
cmps.action('Step8'),
cmps.action('Step9'),
cmps.action('Step10'),
cmps.action('Step11')
);