cpee 2.1.70 → 2.1.71
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 +13 -1
- data/cockpit/templates/{Coopis 2010 Ext.xml → Coopis 2010 Eval.xml } +2 -3
- data/cockpit/themes/reduced/rngs/alternative.rng +25 -0
- data/cockpit/themes/reduced/rngs/call.rng +228 -0
- data/cockpit/themes/reduced/rngs/callmanipulate.rng +257 -0
- data/cockpit/themes/reduced/rngs/choose.rng +14 -0
- data/cockpit/themes/reduced/rngs/closed_loop.rng +62 -0
- data/cockpit/themes/reduced/rngs/closed_loop_cancel.rng +5 -0
- data/cockpit/themes/reduced/rngs/closed_loop_control.rng +31 -0
- data/cockpit/themes/reduced/rngs/closed_loop_measuring.rng +12 -0
- data/cockpit/themes/reduced/rngs/critical.rng +5 -0
- data/cockpit/themes/reduced/rngs/escape.rng +1 -0
- data/cockpit/themes/reduced/rngs/group.rng +3 -0
- data/cockpit/themes/reduced/rngs/loop.rng +22 -0
- data/cockpit/themes/reduced/rngs/manipulate.rng +9 -0
- data/cockpit/themes/reduced/rngs/otherwise.rng +22 -0
- data/cockpit/themes/reduced/rngs/parallel.rng +27 -0
- data/cockpit/themes/reduced/rngs/parallel_branch.rng +2 -0
- data/cockpit/themes/reduced/rngs/scripts.rng +23 -0
- data/cockpit/themes/reduced/rngs/start.rng +131 -0
- data/cockpit/themes/reduced/rngs/stop.rng +5 -0
- data/cockpit/themes/reduced/rngs/terminate.rng +1 -0
- data/cockpit/themes/reduced/symbols/alternative.svg +5 -0
- data/cockpit/themes/reduced/symbols/arrow.svg +3 -0
- data/cockpit/themes/reduced/symbols/call.svg +6 -0
- data/cockpit/themes/reduced/symbols/call_sensor.svg +9 -0
- data/cockpit/themes/reduced/symbols/callmanipulate.svg +8 -0
- data/cockpit/themes/reduced/symbols/callmanipulate_sensor.svg +11 -0
- data/cockpit/themes/reduced/symbols/choose.svg +5 -0
- data/cockpit/themes/reduced/symbols/choose_exclusive.svg +5 -0
- data/cockpit/themes/reduced/symbols/choose_inclusive.svg +4 -0
- data/cockpit/themes/reduced/symbols/closed_loop.svg +5 -0
- data/cockpit/themes/reduced/symbols/closed_loop_cancel.svg +5 -0
- data/cockpit/themes/reduced/symbols/closed_loop_control.svg +5 -0
- data/cockpit/themes/reduced/symbols/closed_loop_measuring.svg +6 -0
- data/cockpit/themes/reduced/symbols/complex.svg +8 -0
- data/cockpit/themes/reduced/symbols/critical.svg +4 -0
- data/cockpit/themes/reduced/symbols/delete.svg +4 -0
- data/cockpit/themes/reduced/symbols/end.svg +3 -0
- data/cockpit/themes/reduced/symbols/escape.svg +5 -0
- data/cockpit/themes/reduced/symbols/event_end.svg +3 -0
- data/cockpit/themes/reduced/symbols/loop.svg +5 -0
- data/cockpit/themes/reduced/symbols/manipulate.svg +4 -0
- data/cockpit/themes/reduced/symbols/otherwise.svg +5 -0
- data/cockpit/themes/reduced/symbols/parallel.svg +5 -0
- data/cockpit/themes/reduced/symbols/parallel_branch.svg +5 -0
- data/cockpit/themes/reduced/symbols/parallel_branch_compact.svg +4 -0
- data/cockpit/themes/reduced/symbols/parallel_branch_event.svg +14 -0
- data/cockpit/themes/reduced/symbols/parallel_branch_normal.svg +5 -0
- data/cockpit/themes/reduced/symbols/parallel_eventbased_exclusive.svg +9 -0
- data/cockpit/themes/reduced/symbols/parallel_eventbased_parallel.svg +8 -0
- data/cockpit/themes/reduced/symbols/scripts.svg +4 -0
- data/cockpit/themes/reduced/symbols/start.svg +3 -0
- data/cockpit/themes/reduced/symbols/start_event.svg +5 -0
- data/cockpit/themes/reduced/symbols/stop.svg +5 -0
- data/cockpit/themes/reduced/symbols/terminate.svg +4 -0
- data/cockpit/themes/reduced/theme.js +11 -0
- data/cpee.gemspec +1 -1
- data/server/executionhandlers/{rubyext → eval}/backend/opts.yaml +1 -3
- data/server/executionhandlers/{rubyext → eval}/connection.rb +37 -106
- data/server/executionhandlers/{rubyext → eval}/controller.rb +0 -6
- data/server/executionhandlers/{rubyext → eval}/execution.rb +20 -22
- data/server/executionhandlers/ruby/backend/opts.yaml +2 -0
- data/server/executionhandlers/ruby/connection.rb +154 -57
- data/server/executionhandlers/ruby/controller.rb +16 -0
- data/server/executionhandlers/ruby/dsl_to_dslx.xsl +29 -29
- data/server/executionhandlers/ruby/execution.rb +15 -13
- data/server/routing/end.pid +1 -1
- data/server/routing/forward-events-00.pid +1 -1
- data/server/routing/forward-votes.pid +1 -1
- data/server/routing/persist.pid +1 -1
- metadata +67 -12
- /data/server/executionhandlers/{rubyext → eval}/backend/README.md +0 -0
- /data/server/executionhandlers/{rubyext → eval}/backend/instance.template +0 -0
- /data/server/executionhandlers/{rubyext → eval}/backend/run +0 -0
- /data/server/executionhandlers/{rubyext → eval}/dsl_to_dslx.xsl +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg class="clickable" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="11" y="6" width="9" height="18" rx="0" class="hline white"/>
|
|
3
|
+
<path class="cline hfill stand" d="M 11,5 C 2,9 2,21 11,25 M 20,5 C 29,9 29,21 20,25" style="stroke-dasharray:1,4;"/>
|
|
4
|
+
<line x1="15.6" y1="4" x2="15.6" y2="27" class="ourline"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg class="clickable" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="1" y="3" width="24" height="24" rx="4" class="hfill rfill cline stand"/>
|
|
3
|
+
|
|
4
|
+
<circle cx="24" cy="15" r="9" class="cline rfill standthin" style="stroke-dasharray: 1,2"/>
|
|
5
|
+
<circle cx="24" cy="15" r="7" class="cline rfill standthin" style="stroke-dasharray: 1,2"/>
|
|
6
|
+
<line x1="24" y1="11" x2="20" y2="18" class="stand"/>
|
|
7
|
+
<line x1="20" y1="18" x2="28" y2="18" class="stand"/>
|
|
8
|
+
<line x1="28" y1="18" x2="24" y2="11" class="stand"/>
|
|
9
|
+
|
|
10
|
+
<circle cx="55.5" cy="15" r="14" class="cline hfill rfill stand"/>
|
|
11
|
+
<line x1="55.5" y1="11" x2="51.5" y2="18" class="stand"/>
|
|
12
|
+
<line x1="51.5" y1="18" x2="59.5" y2="18" class="stand"/>
|
|
13
|
+
<line x1="59.5" y1="18" x2="55.5" y2="11" class="stand"/>
|
|
14
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg class="clickable" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="11" y="6" width="9" height="18" rx="0" class="hline white"/>
|
|
3
|
+
<path class="cline hfill stand" d="M 11,5 C 2,9 2,21 11,25 M 20,5 C 29,9 29,21 20,25" style="stroke-dasharray:1,4;"/>
|
|
4
|
+
<line x1="15.6" y1="4" x2="15.6" y2="27" class="ourline"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg class="clickable" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect transform="rotate(45,14,12)" x="7" y="3" width="21" height="21" class="cline hfill stand"/>
|
|
3
|
+
<circle cx="15.5" cy="15.5" r="8" class="standthin"/>
|
|
4
|
+
<circle cx="15.5" cy="15.5" r="6" class="standthin"/>
|
|
5
|
+
<path
|
|
6
|
+
d="m 15.500001,11.435193 3.825246,2.779205 -1.461114,4.496849 h -4.728265 l -1.461115,-4.496849 z"
|
|
7
|
+
class="stand"/>
|
|
8
|
+
</svg>
|
|
9
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg class="clickable" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect transform="rotate(45,14,12)" x="7" y="3" width="21" height="21" class="cline hfill stand"/>
|
|
3
|
+
<circle cx="15.5" cy="15.5" r="8" class="standthin"/>
|
|
4
|
+
<circle cx="15.5" cy="15.5" r="6" class="standthin"/>
|
|
5
|
+
<line x1="12.5" y1="15.5" x2="18.5" y2="15.5" class="stand"/>
|
|
6
|
+
<line x1="15.5" y1="12.5" x2="15.5" y2="18.5" class="stand"/>
|
|
7
|
+
</svg>
|
|
8
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg class="clickable" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="15" cy="15" r="14" class="hfill rfill cline stand"/>
|
|
3
|
+
<rect x="7" y="10" width="16" height="11" class="black" style="fill: none"/>
|
|
4
|
+
<path d="m 7,10 8,6 8,-6" class="black" style="fill: none"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
WFAdaptorManifestation = class extends WFAdaptorManifestationBase {
|
|
2
|
+
constructor(adaptor) {
|
|
3
|
+
super(adaptor);
|
|
4
|
+
var self = this;
|
|
5
|
+
this.striped = true;
|
|
6
|
+
this.elements.choose.illustrator.label = null;
|
|
7
|
+
this.elements.alternative.illustrator.label = null;
|
|
8
|
+
this.elements.loop_finish.illustrator.label = null;
|
|
9
|
+
this.elements.loop_head.illustrator.label = null;
|
|
10
|
+
}
|
|
11
|
+
}
|
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.71"
|
|
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."
|
|
@@ -36,18 +36,18 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
36
36
|
def self::inform_syntax_error(arguments,err,code)# {{{
|
|
37
37
|
# TODO extract spot (code) where error happened for better error handling (ruby 3.1 only)
|
|
38
38
|
# https://github.com/rails/rails/pull/45818/commits/3beb2aff3be712e44c34a588fbf35b79c0246ca5
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
p err.backtrace
|
|
39
|
+
puts err.message
|
|
40
|
+
puts err.backtrace
|
|
42
41
|
controller = arguments[0]
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
#controller.notify("description/error", :message => err.message, :line => err.backtrace[0].match(/(.*?):(\d+):/)[2], :where => err.backtrace[0].match(/(.*?):(\d+):/)[1])
|
|
42
|
+
mess = err.backtrace ? err.backtrace[0].gsub(/([\w -_]+):(\d+):in.*/,'\\1, Line \2: ') : ''
|
|
43
|
+
mess += err.message
|
|
44
|
+
controller.notify("description/error", :message => mess)
|
|
47
45
|
end# }}}
|
|
48
46
|
def self::inform_connectionwrapper_error(arguments,err) # {{{
|
|
49
47
|
controller = arguments[0]
|
|
50
|
-
|
|
48
|
+
puts err.message
|
|
49
|
+
puts err.backtrace
|
|
50
|
+
controller.notify("executionhandler/error", :message => err.backtrace[0].gsub(/([\w -_]+):(\d+):in.*/,'\\1, Line \2: ') + err.message)
|
|
51
51
|
end # }}}
|
|
52
52
|
def self::inform_position_change(arguments,ipc={}) # {{{
|
|
53
53
|
controller = arguments[0]
|
|
@@ -249,7 +249,9 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
249
249
|
@controller.notify("activity/manipulating", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position)
|
|
250
250
|
end # }}}
|
|
251
251
|
def inform_activity_failed(err) # {{{
|
|
252
|
-
|
|
252
|
+
puts err.message
|
|
253
|
+
puts err.backtrace
|
|
254
|
+
@controller.notify("activity/failed", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position, :message => err.message, :line => err.backtrace[0].match(/(.*?):(\d+):/)[2], :where => err.backtrace[0].match(/(.*?):(\d+):/)[1])
|
|
253
255
|
end # }}}
|
|
254
256
|
def inform_manipulate_change(status,changed_dataelements,changed_endpoints,dataelements,endpoints) # {{{
|
|
255
257
|
unless status.nil?
|
|
@@ -272,17 +274,10 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
272
274
|
end # }}}
|
|
273
275
|
|
|
274
276
|
def callback(result=nil,options={}) #{{{
|
|
275
|
-
|
|
276
|
-
recv = if status >= 200 && status < 300
|
|
277
|
-
JSON::parse(ret[0].value.read)
|
|
278
|
-
else
|
|
279
|
-
nil
|
|
280
|
-
end
|
|
281
|
-
|
|
277
|
+
recv = CPEE::EvalRuby::Translation::structurize_result(result)
|
|
282
278
|
@controller.notify("activity/receiving", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => recv, :annotations => @anno)
|
|
283
279
|
|
|
284
280
|
@guard_files += result
|
|
285
|
-
@guard_files += ret
|
|
286
281
|
|
|
287
282
|
if options['CPEE_INSTANTIATION']
|
|
288
283
|
@controller.notify("task/instantiation", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => CPEE::ValueHelper.parse(options['CPEE_INSTANTIATION']))
|
|
@@ -323,106 +318,42 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
323
318
|
GC.start
|
|
324
319
|
end #}}}
|
|
325
320
|
|
|
326
|
-
def
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
case sig
|
|
330
|
-
when 'Signal::Again'; throw WEEL::Signal::Again
|
|
331
|
-
when 'Signal::Error'; raise what, '', [where + ' ' + sigt]
|
|
332
|
-
when 'Signal::Stop'; raise WEEL::Signal::Stop
|
|
333
|
-
when 'Signal::SyntaxError'; raise SyntaxError, '', [where + ' ' + sigt]
|
|
334
|
-
else
|
|
335
|
-
raise 'something bad happened, but we dont know what.'
|
|
336
|
-
end
|
|
337
|
-
end #}}}
|
|
338
|
-
def prepare(lock,dataelements,endpoints,status,local,additional,code,exec_endpoints,exec_parameters) #{{{
|
|
339
|
-
struct = if code
|
|
340
|
-
manipulate(true,lock,dataelements,endpoints,status,local,additional,code,'prepare')
|
|
321
|
+
def prepare(__lock,__dataelements,__endpoints,__status,__local,__additional,__code,__exec_endpoints,__exec_parameters) #{{{
|
|
322
|
+
__struct = if __code
|
|
323
|
+
manipulate(true,__lock,__dataelements,__endpoints,__status,__local,__additional,__code,'Parameter')
|
|
341
324
|
else
|
|
342
|
-
WEEL::ReadStructure.new(
|
|
325
|
+
WEEL::ReadStructure.new(__dataelements,__endpoints,__local,__additional)
|
|
343
326
|
end
|
|
344
|
-
@handler_endpoint =
|
|
327
|
+
@handler_endpoint = __exec_endpoints.is_a?(Array) ? __exec_endpoints.map{ |ep| __struct.endpoints[ep] }.compact : __struct.endpoints[__exec_endpoints]
|
|
345
328
|
if @controller.attributes['twin_engine']
|
|
346
329
|
@handler_endpoint_orig = @handler_endpoint
|
|
347
330
|
@handler_endpoint = @controller.attributes['twin_engine'].to_s + '?original_endpoint=' + Riddl::Protocols::Utils::escape(@handler_endpoint)
|
|
348
331
|
end
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
if
|
|
354
|
-
|
|
355
|
-
send.push Riddl::Parameter::Simple::new('code',t.value.code)
|
|
356
|
-
send.push Riddl::Parameter::Complex::new('dataelements','application/json', JSON::generate(struct.data))
|
|
357
|
-
send.push Riddl::Parameter::Complex::new('local','application/json', JSON::generate(struct.local)) if struct.local
|
|
358
|
-
send.push Riddl::Parameter::Complex::new('endpoints','application/json', JSON::generate(struct.endpoints))
|
|
359
|
-
send.push Riddl::Parameter::Complex::new('additional','application/json', JSON::generate(struct.additional))
|
|
360
|
-
|
|
361
|
-
status, ret, headers = Riddl::Client.new(@controller.url_code).request 'put' => send
|
|
362
|
-
recv = if status >= 200 && status < 300
|
|
363
|
-
ret[0].value
|
|
364
|
-
else
|
|
365
|
-
code_error_handling ret, 'Parameter ' + t.value.code
|
|
366
|
-
end
|
|
367
|
-
t.value = recv
|
|
332
|
+
__params = __exec_parameters.dup
|
|
333
|
+
__params[:arguments] = __params[:arguments].dup if __params[:arguments]
|
|
334
|
+
__params[:arguments]&.map! do |__ele|
|
|
335
|
+
__tmp = __ele.dup
|
|
336
|
+
if __tmp.value.is_a?(WEEL::ProcString)
|
|
337
|
+
__tmp.value = __struct.instance_eval __tmp.value.code, 'Parameter', 1
|
|
368
338
|
end
|
|
369
|
-
|
|
339
|
+
__tmp
|
|
370
340
|
end
|
|
371
|
-
|
|
341
|
+
__params
|
|
372
342
|
end #}}}
|
|
373
|
-
def test_condition(
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
send.push Riddl::Parameter::Complex::new('local','application/json', JSON::generate(local)) if local
|
|
378
|
-
send.push Riddl::Parameter::Complex::new('endpoints','application/json', JSON::generate(endpoints))
|
|
379
|
-
send.push Riddl::Parameter::Complex::new('additional','application/json', JSON::generate(additional))
|
|
380
|
-
|
|
381
|
-
status, ret, headers = Riddl::Client.new(@controller.url_code).request 'put' => send
|
|
382
|
-
recv = if status >= 200 && status < 300
|
|
383
|
-
ret[0].value
|
|
384
|
-
else
|
|
385
|
-
code_error_handling ret, 'Condition ' + code, WEEL::Signal::Error
|
|
386
|
-
end
|
|
387
|
-
recv = 'false' unless recv
|
|
388
|
-
recv = (recv == 'false' || recv == 'null' || recv == 'nil' ? false : true)
|
|
389
|
-
@controller.notify("gateway/decide", :instance_uuid => @controller.uuid, :code => code, :condition => recv)
|
|
390
|
-
recv
|
|
343
|
+
def test_condition(__dataelements,__endpoints,__local,__additional,__code,__args={}) #{{{
|
|
344
|
+
__struct = WEEL::ReadStructure.new(__dataelements,__endpoints,__local,__additional).instance_eval(__code,'Condition',1)
|
|
345
|
+
@controller.notify("gateway/decide", :instance_uuid => @controller.uuid, :code => __code, :condition => (__struct ? "true" : "false"))
|
|
346
|
+
__struct
|
|
391
347
|
end #}}}
|
|
392
|
-
def manipulate(
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
send.push Riddl::Parameter::Complex::new('endpoints','application/json', JSON::generate(endpoints))
|
|
399
|
-
send.push Riddl::Parameter::Complex::new('additional','application/json', JSON::generate(additional))
|
|
400
|
-
send.push Riddl::Parameter::Complex::new('status','application/json', JSON::generate(status)) if status
|
|
401
|
-
send.push Riddl::Parameter::Complex::new('call_result','application/json', JSON::generate(result))
|
|
402
|
-
send.push Riddl::Parameter::Complex::new('call_headers','application/json', JSON::generate(options))
|
|
403
|
-
|
|
404
|
-
stat, ret, headers = Riddl::Client.new(@controller.url_code).request 'put' => send
|
|
405
|
-
if stat >= 200 && stat < 300
|
|
406
|
-
ret.shift # drop result
|
|
407
|
-
signal = changed_status = nil
|
|
408
|
-
changed_dataelements = changed_local = changed_endpoints = []
|
|
409
|
-
signal = ret.shift.value if ret.any? && ret[0].name == 'signal'
|
|
410
|
-
changed_dataelements = JSON::parse(ret.shift.value.read) if ret.any? && ret[0].name == 'changed_dataelements'
|
|
411
|
-
changed_endpoints = JSON::parse(ret.shift.value.read) if ret.any? && ret[0].name == 'changed_endpoints'
|
|
412
|
-
changed_status = JSON::parse(ret.shift.value.read) if ret.any? && ret[0].name == 'changed_status'
|
|
413
|
-
|
|
414
|
-
struct = if readonly
|
|
415
|
-
WEEL::ReadStructure.new(dataelements,endpoints,local,additional)
|
|
416
|
-
else
|
|
417
|
-
WEEL::ManipulateStructure.new(dataelements, endpoints, status, local, additional)
|
|
418
|
-
end
|
|
419
|
-
struct.update(changed_dataelements,changed_endpoints,changed_status)
|
|
420
|
-
|
|
421
|
-
struct
|
|
422
|
-
else
|
|
423
|
-
code_error_handling ret, where
|
|
424
|
-
end
|
|
348
|
+
def manipulate(__readonly,__lock,__dataelements,__endpoints,__status,__local,__additional,__code,__where,__result=nil,__options=nil) #{{{
|
|
349
|
+
result = CPEE::EvalRuby::Translation::simplify_structurized_result(__result)
|
|
350
|
+
__struct = if __readonly
|
|
351
|
+
WEEL::ReadStructure.new(__dataelements,__endpoints,__local,__additional)
|
|
352
|
+
else
|
|
353
|
+
WEEL::ManipulateStructure.new(__dataelements,__endpoints,__status,__local,__additional)
|
|
425
354
|
end
|
|
355
|
+
__struct.instance_eval(__code,__where,1)
|
|
356
|
+
__struct
|
|
426
357
|
end #}}}
|
|
427
358
|
|
|
428
359
|
def split_branches(branches) # factual, so for inclusive or [[a],[b],[c,d,e]]{{{
|
|
@@ -125,12 +125,6 @@ class Controller
|
|
|
125
125
|
def dataelements
|
|
126
126
|
@instance.data
|
|
127
127
|
end
|
|
128
|
-
def url_result_transformation
|
|
129
|
-
@opts[:url_result_transformation]
|
|
130
|
-
end
|
|
131
|
-
def url_code
|
|
132
|
-
@opts[:url_code]
|
|
133
|
-
end
|
|
134
128
|
|
|
135
129
|
def start
|
|
136
130
|
if vote("state/change", :state => 'running')
|
|
@@ -16,21 +16,21 @@ module CPEE
|
|
|
16
16
|
|
|
17
17
|
module ExecutionHandler
|
|
18
18
|
|
|
19
|
-
module
|
|
19
|
+
module Eval
|
|
20
20
|
BACKEND_INSTANCE = 'instance.rb'
|
|
21
|
+
BACKEND_OPTS = 'opts.yaml'
|
|
21
22
|
DSL_TO_DSLX_XSL = File.expand_path(File.join(__dir__,'dsl_to_dslx.xsl'))
|
|
22
23
|
BACKEND_RUN = File.expand_path(File.join(__dir__,'backend','run'))
|
|
23
|
-
BACKEND_OPTS = File.expand_path(File.join(__dir__,'backend','opts.yaml'))
|
|
24
24
|
BACKEND_TEMPLATE = File.expand_path(File.join(__dir__,'backend','instance.template'))
|
|
25
25
|
|
|
26
26
|
def self::dslx_to_dsl(dslx) # transpile
|
|
27
|
-
trans = XML::Smart::open_unprotected(ExecutionHandler::
|
|
27
|
+
trans = XML::Smart::open_unprotected(ExecutionHandler::Eval::DSL_TO_DSLX_XSL)
|
|
28
28
|
dslx.transform_with(trans).to_s
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def self::prepare(id,opts) # write result to disk
|
|
32
32
|
Dir.mkdir(File.join(opts[:instances],id.to_s)) rescue nil
|
|
33
|
-
FileUtils.copy(ExecutionHandler::
|
|
33
|
+
FileUtils.copy(ExecutionHandler::Eval::BACKEND_RUN,File.join(opts[:instances],id.to_s))
|
|
34
34
|
dsl = CPEE::Persistence::extract_item(id,opts,'dsl')
|
|
35
35
|
hw = CPEE::Persistence::extract_item(id,opts,'executionhandler')
|
|
36
36
|
endpoints = CPEE::Persistence::extract_list(id,opts,'endpoints')
|
|
@@ -39,35 +39,33 @@ module CPEE
|
|
|
39
39
|
positions.map! do |k, v|
|
|
40
40
|
[ k, v, CPEE::Persistence::extract_item(id,opts,File.join('positions',k,'@passthrough')) ]
|
|
41
41
|
end
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
File.open(File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Rubyext::BACKEND_OPTS)),'w') do |f|
|
|
55
|
-
YAML::dump(iopts,f)
|
|
42
|
+
File.open(File.join(opts[:instances],id.to_s,ExecutionHandler::Eval::BACKEND_OPTS),'w') do |f|
|
|
43
|
+
YAML::dump({
|
|
44
|
+
:host => opts[:host],
|
|
45
|
+
:url => opts[:url],
|
|
46
|
+
:redis_url => opts[:redis_url],
|
|
47
|
+
:redis_path => File.join(opts[:basepath],opts[:redis_path]),
|
|
48
|
+
:redis_db => opts[:redis_db],
|
|
49
|
+
:workers => opts[:workers],
|
|
50
|
+
:global_executionhandlers => opts[:global_executionhandlers],
|
|
51
|
+
:executionhandlers => opts[:executionhandlers],
|
|
52
|
+
:executionhandler => hw
|
|
53
|
+
},f)
|
|
56
54
|
end
|
|
57
|
-
template = ERB.new(File.read(ExecutionHandler::
|
|
55
|
+
template = ERB.new(File.read(ExecutionHandler::Eval::BACKEND_TEMPLATE), trim_mode: '-')
|
|
58
56
|
res = template.result_with_hash(dsl: dsl, dataelements: dataelements, endpoints: endpoints, positions: positions)
|
|
59
|
-
File.write(File.join(opts[:instances],id.to_s,ExecutionHandler::
|
|
57
|
+
File.write(File.join(opts[:instances],id.to_s,ExecutionHandler::Eval::BACKEND_INSTANCE),res)
|
|
60
58
|
end
|
|
61
59
|
|
|
62
60
|
def self::run(id,opts)
|
|
63
|
-
exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::
|
|
61
|
+
exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Eval::BACKEND_RUN))
|
|
64
62
|
pid = Kernel.spawn(exe , :pgroup => true, :in => '/dev/null', :out => exe + '.out', :err => exe + '.err')
|
|
65
63
|
Process.detach pid
|
|
66
64
|
File.write(exe + '.pid',pid)
|
|
67
65
|
end
|
|
68
66
|
|
|
69
67
|
def self::stop(id,opts) ### return: bool to tell if manually changing redis is necessary
|
|
70
|
-
exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::
|
|
68
|
+
exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Eval::BACKEND_RUN))
|
|
71
69
|
pid = File.read(exe + '.pid') rescue nil
|
|
72
70
|
if pid && (Process.kill(0, pid.to_i) rescue false)
|
|
73
71
|
Process.kill('HUP', pid.to_i) rescue nil
|