cpee 2.1.118 → 2.1.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/cockpit/js/instance.js +9 -12
- data/cockpit/templates/Readonly Local.xml +228 -0
- data/cpee.gemspec +1 -1
- data/lib/cpee/implementation.rb +1 -1
- data/lib/cpee/implementation_callbacks.rb +9 -9
- data/lib/cpee/implementation_notifications.rb +1 -1
- data/lib/cpee/message.rb +10 -12
- data/lib/cpee/persistence.rb +5 -5
- data/server/executionhandlers/eval/connection.rb +7 -2
- data/server/executionhandlers/eval/controller.rb +9 -5
- data/server/executionhandlers/ruby/connection.rb +6 -3
- data/server/executionhandlers/ruby/controller.rb +5 -6
- data/server/routing/end.pid +1 -1
- data/server/routing/end.rb +5 -5
- data/server/routing/forward-events-00.pid +1 -1
- data/server/routing/forward-events.rb +28 -22
- data/server/routing/forward-votes.pid +1 -1
- data/server/routing/forward-votes.rb +5 -5
- data/server/routing/persist.pid +1 -1
- data/server/routing/persist.rb +4 -4
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 39d6640351bbed07ebe4e967a8b83d625e90cf26c23af8b5f56772408c982fd5
|
|
4
|
+
data.tar.gz: b1e0f77cfee4cd79623d29e6adf2530b65ae6bfb28533fad8404691c089f7f46
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33877d90270783fd4ff34ad76ce821314bb2cf6fd772afa3fff60d1d1926c49f48a51bd0746376b20ad5a678e7d449e70a9ba1df22249e99c8a8a3eb279a2c29
|
|
7
|
+
data.tar.gz: 1747c6805c4b8707860050a88d2562843076179e9736362bbc1ce888f14a0817eb0ba36be869f1836b9fea617aa31bcf318d7dceb11237ece96ca26151da27ee
|
data/cockpit/js/instance.js
CHANGED
|
@@ -799,22 +799,19 @@ function monitor_instance_pos() {// {{{
|
|
|
799
799
|
}// }}}
|
|
800
800
|
|
|
801
801
|
function monitor_instance_running(content,event) {// {{{
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
if (!save['activity_red_states'][content['activity-uuid']]) {
|
|
809
|
-
save['activity_red_states'][content['activity-uuid']] = true
|
|
810
|
-
format_visual_add(content.activity,"active")
|
|
802
|
+
let uuid = content['activity-uuid'];
|
|
803
|
+
let cur = save['activity_red_states'][uuid];
|
|
804
|
+
if (event == "calling" || event == "manipulating") {
|
|
805
|
+
if (!cur && save['instance_pos'].filter( (_,e) => { return e.nodeName == content.activity }).length == 0) {
|
|
806
|
+
save['activity_red_states'][uuid] = { position: content.activity, state: 'active' };
|
|
807
|
+
format_visual_add(content.activity,"active");
|
|
811
808
|
}
|
|
812
809
|
} else if (event == "done") {
|
|
813
|
-
if (save['
|
|
810
|
+
if ((cur && cur.state == 'active') || save['instance_pos'].filter( (_,e) => { return e.nodeName == content.activity }).length > 0) {
|
|
814
811
|
format_visual_remove(content.activity,"active");
|
|
815
812
|
}
|
|
816
|
-
save['activity_red_states'][
|
|
817
|
-
setTimeout(() => {delete save['activity_red_states'][
|
|
813
|
+
save['activity_red_states'][uuid] = { position: content.activity, state: 'done' };
|
|
814
|
+
setTimeout(() => {delete save['activity_red_states'][uuid]},1000);
|
|
818
815
|
}
|
|
819
816
|
} // }}}
|
|
820
817
|
function monitor_instance_pos_change(content) {// {{{
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<testset xmlns="http://cpee.org/ns/properties/2.0">
|
|
3
|
+
<executionhandler>ruby</executionhandler>
|
|
4
|
+
<dataelements>
|
|
5
|
+
<a>2</a>
|
|
6
|
+
<b>{"a":2,"b":12}</b>
|
|
7
|
+
<c>{"a":2}</c>
|
|
8
|
+
</dataelements>
|
|
9
|
+
<endpoints>
|
|
10
|
+
<user>https-post://cpee.org/services/timeout-user.php</user>
|
|
11
|
+
<auto>https-post://cpee.org/services/timeout-auto.php</auto>
|
|
12
|
+
<timeout>https-post://cpee.org/services/timeout.php</timeout>
|
|
13
|
+
<subprocess>https-post://cpee.org/flow/start/url/</subprocess>
|
|
14
|
+
<send>https-post://cpee.org/ing/correlators/message/send/</send>
|
|
15
|
+
<receive>https-get://cpee.org/ing/correlators/message/receive/</receive>
|
|
16
|
+
</endpoints>
|
|
17
|
+
<attributes>
|
|
18
|
+
<guarded>none</guarded>
|
|
19
|
+
<info>Readonly Local</info>
|
|
20
|
+
<modeltype>CPEE</modeltype>
|
|
21
|
+
<theme>preset</theme>
|
|
22
|
+
<creator>Christine Ashcreek</creator>
|
|
23
|
+
<guarded_id/>
|
|
24
|
+
<author>Christine Ashcreek</author>
|
|
25
|
+
<model_uuid>5b08fb27-26dd-4d18-8cc1-7907e79af97c</model_uuid>
|
|
26
|
+
<model_version/>
|
|
27
|
+
<design_dir>Templates.dir</design_dir>
|
|
28
|
+
<design_stage>development</design_stage>
|
|
29
|
+
</attributes>
|
|
30
|
+
<description>
|
|
31
|
+
<description xmlns="http://cpee.org/ns/description/1.0">
|
|
32
|
+
<manipulate id="a1" label="Set data.a to 2">
|
|
33
|
+
<code>data.a = 2</code>
|
|
34
|
+
<annotations>
|
|
35
|
+
<_logging_behavior>
|
|
36
|
+
<_exclude>false</_exclude>
|
|
37
|
+
</_logging_behavior>
|
|
38
|
+
<_context_data_analysis>
|
|
39
|
+
<probes/>
|
|
40
|
+
</_context_data_analysis>
|
|
41
|
+
</annotations>
|
|
42
|
+
</manipulate>
|
|
43
|
+
<parallel eid="e1" wait="-1" cancel="last">
|
|
44
|
+
<parallel_branch>
|
|
45
|
+
<call id="a3" endpoint="timeout">
|
|
46
|
+
<parameters>
|
|
47
|
+
<label>Wait 2</label>
|
|
48
|
+
<color/>
|
|
49
|
+
<arguments>
|
|
50
|
+
<timeout>2</timeout>
|
|
51
|
+
<data/>
|
|
52
|
+
</arguments>
|
|
53
|
+
</parameters>
|
|
54
|
+
<annotations>
|
|
55
|
+
<_generic/>
|
|
56
|
+
<_logging_behavior>
|
|
57
|
+
<_exclude>false</_exclude>
|
|
58
|
+
<_include>false</_include>
|
|
59
|
+
</_logging_behavior>
|
|
60
|
+
<_timing>
|
|
61
|
+
<_timing_weight/>
|
|
62
|
+
<_timing_avg/>
|
|
63
|
+
<explanations/>
|
|
64
|
+
</_timing>
|
|
65
|
+
<_shifting>
|
|
66
|
+
<_shifting_type>Duration</_shifting_type>
|
|
67
|
+
</_shifting>
|
|
68
|
+
<_context_data_analysis>
|
|
69
|
+
<probes/>
|
|
70
|
+
<ips/>
|
|
71
|
+
</_context_data_analysis>
|
|
72
|
+
<report>
|
|
73
|
+
<url/>
|
|
74
|
+
</report>
|
|
75
|
+
<_notes>
|
|
76
|
+
<_notes_general/>
|
|
77
|
+
</_notes>
|
|
78
|
+
</annotations>
|
|
79
|
+
<documentation>
|
|
80
|
+
<input/>
|
|
81
|
+
<output/>
|
|
82
|
+
<implementation>
|
|
83
|
+
<description/>
|
|
84
|
+
</implementation>
|
|
85
|
+
</documentation>
|
|
86
|
+
</call>
|
|
87
|
+
<choose eid="e2" mode="exclusive" label="">
|
|
88
|
+
<alternative eid="e3" condition="local.a == 2">
|
|
89
|
+
<call id="a2" endpoint="timeout">
|
|
90
|
+
<parameters>
|
|
91
|
+
<label>local.a as param</label>
|
|
92
|
+
<color/>
|
|
93
|
+
<arguments>
|
|
94
|
+
<timeout>1</timeout>
|
|
95
|
+
<data>
|
|
96
|
+
<a>!local.a</a>
|
|
97
|
+
<b>12</b>
|
|
98
|
+
</data>
|
|
99
|
+
</arguments>
|
|
100
|
+
</parameters>
|
|
101
|
+
<code>
|
|
102
|
+
<signal>false</signal>
|
|
103
|
+
<prepare/>
|
|
104
|
+
<finalize output="result">data.b = result</finalize>
|
|
105
|
+
<update output="result"/>
|
|
106
|
+
<rescue output="result"/>
|
|
107
|
+
</code>
|
|
108
|
+
<annotations>
|
|
109
|
+
<_generic/>
|
|
110
|
+
<_logging_behavior>
|
|
111
|
+
<_exclude>false</_exclude>
|
|
112
|
+
<_include>false</_include>
|
|
113
|
+
</_logging_behavior>
|
|
114
|
+
<_timing>
|
|
115
|
+
<_timing_weight/>
|
|
116
|
+
<_timing_avg/>
|
|
117
|
+
<explanations/>
|
|
118
|
+
</_timing>
|
|
119
|
+
<_shifting>
|
|
120
|
+
<_shifting_type>Duration</_shifting_type>
|
|
121
|
+
</_shifting>
|
|
122
|
+
<_context_data_analysis>
|
|
123
|
+
<probes/>
|
|
124
|
+
<ips/>
|
|
125
|
+
</_context_data_analysis>
|
|
126
|
+
<report>
|
|
127
|
+
<url/>
|
|
128
|
+
</report>
|
|
129
|
+
<_notes>
|
|
130
|
+
<_notes_general/>
|
|
131
|
+
</_notes>
|
|
132
|
+
</annotations>
|
|
133
|
+
<documentation>
|
|
134
|
+
<input/>
|
|
135
|
+
<output/>
|
|
136
|
+
<implementation>
|
|
137
|
+
<description/>
|
|
138
|
+
</implementation>
|
|
139
|
+
<code>
|
|
140
|
+
<description/>
|
|
141
|
+
</code>
|
|
142
|
+
</documentation>
|
|
143
|
+
</call>
|
|
144
|
+
<_probability>
|
|
145
|
+
<_probability_min/>
|
|
146
|
+
<_probability_max/>
|
|
147
|
+
<_probability_avg/>
|
|
148
|
+
</_probability>
|
|
149
|
+
</alternative>
|
|
150
|
+
<otherwise/>
|
|
151
|
+
</choose>
|
|
152
|
+
</parallel_branch>
|
|
153
|
+
<parallel_branch>
|
|
154
|
+
<manipulate id="a4" label="Set local.a to 1">
|
|
155
|
+
<code>local.a = 1</code>
|
|
156
|
+
<annotations>
|
|
157
|
+
<_logging_behavior>
|
|
158
|
+
<_exclude>false</_exclude>
|
|
159
|
+
</_logging_behavior>
|
|
160
|
+
<_context_data_analysis>
|
|
161
|
+
<probes/>
|
|
162
|
+
</_context_data_analysis>
|
|
163
|
+
</annotations>
|
|
164
|
+
</manipulate>
|
|
165
|
+
<call id="a5" endpoint="timeout">
|
|
166
|
+
<parameters>
|
|
167
|
+
<label>local.a as param</label>
|
|
168
|
+
<color/>
|
|
169
|
+
<arguments>
|
|
170
|
+
<timeout/>
|
|
171
|
+
<data>
|
|
172
|
+
<a>!local.a</a>
|
|
173
|
+
</data>
|
|
174
|
+
</arguments>
|
|
175
|
+
</parameters>
|
|
176
|
+
<code>
|
|
177
|
+
<signal>false</signal>
|
|
178
|
+
<prepare/>
|
|
179
|
+
<finalize output="result">data.c = result</finalize>
|
|
180
|
+
<update output="result"/>
|
|
181
|
+
<rescue output="result"/>
|
|
182
|
+
</code>
|
|
183
|
+
<annotations>
|
|
184
|
+
<_generic/>
|
|
185
|
+
<_logging_behavior>
|
|
186
|
+
<_exclude>false</_exclude>
|
|
187
|
+
<_include>false</_include>
|
|
188
|
+
</_logging_behavior>
|
|
189
|
+
<_timing>
|
|
190
|
+
<_timing_weight/>
|
|
191
|
+
<_timing_avg/>
|
|
192
|
+
<explanations/>
|
|
193
|
+
</_timing>
|
|
194
|
+
<_shifting>
|
|
195
|
+
<_shifting_type>Duration</_shifting_type>
|
|
196
|
+
</_shifting>
|
|
197
|
+
<_context_data_analysis>
|
|
198
|
+
<probes/>
|
|
199
|
+
<ips/>
|
|
200
|
+
</_context_data_analysis>
|
|
201
|
+
<report>
|
|
202
|
+
<url/>
|
|
203
|
+
</report>
|
|
204
|
+
<_notes>
|
|
205
|
+
<_notes_general/>
|
|
206
|
+
</_notes>
|
|
207
|
+
</annotations>
|
|
208
|
+
<documentation>
|
|
209
|
+
<input/>
|
|
210
|
+
<output/>
|
|
211
|
+
<implementation>
|
|
212
|
+
<description/>
|
|
213
|
+
</implementation>
|
|
214
|
+
<code>
|
|
215
|
+
<description/>
|
|
216
|
+
</code>
|
|
217
|
+
</documentation>
|
|
218
|
+
</call>
|
|
219
|
+
</parallel_branch>
|
|
220
|
+
</parallel>
|
|
221
|
+
</description>
|
|
222
|
+
</description>
|
|
223
|
+
<transformation>
|
|
224
|
+
<description type="copy"/>
|
|
225
|
+
<dataelements type="none"/>
|
|
226
|
+
<endpoints type="none"/>
|
|
227
|
+
</transformation>
|
|
228
|
+
</testset>
|
data/cpee.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "cpee"
|
|
3
|
-
s.version = "2.1.
|
|
3
|
+
s.version = "2.1.119"
|
|
4
4
|
s.platform = Gem::Platform::RUBY
|
|
5
5
|
s.license = "LGPL-3.0-or-later"
|
|
6
6
|
s.summary = "The cloud process execution engine (cpee.org). If you just need workflow execution, without a rest service exposing it, then use WEEL."
|
data/lib/cpee/implementation.rb
CHANGED
|
@@ -399,7 +399,7 @@ module CPEE
|
|
|
399
399
|
end
|
|
400
400
|
subs.each do |s|
|
|
401
401
|
begin
|
|
402
|
-
NewInstance::sub(multi,id,s.to_doc,s.attributes['id'] ||
|
|
402
|
+
NewInstance::sub(multi,id,s.to_doc,s.attributes['id'] || SecureRandom.hex(16))
|
|
403
403
|
end
|
|
404
404
|
end
|
|
405
405
|
|
|
@@ -58,11 +58,11 @@ module CPEE
|
|
|
58
58
|
|
|
59
59
|
if CPEE::Persistence::is_member?(id,opts,'callbacks',callback)
|
|
60
60
|
res = {}
|
|
61
|
-
res[:uuid] = CPEE::Persistence::extract_item(id,opts,"
|
|
62
|
-
res[:type] = CPEE::Persistence::extract_item(id,opts,"
|
|
63
|
-
res[:position] = CPEE::Persistence::extract_item(id,opts,"
|
|
64
|
-
res[:label] = CPEE::Persistence::extract_item(id,opts,"
|
|
65
|
-
if sub = CPEE::Persistence::extract_item(id,opts,"
|
|
61
|
+
res[:uuid] = CPEE::Persistence::extract_item(id,opts,"callbacks/#{callback}/uuid")
|
|
62
|
+
res[:type] = CPEE::Persistence::extract_item(id,opts,"callbacks/#{callback}/type")
|
|
63
|
+
res[:position] = CPEE::Persistence::extract_item(id,opts,"callbacks/#{callback}/position")
|
|
64
|
+
res[:label] = CPEE::Persistence::extract_item(id,opts,"callbacks/#{callback}/label")
|
|
65
|
+
if sub = CPEE::Persistence::extract_item(id,opts,"callbacks/#{callback}/subscription")
|
|
66
66
|
res[:subscription] = sub
|
|
67
67
|
end
|
|
68
68
|
|
|
@@ -82,7 +82,7 @@ module CPEE
|
|
|
82
82
|
if opts[:statemachine].final? id
|
|
83
83
|
@status = 410
|
|
84
84
|
else
|
|
85
|
-
if CPEE::Persistence::extract_item(id,opts,"
|
|
85
|
+
if CPEE::Persistence::extract_item(id,opts,"callbacks/#{callback}/type") == 'callback'
|
|
86
86
|
CPEE::Message::send(
|
|
87
87
|
:'callback-end',
|
|
88
88
|
callback,
|
|
@@ -93,7 +93,7 @@ module CPEE
|
|
|
93
93
|
{},
|
|
94
94
|
opts[:redis]
|
|
95
95
|
)
|
|
96
|
-
elsif CPEE::Persistence::extract_item(id,opts,"
|
|
96
|
+
elsif CPEE::Persistence::extract_item(id,opts,"callbacks/#{callback}/type") == 'vote'
|
|
97
97
|
CPEE::Message::send(
|
|
98
98
|
:'vote-response',
|
|
99
99
|
callback,
|
|
@@ -128,7 +128,7 @@ module CPEE
|
|
|
128
128
|
if opts[:statemachine].final? id
|
|
129
129
|
@status = 410
|
|
130
130
|
else
|
|
131
|
-
if CPEE::Persistence::extract_item(id,opts,"
|
|
131
|
+
if CPEE::Persistence::extract_item(id,opts,"callbacks/#{callback}/type") == 'callback'
|
|
132
132
|
ret = {}
|
|
133
133
|
ret['values'] = @p.map{ |e|
|
|
134
134
|
# bei complex wenn kleiner 500KiB statt e.value.path e.value.read
|
|
@@ -159,7 +159,7 @@ module CPEE
|
|
|
159
159
|
ret,
|
|
160
160
|
opts[:redis]
|
|
161
161
|
)
|
|
162
|
-
elsif CPEE::Persistence::extract_item(id,opts,"
|
|
162
|
+
elsif CPEE::Persistence::extract_item(id,opts,"callbacks/#{callback}/type") == 'vote'
|
|
163
163
|
if @p.length == 1 && @p[0].name == 'continue' && @p[0].class == Riddl::Parameter::Simple
|
|
164
164
|
CPEE::Message::send(
|
|
165
165
|
:'vote-response',
|
|
@@ -129,7 +129,7 @@ module CPEE
|
|
|
129
129
|
if opts[:statemachine].final? id
|
|
130
130
|
@status = 410
|
|
131
131
|
else
|
|
132
|
-
key = @p[0].name == 'id' ? @p.shift.value :
|
|
132
|
+
key = @p[0].name == 'id' ? @p.shift.value : SecureRandom.hex(16)
|
|
133
133
|
url = @p[0].name == 'url' ? @p.shift.value : nil
|
|
134
134
|
values = []
|
|
135
135
|
while @p.length > 0
|
data/lib/cpee/message.rb
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
module CPEE
|
|
16
16
|
|
|
17
17
|
module Message
|
|
18
|
+
@@mutex = Mutex.new
|
|
18
19
|
@@who = 'cpee'
|
|
19
20
|
@@type = 'instance'
|
|
20
21
|
@@tworkers = 1
|
|
@@ -39,19 +40,19 @@ module CPEE
|
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def self::target
|
|
42
|
-
@@last < @@tworkers-1 ? @@last += 1 : @@last = 0
|
|
43
|
+
@@mutex.synchronize { @@last < @@tworkers-1 ? @@last += 1 : @@last = 0 }
|
|
43
44
|
end
|
|
44
45
|
|
|
45
46
|
def self::wait(backend,sub,tt=nil)
|
|
46
47
|
target = '%02i' % (tt || CPEE::Message::target)
|
|
47
|
-
wid =
|
|
48
|
+
wid = SecureRandom.hex(16)
|
|
48
49
|
begin
|
|
49
|
-
sub.subscribe_with_timeout(2,
|
|
50
|
+
sub.subscribe_with_timeout(2,"event:#{target}:transaction/finished") do |on|
|
|
50
51
|
on.message do |what,message|
|
|
51
52
|
mess = message[0...message.index(' ')]
|
|
52
|
-
sub.unsubscribe(
|
|
53
|
+
sub.unsubscribe("event:#{target}:transaction/finished") if mess == wid
|
|
53
54
|
end
|
|
54
|
-
backend.publish(
|
|
55
|
+
backend.publish("event:#{target}:transaction/start","#{wid} {}")
|
|
55
56
|
end
|
|
56
57
|
rescue => e
|
|
57
58
|
puts "timeout error"
|
|
@@ -65,7 +66,7 @@ module CPEE
|
|
|
65
66
|
name = ::File::basename(event)
|
|
66
67
|
payload = {
|
|
67
68
|
@@who => cpee,
|
|
68
|
-
@@type
|
|
69
|
+
"#{@@type}-url" => File.join(cpee,instance.to_s),
|
|
69
70
|
@@type => instance,
|
|
70
71
|
'topic' => topic,
|
|
71
72
|
'type' => type,
|
|
@@ -73,13 +74,10 @@ module CPEE
|
|
|
73
74
|
'timestamp' => Time.now.xmlschema(6),
|
|
74
75
|
'content' => content
|
|
75
76
|
}
|
|
76
|
-
payload[@@type
|
|
77
|
-
payload[@@type
|
|
77
|
+
payload["#{@@type}-uuid"] = instance_uuid if instance_uuid
|
|
78
|
+
payload["#{@@type}-name"] = instance_name if instance_name
|
|
78
79
|
|
|
79
|
-
backend.publish(type
|
|
80
|
-
instance.to_s + ',' + instance_uuid.to_s + ' ' +
|
|
81
|
-
JSON::generate(payload)
|
|
82
|
-
)
|
|
80
|
+
backend.publish("#{type}:#{target}:#{event}", "#{instance},#{instance_uuid} #{JSON::generate(payload)}")
|
|
83
81
|
end
|
|
84
82
|
|
|
85
83
|
def self::send_url(type, event, cpee, content={}, backend)
|
data/lib/cpee/persistence.rb
CHANGED
|
@@ -152,11 +152,11 @@ module CPEE
|
|
|
152
152
|
res += cbs
|
|
153
153
|
res += Persistence::keys_extract_name(opts,id,'callbacks')
|
|
154
154
|
cbs.each do |c|
|
|
155
|
-
|
|
156
|
-
res <<
|
|
157
|
-
res <<
|
|
158
|
-
res <<
|
|
159
|
-
res <<
|
|
155
|
+
res << "#{c}/position"
|
|
156
|
+
res << "#{c}/label"
|
|
157
|
+
res << "#{c}/uuid"
|
|
158
|
+
res << "#{c}/type"
|
|
159
|
+
res << "#{c}/subscription"
|
|
160
160
|
end
|
|
161
161
|
res += Persistence::keys_extract_name(opts,id,'dsl')
|
|
162
162
|
res += Persistence::keys_extract_name(opts,id,'dslx')
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
require 'charlock_holmes'
|
|
16
16
|
require 'mimemagic'
|
|
17
17
|
require 'base64'
|
|
18
|
+
require 'securerandom'
|
|
18
19
|
require 'cpee-eval-ruby/translation'
|
|
19
20
|
|
|
20
21
|
class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
@@ -36,6 +37,8 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
36
37
|
# TODO extract spot (code) where error happened for better error handling (ruby 3.1 only)
|
|
37
38
|
# https://github.com/rails/rails/pull/45818/commits/3beb2aff3be712e44c34a588fbf35b79c0246ca5
|
|
38
39
|
controller = arguments[0]
|
|
40
|
+
puts err.message
|
|
41
|
+
puts err.backtrace
|
|
39
42
|
begin
|
|
40
43
|
controller.notify("description/error", :message => err.backtrace[0].match(/(.*?)(, Line |:)(\d+):\s(.*)/)[4] + err.message, :line => err.backtrace[0].match(/(.*?)(, Line |:)(\d+):/)[3], :where => err.backtrace[0].match(/(.*?)(, Line |:)(\d+):/)[1])
|
|
41
44
|
rescue => e
|
|
@@ -44,6 +47,8 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
44
47
|
end# }}}
|
|
45
48
|
def self::inform_connectionwrapper_error(arguments,err) # {{{
|
|
46
49
|
controller = arguments[0]
|
|
50
|
+
puts err.message
|
|
51
|
+
puts err.backtrace
|
|
47
52
|
begin
|
|
48
53
|
if err.backtrace[0] !~ /, Line/
|
|
49
54
|
controller.notify("executionhandler/error", :message => err.backtrace[0].gsub(/(Activity a\d+)/,'\1:'), :line => -1, :where => err.backtrace[0].match(/Activity a\d+/)[0])
|
|
@@ -68,7 +73,7 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
68
73
|
@handler_continue = continue
|
|
69
74
|
@handler_position = position
|
|
70
75
|
@handler_passthrough = nil
|
|
71
|
-
@handler_activity_uuid =
|
|
76
|
+
@handler_activity_uuid = SecureRandom.hex(16)
|
|
72
77
|
@label = ''
|
|
73
78
|
@guard_files = []
|
|
74
79
|
@guard_items = []
|
|
@@ -93,7 +98,7 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
93
98
|
|
|
94
99
|
def proto_curl(parameters) #{{{
|
|
95
100
|
params = []
|
|
96
|
-
callback =
|
|
101
|
+
callback = SecureRandom.hex(16)
|
|
97
102
|
(parameters[:arguments] || []).each do |s|
|
|
98
103
|
if s.respond_to?(:mimetype)
|
|
99
104
|
params << Riddl::Parameter::Complex.new(s.name.to_s,v.mimetype,v.value)
|
|
@@ -47,6 +47,7 @@ class Controller
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
@attributes_helper = AttributesHelper.new
|
|
50
|
+
@attributes_translated = @attributes_helper.translate(attributes,dataelements,endpoints)
|
|
50
51
|
@thread = nil
|
|
51
52
|
@opts = opts
|
|
52
53
|
@instance = nil
|
|
@@ -87,20 +88,23 @@ class Controller
|
|
|
87
88
|
sleep 1
|
|
88
89
|
retry
|
|
89
90
|
end
|
|
91
|
+
Thread.new do
|
|
92
|
+
while true
|
|
93
|
+
notify("status/resource_utilization", :mib => GetProcessMem.new.mb, **Process.times.to_h)
|
|
94
|
+
sleep 3
|
|
95
|
+
end
|
|
96
|
+
end
|
|
90
97
|
end
|
|
91
98
|
|
|
92
99
|
attr_reader :id
|
|
93
100
|
attr_reader :attributes
|
|
94
101
|
attr_reader :loop_guard
|
|
102
|
+
attr_reader :attributes_translated
|
|
95
103
|
|
|
96
104
|
def uuid
|
|
97
105
|
@attributes['uuid']
|
|
98
106
|
end
|
|
99
107
|
|
|
100
|
-
def attributes_translated
|
|
101
|
-
@attributes_helper.translate(attributes,dataelements,endpoints)
|
|
102
|
-
end
|
|
103
|
-
|
|
104
108
|
def host
|
|
105
109
|
@opts[:host]
|
|
106
110
|
end
|
|
@@ -178,7 +182,7 @@ class Controller
|
|
|
178
182
|
votes = []
|
|
179
183
|
|
|
180
184
|
CPEE::Persistence::extract_handler(id,@opts,handler).each do |client|
|
|
181
|
-
voteid =
|
|
185
|
+
voteid = SecureRandom.hex(16)
|
|
182
186
|
content[:key] = voteid
|
|
183
187
|
content[:attributes] = attributes_translated
|
|
184
188
|
content[:subscription] = client
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
require 'charlock_holmes'
|
|
16
16
|
require 'mimemagic'
|
|
17
17
|
require 'base64'
|
|
18
|
+
require 'securerandom'
|
|
18
19
|
require 'cpee-eval-ruby/translation'
|
|
19
20
|
|
|
20
21
|
class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
@@ -36,6 +37,8 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
36
37
|
# TODO extract spot (code) where error happened for better error handling (ruby 3.1 only)
|
|
37
38
|
# https://github.com/rails/rails/pull/45818/commits/3beb2aff3be712e44c34a588fbf35b79c0246ca5
|
|
38
39
|
controller = arguments[0]
|
|
40
|
+
puts err.message
|
|
41
|
+
puts err.backtrace
|
|
39
42
|
begin
|
|
40
43
|
controller.notify("description/error", :message => err.backtrace[0].match(/(.*?)(, Line |:)(\d+):\s(.*)/)[4] + err.message, :line => err.backtrace[0].match(/(.*?)(, Line |:)(\d+):/)[3], :where => err.backtrace[0].match(/(.*?)(, Line |:)(\d+):/)[1])
|
|
41
44
|
rescue => e
|
|
@@ -44,7 +47,7 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
44
47
|
end# }}}
|
|
45
48
|
def self::inform_connectionwrapper_error(arguments,err) # {{{
|
|
46
49
|
controller = arguments[0]
|
|
47
|
-
|
|
50
|
+
puts err.message
|
|
48
51
|
puts err.backtrace
|
|
49
52
|
begin
|
|
50
53
|
if err.backtrace[0] !~ /, Line/
|
|
@@ -70,7 +73,7 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
70
73
|
@handler_continue = continue
|
|
71
74
|
@handler_position = position
|
|
72
75
|
@handler_passthrough = nil
|
|
73
|
-
@handler_activity_uuid =
|
|
76
|
+
@handler_activity_uuid = SecureRandom.hex(16)
|
|
74
77
|
@label = ''
|
|
75
78
|
@guard_files = []
|
|
76
79
|
@guard_items = []
|
|
@@ -95,7 +98,7 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
95
98
|
|
|
96
99
|
def proto_curl(parameters) #{{{
|
|
97
100
|
params = []
|
|
98
|
-
callback =
|
|
101
|
+
callback = SecureRandom.hex(16)
|
|
99
102
|
(parameters[:arguments] || []).each do |s|
|
|
100
103
|
if s.respond_to?(:mimetype)
|
|
101
104
|
params << Riddl::Parameter::Complex.new(s.name.to_s,v.mimetype,v.value)
|
|
@@ -100,14 +100,13 @@ class Controller
|
|
|
100
100
|
attr_reader :attributes
|
|
101
101
|
attr_reader :loop_guard
|
|
102
102
|
|
|
103
|
-
def uuid
|
|
104
|
-
@attributes['uuid']
|
|
105
|
-
end
|
|
106
|
-
|
|
107
103
|
def attributes_translated
|
|
108
|
-
@attributes_helper.translate(attributes,dataelements,endpoints)
|
|
104
|
+
@attributes_translated || @attributes_translated = @attributes_helper.translate(attributes,dataelements,endpoints)
|
|
109
105
|
end
|
|
110
106
|
|
|
107
|
+
def uuid
|
|
108
|
+
@attributes['uuid']
|
|
109
|
+
end
|
|
111
110
|
def host
|
|
112
111
|
@opts[:host]
|
|
113
112
|
end
|
|
@@ -185,7 +184,7 @@ class Controller
|
|
|
185
184
|
votes = []
|
|
186
185
|
|
|
187
186
|
CPEE::Persistence::extract_handler(id,@opts,handler).each do |client|
|
|
188
|
-
voteid =
|
|
187
|
+
voteid = SecureRandom.hex(16)
|
|
189
188
|
content[:key] = voteid
|
|
190
189
|
content[:attributes] = attributes_translated
|
|
191
190
|
content[:subscription] = client
|
data/server/routing/end.pid
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1672922
|
data/server/routing/end.rb
CHANGED
|
@@ -41,11 +41,11 @@ Daemonite.new do |opts|
|
|
|
41
41
|
instance, uuid = message[0...index].split(',')
|
|
42
42
|
opts[:redis].multi do |multi|
|
|
43
43
|
multi.srem("instance:#{instance}/callbacks",key)
|
|
44
|
-
multi.del("instance:#{instance}/
|
|
45
|
-
multi.del("instance:#{instance}/
|
|
46
|
-
multi.del("instance:#{instance}/
|
|
47
|
-
multi.del("instance:#{instance}/
|
|
48
|
-
multi.del("instance:#{instance}/
|
|
44
|
+
multi.del("instance:#{instance}/callbacks/#{key}/uuid")
|
|
45
|
+
multi.del("instance:#{instance}/callbacks/#{key}/label")
|
|
46
|
+
multi.del("instance:#{instance}/callbacks/#{key}/position")
|
|
47
|
+
multi.del("instance:#{instance}/callbacks/#{key}/type")
|
|
48
|
+
multi.del("instance:#{instance}/callbacks/#{key}/subscription")
|
|
49
49
|
end
|
|
50
50
|
rescue => e
|
|
51
51
|
puts e.message
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1672940
|
|
@@ -16,9 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
require 'redis'
|
|
18
18
|
require 'daemonite'
|
|
19
|
+
require 'concurrent-ruby'
|
|
19
20
|
require 'riddl/client'
|
|
20
21
|
require_relative '../../lib/cpee/redis'
|
|
21
22
|
|
|
23
|
+
HTTP_POOL = Concurrent::FixedThreadPool.new(32)
|
|
24
|
+
|
|
22
25
|
Daemonite.new do |opts|
|
|
23
26
|
opts[:runtime_opts] += [
|
|
24
27
|
["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
|
|
@@ -48,32 +51,35 @@ Daemonite.new do |opts|
|
|
|
48
51
|
topic = ::File::dirname(event)
|
|
49
52
|
name = ::File::basename(event)
|
|
50
53
|
long = File.join(topic,type,name)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
|
|
55
|
+
keys = opts[:redis].smembers("instance:#{instance}/handlers")
|
|
56
|
+
checks = opts[:redis].pipelined { |p| keys.each { |k| p.sismember("instance:#{instance}/handlers/#{k}", long) } }
|
|
57
|
+
matched = keys.zip(checks).select { |_, hit| hit }.map(&:first)
|
|
58
|
+
urls = opts[:redis].pipelined { |p| matched.each { |k| p.get("instance:#{instance}/handlers/#{k}/url") } }
|
|
59
|
+
matched.zip(urls).each do |key, url|
|
|
60
|
+
if url.nil? || url == ""
|
|
61
|
+
opts[:redis].publish("forward:#{instance}/#{key}",mess)
|
|
62
|
+
else
|
|
63
|
+
# Ractor.new(url,type,topic,name,mess) do |url,type,topic,name,mess|
|
|
64
|
+
# sadly typhoes does not support ractors
|
|
65
|
+
HTTP_POOL.post do
|
|
66
|
+
Riddl::Client.new(url).post [
|
|
67
|
+
Riddl::Header.new("CPEE-INSTANCE",instance),
|
|
68
|
+
Riddl::Header.new("CPEE-INSTANCE-UUID",uuid),
|
|
69
|
+
Riddl::Parameter::Simple::new('type',type),
|
|
70
|
+
Riddl::Parameter::Simple::new('topic',topic),
|
|
71
|
+
Riddl::Parameter::Simple::new('event',name),
|
|
72
|
+
Riddl::Parameter::Complex::new('notification','application/json',mess)
|
|
73
|
+
]
|
|
69
74
|
end
|
|
70
75
|
end
|
|
71
76
|
end
|
|
72
77
|
unless opts[:redis].exists?("instance:#{instance}/state")
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
### delete everything under instance
|
|
79
|
+
### how can there be stuff under an instance (handlers, subscriptions)? Are they created later?
|
|
80
|
+
empt = []
|
|
81
|
+
opts[:redis].scan_each("instance:#{instance}/*") { |k| empt << k }
|
|
82
|
+
opts[:redis].del(*empt) unless empt.empty?
|
|
77
83
|
end
|
|
78
84
|
rescue => e
|
|
79
85
|
puts e.message
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1672934
|
|
@@ -24,11 +24,11 @@ require_relative '../../lib/cpee/redis'
|
|
|
24
24
|
def persist_handler(instance,key,mess,redis) #{{{
|
|
25
25
|
redis.multi do |multi|
|
|
26
26
|
multi.sadd("instance:#{instance}/callbacks",key)
|
|
27
|
-
multi.set("instance:#{instance}/
|
|
28
|
-
multi.set("instance:#{instance}/
|
|
29
|
-
multi.set("instance:#{instance}/
|
|
30
|
-
multi.set("instance:#{instance}/
|
|
31
|
-
multi.set("instance:#{instance}/
|
|
27
|
+
multi.set("instance:#{instance}/callbacks/#{key}/subscription",mess.dig('content','subscription'))
|
|
28
|
+
multi.set("instance:#{instance}/callbacks/#{key}/uuid",mess.dig('content','activity-uuid'))
|
|
29
|
+
multi.set("instance:#{instance}/callbacks/#{key}/label",mess.dig('content','label'))
|
|
30
|
+
multi.set("instance:#{instance}/callbacks/#{key}/position",mess.dig('content','activity'))
|
|
31
|
+
multi.set("instance:#{instance}/callbacks/#{key}/type",'vote')
|
|
32
32
|
end
|
|
33
33
|
end #}}}
|
|
34
34
|
|
data/server/routing/persist.pid
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1672928
|
data/server/routing/persist.rb
CHANGED
|
@@ -66,10 +66,10 @@ Daemonite.new do |opts|
|
|
|
66
66
|
key = mess.dig('content','key')
|
|
67
67
|
opts[:redis].multi do |multi|
|
|
68
68
|
multi.sadd("instance:#{instance}/callbacks",key)
|
|
69
|
-
multi.set("instance:#{instance}/
|
|
70
|
-
multi.set("instance:#{instance}/
|
|
71
|
-
multi.set("instance:#{instance}/
|
|
72
|
-
multi.set("instance:#{instance}/
|
|
69
|
+
multi.set("instance:#{instance}/callbacks/#{key}/uuid",mess.dig('content','activity-uuid'))
|
|
70
|
+
multi.set("instance:#{instance}/callbacks/#{key}/label",mess.dig('content','label'))
|
|
71
|
+
multi.set("instance:#{instance}/callbacks/#{key}/position",mess.dig('content','activity'))
|
|
72
|
+
multi.set("instance:#{instance}/callbacks/#{key}/type",'callback')
|
|
73
73
|
end
|
|
74
74
|
when /event:\d+:state\/change/
|
|
75
75
|
opts[:redis].multi do |multi|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cpee
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.119
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juergen eTM Mangler
|
|
@@ -294,6 +294,7 @@ files:
|
|
|
294
294
|
- cockpit/templates/IUPC arXiv:1104.3609 P34 2.xml
|
|
295
295
|
- cockpit/templates/IUPC arXiv:1104.3609 P34 3.xml
|
|
296
296
|
- cockpit/templates/ML-pipe-multi.xml
|
|
297
|
+
- cockpit/templates/Readonly Local.xml
|
|
297
298
|
- cockpit/templates/Subprocess.xml
|
|
298
299
|
- cockpit/templates/Subprocess.xml.attrs
|
|
299
300
|
- cockpit/templates/Track Test Local.xml
|