cpee 1.5.7 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cockpit/index.html +1 -1
- data/cockpit/js/instance.js +5 -5
- data/cockpit/track.html +2 -2
- data/cpee.gemspec +1 -1
- data/lib/cpee/controller.rb +8 -1
- data/server/handlerwrappers/default.rb +68 -59
- data/server/resources/properties.schema.active +7 -0
- data/server/resources/properties.schema.finished +7 -0
- data/server/resources/properties.schema.inactive +7 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34b1f3d471e5c92ca9881d9d87b40e64a2174f124e1798b0f7a0dbd3a0735ead
|
4
|
+
data.tar.gz: aee9d4bd111c3358f93a0131fb832700909539c1bbbea3368c07468de1ae3369
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d4fb94c2c888fbd119ef01740df796346d1ab861ceedc9ba0a2164af557472fec49edd88f9b30f25484ab7997cafd5b54ae753e8d54061684881e338f2f49c1
|
7
|
+
data.tar.gz: bca86531f532f2f05c40d24d50fae035d4d569a798a9e418de6febb2364bc8255e1d9ced729ffbc226e18911f9d6224821529bc3ebe44fca6dc614cd7c9192cc
|
data/cockpit/index.html
CHANGED
@@ -188,7 +188,7 @@
|
|
188
188
|
<button name="state_stop" title='stop'>Stop</button>
|
189
189
|
<span id="state_extended">
|
190
190
|
<span> / </span>
|
191
|
-
<button name="
|
191
|
+
<button name="state_replay" title='replay'>Replay</button>
|
192
192
|
<span> / </span>
|
193
193
|
<button name="state_abandon" title='abandon'>Abandon</button>
|
194
194
|
</span>
|
data/cockpit/js/instance.js
CHANGED
@@ -78,7 +78,7 @@ function cockpit() { //{{{
|
|
78
78
|
$("button[name=savesvg]").click(function(){ save_svg(); });
|
79
79
|
$("button[name=state_start]").click(function(){ $(this).attr("disabled","disabled");start_instance(); });
|
80
80
|
$("button[name=state_stop]").click(function(){ $(this).attr("disabled","disabled");stop_instance(); });
|
81
|
-
$("button[name=
|
81
|
+
$("button[name=state_replay]").click(function(){ $(this).attr("disabled","disabled");replay_instance(); });
|
82
82
|
$("button[name=state_abandon]").click(function(){ aba_instance(); });
|
83
83
|
$("input[name=votecontinue]").click(check_subscription);
|
84
84
|
$("input[name=testsetfile]").change(load_testsetfile_after);
|
@@ -624,13 +624,13 @@ function monitor_instance_state_change(notification) { //{{{
|
|
624
624
|
$('#state_extended').show();
|
625
625
|
$("button[name=state_start]").show();
|
626
626
|
$("button[name=state_stop]").hide();
|
627
|
-
$("button[name=
|
627
|
+
$("button[name=state_replay]").show();
|
628
628
|
$("button[name=state_abandon]").show();
|
629
629
|
} else if (notification == "running") {
|
630
630
|
$('#state_extended').hide();
|
631
631
|
$("button[name=state_start]").hide();
|
632
632
|
$("button[name=state_stop]").show();
|
633
|
-
$("button[name=
|
633
|
+
$("button[name=state_replay]").hide();
|
634
634
|
$("button[name=state_abandon]").hide();
|
635
635
|
}
|
636
636
|
|
@@ -699,12 +699,12 @@ function start_instance() {// {{{
|
|
699
699
|
error: report_failure
|
700
700
|
});
|
701
701
|
}// }}}
|
702
|
-
function
|
702
|
+
function replay_instance() {// {{{
|
703
703
|
var url = $('body').attr('current-instance');
|
704
704
|
$.ajax({
|
705
705
|
type: "PUT",
|
706
706
|
url: url + "/properties/values/state",
|
707
|
-
data: ({value: "
|
707
|
+
data: ({value: "replaying"}),
|
708
708
|
error: report_failure
|
709
709
|
});
|
710
710
|
}// }}}
|
data/cockpit/track.html
CHANGED
@@ -83,11 +83,11 @@
|
|
83
83
|
</button>
|
84
84
|
<span id="state_extended">
|
85
85
|
<span> / </span>
|
86
|
-
<button name="
|
86
|
+
<button name="state_replay" title='replay'>
|
87
87
|
<svg viewBox="0 -1.5 7 12" width="10" height="16">
|
88
88
|
<path
|
89
89
|
style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
90
|
-
d="
|
90
|
+
d="m -0.24999978,8.9999993 c 0,-2.7488167 0,-5.4976332 0,-8.24644997 C 1.1183278,0.76955385 2.4884861,0.71666052 3.8555376,0.79065567 4.5083287,0.83810218 5.2238942,1.0790874 5.5755039,1.7307256 6.1661398,2.7080902 6.0299484,4.2180754 5.1108772,4.9019222 4.7622397,5.1617467 4.3480204,5.2956156 3.9336064,5.3605366 4.9287868,5.9394132 5.4254071,7.0996814 6.0167729,8.0858876 6.1549588,8.3769029 6.4657247,8.7723933 6.5,8.9999999 c -0.5944185,0 -1.1888371,0 -1.7832559,0 C 4.0758679,7.9893475 3.4946311,6.9294648 2.7923497,5.9678488 2.4230355,5.5319748 1.8508715,5.5458842 1.3513114,5.5576027 c -0.1507526,-0.00412 -0.044576,0.272902 -0.076255,0.3990664 0,1.0144436 0,2.028887 0,3.0433307 -0.50835205,-3e-7 -1.01670555,8e-7 -1.52505618,-5e-7 z M 1.2750578,4.2411336 C 2.111059,4.2189781 2.9581852,4.3060525 3.7849326,4.1387394 4.4863715,3.8915585 4.5732952,2.6432813 3.9026802,2.2941453 3.5098807,2.068434 3.050719,2.1857044 2.6267379,2.1489138 c -0.4505578,-0.00242 -0.90112,0.00147 -1.3516801,-3.456e-4 0,0.6975176 0,1.3950347 0,2.0925522 z"
|
91
91
|
</svg>
|
92
92
|
</button>
|
93
93
|
<span> / </span>
|
data/cpee.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cpee"
|
3
|
-
s.version = "1.5.
|
3
|
+
s.version = "1.5.8"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.license = "LGPL-3.0"
|
6
6
|
s.summary = "Preliminary release of cloud process execution engine (cpee). If you just need workflow execution, without a rest/xmpp service exposing it, then use WEEL"
|
data/lib/cpee/controller.rb
CHANGED
@@ -167,6 +167,11 @@ module CPEE
|
|
167
167
|
@thread = @instance.sim
|
168
168
|
end # }}}
|
169
169
|
|
170
|
+
def replay # {{{
|
171
|
+
@thread.join if !@thread.nil? && @thread.alive?
|
172
|
+
@thread = @instance.replay
|
173
|
+
end # }}}
|
174
|
+
|
170
175
|
def start # {{{
|
171
176
|
@thread.join if !@thread.nil? && @thread.alive?
|
172
177
|
unless @positions.empty?
|
@@ -244,7 +249,7 @@ module CPEE
|
|
244
249
|
def serialize_state! # {{{
|
245
250
|
@properties.activate_schema(:finished) if @instance.state == :finished || @instance.state == :abandoned
|
246
251
|
@properties.activate_schema(:inactive) if @instance.state == :stopped || @instance.state == :ready
|
247
|
-
@properties.activate_schema(:active) if @instance.state == :running || @instance.state == :simulating
|
252
|
+
@properties.activate_schema(:active) if @instance.state == :running || @instance.state == :simulating || @instance.state == :replaying
|
248
253
|
if [:finished, :stopped, :ready, :abandoned].include?(@instance.state)
|
249
254
|
state_change! @instance.state
|
250
255
|
end
|
@@ -376,6 +381,8 @@ module CPEE
|
|
376
381
|
start
|
377
382
|
when 'simulating'
|
378
383
|
sim
|
384
|
+
when 'replaying'
|
385
|
+
replay
|
379
386
|
when 'ready'
|
380
387
|
@instance.state_signal
|
381
388
|
when 'abandoned'
|
@@ -46,8 +46,12 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
|
|
46
46
|
@label = ''
|
47
47
|
end # }}}
|
48
48
|
|
49
|
-
def prepare(readonly, endpoints, parameters) #{{{
|
50
|
-
|
49
|
+
def prepare(readonly, endpoints, parameters, replay=false) #{{{
|
50
|
+
if replay
|
51
|
+
@handler_endpoint = @controller.attributes[:replayer]
|
52
|
+
else
|
53
|
+
@handler_endpoint = endpoints.is_a?(Array) ? endpoints.map{ |ep| readonly.endpoints[ep] }.compact : readonly.endpoints[endpoints]
|
54
|
+
end
|
51
55
|
params = parameters.dup
|
52
56
|
params[:arguments] = params[:arguments].dup if params[:arguments]
|
53
57
|
params[:arguments]&.map! do |ele|
|
@@ -60,73 +64,78 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
|
|
60
64
|
params
|
61
65
|
end #}}}
|
62
66
|
|
63
|
-
def
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
params << Riddl::
|
67
|
+
def proto_curl(parameters) #{{{
|
68
|
+
params = []
|
69
|
+
callback = Digest::MD5.hexdigest(Kernel::rand().to_s)
|
70
|
+
(parameters[:arguments] || []).each do |s|
|
71
|
+
if s.respond_to?(:mimetype)
|
72
|
+
params << Riddl::Parameter::Complex.new(s.name.to_s,v.mimetype,v.value)
|
73
|
+
else
|
74
|
+
if s.name.to_s =~ /^__Q_/
|
75
|
+
params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^__Q_/,''),CPEE::ValueHelper::generate(s.value),:query)
|
76
|
+
elsif s.name.to_s =~ /^__B_/
|
77
|
+
params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^__B_/,''),CPEE::ValueHelper::generate(s.value),:body)
|
78
|
+
elsif s.name.to_s =~ /^__H_/
|
79
|
+
params << Riddl::Header.new(s.name.to_s.sub(/^__H_/,''),CPEE::ValueHelper::generate(s.value))
|
80
|
+
elsif s.name.to_s =~ /^__C_/
|
81
|
+
params << Riddl::Parameter::Complex.new(s.name.to_s.sub(/^__C_/,''),*CPEE::ValueHelper::generate(s.value).split(';',2))
|
76
82
|
else
|
77
|
-
|
78
|
-
params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^__Q_/,''),CPEE::ValueHelper::generate(s.value),:query)
|
79
|
-
elsif s.name.to_s =~ /^__B_/
|
80
|
-
params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^__B_/,''),CPEE::ValueHelper::generate(s.value),:body)
|
81
|
-
elsif s.name.to_s =~ /^__H_/
|
82
|
-
params << Riddl::Header.new(s.name.to_s.sub(/^__H_/,''),CPEE::ValueHelper::generate(s.value))
|
83
|
-
elsif s.name.to_s =~ /^__C_/
|
84
|
-
params << Riddl::Parameter::Complex.new(s.name.to_s.sub(/^__C_/,''),*CPEE::ValueHelper::generate(s.value).split(';',2))
|
85
|
-
else
|
86
|
-
params << Riddl::Parameter::Simple.new(s.name.to_s,CPEE::ValueHelper::generate(s.value))
|
87
|
-
end
|
83
|
+
params << Riddl::Parameter::Simple.new(s.name.to_s,CPEE::ValueHelper::generate(s.value))
|
88
84
|
end
|
89
85
|
end
|
86
|
+
end
|
90
87
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
88
|
+
params << Riddl::Header.new("CPEE-BASE",@controller.base_url)
|
89
|
+
params << Riddl::Header.new("CPEE-INSTANCE",@controller.instance)
|
90
|
+
params << Riddl::Header.new("CPEE-INSTANCE-URL",@controller.instance_url)
|
91
|
+
params << Riddl::Header.new("CPEE-INSTANCE-UUID",@controller.uuid)
|
92
|
+
params << Riddl::Header.new("CPEE-CALLBACK",@controller.instance_url + '/callbacks/' + callback)
|
93
|
+
params << Riddl::Header.new("CPEE-CALLBACK-ID",callback)
|
94
|
+
params << Riddl::Header.new("CPEE-ACTIVITY",@handler_position)
|
95
|
+
params << Riddl::Header.new("CPEE-LABEL",@label||'')
|
96
|
+
params << Riddl::Header.new("CPEE-REPLAY",@controller.attributes['replayer_args'])
|
97
|
+
@controller.attributes.each do |key,value|
|
98
|
+
params << Riddl::Header.new("CPEE-ATTR-#{key.to_s.gsub(/_/,'-')}",value)
|
99
|
+
end
|
102
100
|
|
103
|
-
|
104
|
-
|
101
|
+
tendpoint = @handler_endpoint.sub(/^http(s)?-(get|put|post|delete):/,'http\\1:')
|
102
|
+
type = $2 || parameters[:method] || 'post'
|
105
103
|
|
106
|
-
|
104
|
+
client = Riddl::Client.new(tendpoint)
|
107
105
|
|
108
|
-
|
109
|
-
|
106
|
+
@controller.callbacks[callback] = CPEE::Callback.new("callback activity: #{@handler_position}",self,:callback,nil,nil,:http)
|
107
|
+
@handler_passthrough = callback
|
110
108
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
109
|
+
status, result, headers = client.request type => params
|
110
|
+
if status < 200 || status >= 300
|
111
|
+
headers['CPEE_SALVAGE'] = true
|
112
|
+
c = result[0]&.value
|
113
|
+
c = c.read if c.respond_to? :read
|
114
|
+
callback([ Riddl::Parameter::Complex.new('error','application/json',StringIO.new(JSON::generate({ 'status' => status, 'error' => c }))) ], headers)
|
115
|
+
else
|
116
|
+
if headers['CPEE_INSTANTIATION']
|
117
|
+
@controller.notify("task/instantiation", :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :received => CPEE::ValueHelper.parse(headers['CPEE_INSTANTIATION']), :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
|
118
|
+
end
|
119
|
+
if headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.any?
|
120
|
+
headers['CPEE_UPDATE'] = true
|
121
|
+
callback result, headers
|
122
|
+
elsif headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.empty?
|
123
|
+
# do nothing, later on things will happend
|
117
124
|
else
|
118
|
-
|
119
|
-
@controller.notify("task/instantiation", :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :received => CPEE::ValueHelper.parse(headers['CPEE_INSTANTIATION']), :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
|
120
|
-
end
|
121
|
-
if headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.any?
|
122
|
-
headers['CPEE_UPDATE'] = true
|
123
|
-
callback result, headers
|
124
|
-
elsif headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.empty?
|
125
|
-
# do nothing, later on things will happend
|
126
|
-
else
|
127
|
-
callback result, headers
|
128
|
-
end
|
125
|
+
callback result, headers
|
129
126
|
end
|
127
|
+
end
|
128
|
+
end #}}}
|
129
|
+
|
130
|
+
def activity_handle(passthrough, parameters) # {{{
|
131
|
+
raise "Wrong endpoint" if @handler_endpoint.nil? || @handler_endpoint.empty?
|
132
|
+
@label = parameters[:label]
|
133
|
+
@sensors = parameters[:sensors]
|
134
|
+
@aggregators = parameters[:aggregators]
|
135
|
+
@costs = parameters[:costs]
|
136
|
+
@controller.notify("activity/calling", :instance => @controller.instance, :instance_uuid => @controller.uuid, :label => @label, :instance_name => @controller.info, :activity => @handler_position, :passthrough => passthrough, :endpoint => @handler_endpoint, :parameters => parameters, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
|
137
|
+
if passthrough.to_s.empty?
|
138
|
+
proto_curl parameters
|
130
139
|
else
|
131
140
|
@controller.callbacks[passthrough] = CPEE::Callback.new("callback activity: #{@handler_position}",self,:callback,nil,nil,:http)
|
132
141
|
@handler_passthrough = passthrough
|
@@ -71,6 +71,7 @@
|
|
71
71
|
<running putable="true"/>
|
72
72
|
<ready putable="true"/>
|
73
73
|
<simulating putable="true"/>
|
74
|
+
<replaying putable="true"/>
|
74
75
|
<abandoned putable="true"/>
|
75
76
|
</ready>
|
76
77
|
<running>
|
@@ -82,6 +83,11 @@
|
|
82
83
|
<ready putable="false"/>
|
83
84
|
<stopped putable="false"/>
|
84
85
|
</simulating>
|
86
|
+
<replaying>
|
87
|
+
<stopping putable="true"/>
|
88
|
+
<finishing putable="false"/>
|
89
|
+
<finished putable="false"/>
|
90
|
+
</replaying>
|
85
91
|
<stopping>
|
86
92
|
<stopped putable="false"/>
|
87
93
|
</stopping>
|
@@ -89,6 +95,7 @@
|
|
89
95
|
<abandoned putable="true"/>
|
90
96
|
<stopped putable="true"/>
|
91
97
|
<running putable="true"/>
|
98
|
+
<replaying putable="true"/>
|
92
99
|
<simulating putable="true"/>
|
93
100
|
</stopped>
|
94
101
|
<abandoned/>
|
@@ -71,6 +71,7 @@
|
|
71
71
|
<ready putable="true"/>
|
72
72
|
<running putable="true"/>
|
73
73
|
<simulating putable="true"/>
|
74
|
+
<replaying putable="true"/>
|
74
75
|
<abandoned putable="true"/>
|
75
76
|
</ready>
|
76
77
|
<running>
|
@@ -82,6 +83,11 @@
|
|
82
83
|
<ready putable="false"/>
|
83
84
|
<stopped putable="false"/>
|
84
85
|
</simulating>
|
86
|
+
<replaying>
|
87
|
+
<stopping putable="true"/>
|
88
|
+
<finishing putable="false"/>
|
89
|
+
<finished putable="false"/>
|
90
|
+
</replaying>
|
85
91
|
<stopping>
|
86
92
|
<stopped putable="false"/>
|
87
93
|
</stopping>
|
@@ -90,6 +96,7 @@
|
|
90
96
|
<stopped putable="true"/>
|
91
97
|
<running putable="true"/>
|
92
98
|
<simulating putable="true"/>
|
99
|
+
<replaying putable="true"/>
|
93
100
|
</stopped>
|
94
101
|
<abandoned/>
|
95
102
|
<finished/>
|
@@ -71,6 +71,7 @@
|
|
71
71
|
<running putable="true"/>
|
72
72
|
<ready putable="true"/>
|
73
73
|
<simulating putable="true"/>
|
74
|
+
<replaying putable="true"/>
|
74
75
|
<abandoned putable="true"/>
|
75
76
|
</ready>
|
76
77
|
<running>
|
@@ -82,14 +83,17 @@
|
|
82
83
|
<ready putable="false"/>
|
83
84
|
<stopped putable="false"/>
|
84
85
|
</simulating>
|
85
|
-
<
|
86
|
-
<
|
87
|
-
|
86
|
+
<replaying>
|
87
|
+
<stopping putable="true"/>
|
88
|
+
<finishing putable="false"/>
|
89
|
+
<finished putable="false"/>
|
90
|
+
</replaying>
|
88
91
|
<stopped>
|
89
92
|
<abandoned putable="true"/>
|
90
93
|
<stopped putable="true"/>
|
91
94
|
<running putable="true"/>
|
92
95
|
<simulating putable="true"/>
|
96
|
+
<replaying putable="true"/>
|
93
97
|
</stopped>
|
94
98
|
<abandoned/>
|
95
99
|
<finished/>
|
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: 1.5.
|
4
|
+
version: 1.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: tools
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-10-
|
14
|
+
date: 2019-10-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: riddl
|