cpee-instantiation 1.0.1 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8179be00caf9485a82cc72f3180439fa8db27a45ee8ff58b7e642534e7397aa
4
- data.tar.gz: 1d9b5a792f4a95a35c5368c78ba03134ed84a751e873c10751771297998aaf2a
3
+ metadata.gz: 9efdce12606b0b4a2dcc8edb56a511a8b4392afa1de52d55df1d89f7037ad96d
4
+ data.tar.gz: b7ddc4881dadce16e7dfd2da9db9c0bd68c8b70dfe9dc8c8180a3cef75f1dcee
5
5
  SHA512:
6
- metadata.gz: 852d8a607287b4dfd197c45386ebc9d83bdead3428e454736341586a7166088ac12044000714e91f181c286d8d282c86908b089e9a8a047a2be580f071a29616
7
- data.tar.gz: 60982f32ca0a4ebef7628de4b8f444022071ae437b8494e6bef310c6e2bf7a1c70fe65fb527fe1ce444a7e40e67228b6440c89f5c9da58d7a62fc083253fa87e
6
+ metadata.gz: 4b65153017b9a2f2c7853e0d7ec658cba83b6e3eabe79425b3166ca818ae8a0f61ee36242c9b5cf080db41938b55c7652e6e37765c47b2fb282656fe25ad5ae6
7
+ data.tar.gz: 7b1a05794b4f6df41298f01ade332459806e613989f70f35c58b9786b86b7e38d9added2762b1bafe432de625910d25625d3bf1c27860180afec09730cdaeea9
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-instantiation"
3
- s.version = "1.0.1"
3
+ s.version = "1.0.7"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Subprocess instantiation service for the cloud process execution engine (cpee.org)"
@@ -23,5 +23,5 @@ Gem::Specification.new do |s|
23
23
  s.add_runtime_dependency 'riddl', '~> 0.99'
24
24
  s.add_runtime_dependency 'json', '~> 2.1'
25
25
  s.add_runtime_dependency 'redis', '~> 4.1'
26
- s.add_runtime_dependency 'cpee', '~> 1', '>= 1.5'
26
+ s.add_runtime_dependency 'cpee', '~> 2.1'
27
27
  end
@@ -30,7 +30,7 @@ module CPEE
30
30
  SERVER = File.expand_path(File.join(__dir__,'instantiation.xml'))
31
31
 
32
32
  module Helpers #{{{
33
- def load_testset(tdoc,cpee,name=nil,stream=nil) #{{{
33
+ def load_testset(tdoc,cpee,name=nil,customization=nil) #{{{
34
34
  ins = -1
35
35
  uuid = nil
36
36
  XML::Smart.string(tdoc) do |doc|
@@ -44,13 +44,13 @@ module CPEE
44
44
  e.text = name
45
45
  end
46
46
  end
47
- if stream && !stream.empty?
48
- JSON.parse(stream).each do |e|
47
+ if customization && !customization.empty?
48
+ JSON.parse(customization).each do |e|
49
49
  begin
50
- stream = Typhoeus.get e['url']
51
- if stream.success?
52
- XML::Smart::string(stream.response_body) do |str|
53
- doc.find("//desc:call[@id=\"#{e['id']}\"]/desc:parameters/desc:stream").each do |ele|
50
+ customization = Typhoeus.get e['url']
51
+ if customization.success?
52
+ XML::Smart::string(customization.response_body) do |str|
53
+ doc.find("//desc:call[@id=\"#{e['id']}\"]/desc:parameters/desc:customization").each do |ele|
54
54
  ele.replace_by str.root
55
55
  end
56
56
  end
@@ -70,7 +70,7 @@ module CPEE
70
70
 
71
71
  inp = XML::Smart::string('<properties xmlns="http://cpee.org/ns/properties/2.0"/>')
72
72
  inp.register_namespace 'prop', 'http://cpee.org/ns/properties/2.0'
73
- %w{handlerwrapper positions dataelements endpoints attributes description transformation}.each do |item|
73
+ %w{executionhandler positions dataelements endpoints attributes description transformation}.each do |item|
74
74
  ele = doc.find("/*/prop:#{item}")
75
75
  inp.root.add(ele.first) if ele.any?
76
76
  end
@@ -96,7 +96,6 @@ module CPEE
96
96
  def handle_waiting(cpee,instance,uuid,behavior,selfurl,cblist) #{{{
97
97
  if behavior =~ /^wait/
98
98
  condition = behavior.match(/_([^_]+)_/)&.[](1) || 'finished'
99
- @headers << Riddl::Header.new('CPEE-CALLBACK','true')
100
99
  cb = @h['CPEE_CALLBACK']
101
100
 
102
101
  if cb
@@ -128,7 +127,7 @@ module CPEE
128
127
  private :handle_starting
129
128
  def handle_data(cpee,instance,data) #{{{
130
129
  if data && !data.empty?
131
- content = XML::Smart.string('<dataelements xmlns="http://cpee.org/ns/properties/2.0">')
130
+ content = XML::Smart.string('<dataelements xmlns="http://cpee.org/ns/properties/2.0"/>')
132
131
  JSON::parse(data).each do |k,v|
133
132
  content.root.add(k,v)
134
133
  end
@@ -141,7 +140,7 @@ module CPEE
141
140
  end #}}}
142
141
  def handle_endpoints(cpee,instance,data) #{{{
143
142
  if data && !data.empty?
144
- content = XML::Smart.string('<endpoints xmlns="http://cpee.org/ns/properties/2.0">')
143
+ content = XML::Smart.string('<endpoints xmlns="http://cpee.org/ns/properties/2.0"/>')
145
144
  JSON::parse(data).each do |k,v|
146
145
  content.root.add(k,v)
147
146
  end
@@ -168,16 +167,18 @@ module CPEE
168
167
  else
169
168
  (@status = 500) && return
170
169
  end
171
- stream = @p.find{ |e| e.name == 'stream' }&.value
172
- if (instance, uuid = load_testset(tdoc,cpee,nil,stream)).first == -1
170
+ customization = @p.find{ |e| e.name == 'customization' }&.value
171
+ if (instance, uuid = load_testset(tdoc,cpee,nil,customization)).first == -1
173
172
  @status = 500
174
173
  else
175
- handle_data cpee, instance, @p[4]&.value if @p[4]&.name == 'init'
176
- handle_endpoints cpee, instance, @p[4]&.value if @p[4]&.name == 'endpoints'
177
- handle_endpoints cpee, instance, @p[5]&.value if @p[5]&.name == 'endpoints'
174
+ EM.defer do
175
+ handle_data cpee, instance, @p[4]&.value if @p[4]&.name == 'init'
176
+ handle_endpoints cpee, instance, @p[4]&.value if @p[4]&.name == 'endpoints'
177
+ handle_endpoints cpee, instance, @p[5]&.value if @p[5]&.name == 'endpoints'
178
178
 
179
- handle_waiting cpee, instance, uuid, @p[0].value, selfurl, cblist
180
- handle_starting cpee, instance, @p[0].value
179
+ handle_waiting cpee, instance, uuid, @p[0].value, selfurl, cblist
180
+ handle_starting cpee, instance, @p[0].value
181
+ end
181
182
 
182
183
  send = {
183
184
  'CPEE-INSTANCE' => instance,
@@ -185,6 +186,9 @@ module CPEE
185
186
  'CPEE-INSTANCE-UUID' => uuid,
186
187
  'CPEE-BEHAVIOR' => @p[0].value
187
188
  }
189
+ if @p[0].value =~ /^wait/
190
+ @headers << Riddl::Header.new('CPEE-CALLBACK','true')
191
+ end
188
192
  @headers << Riddl::Header.new('CPEE-INSTANTIATION',JSON::generate(send))
189
193
  Riddl::Parameter::Complex.new('instance','application/json',JSON::generate(send))
190
194
  end
@@ -206,16 +210,18 @@ module CPEE
206
210
  else
207
211
  (@status = 500) && return
208
212
  end
209
- stream = @p.find{ |e| e.name == 'stream' }&.value
210
- if (instance, uuid = load_testset(tdoc,cpee,name,stream)).first == -1
213
+ customization = @p.find{ |e| e.name == 'customization' }&.value
214
+ if (instance, uuid = load_testset(tdoc,cpee,name,customization)).first == -1
211
215
  @status = 500
212
216
  else
213
- handle_data cpee, instance, @p[2]&.value if @p[2]&.name == 'init'
214
- handle_endpoints cpee, instance, @p[2]&.value if @p[2]&.name == 'endpoints'
215
- handle_endpoints cpee, instance, @p[3]&.value if @p[3]&.name == 'endpoints'
217
+ EM.defer do
218
+ handle_data cpee, instance, @p[2]&.value if @p[2]&.name == 'init'
219
+ handle_endpoints cpee, instance, @p[2]&.value if @p[2]&.name == 'endpoints'
220
+ handle_endpoints cpee, instance, @p[3]&.value if @p[3]&.name == 'endpoints'
216
221
 
217
- handle_waiting cpee, instance, uuid, @p[0].value, selfurl, cblist
218
- handle_starting cpee, instance, @p[0].value
222
+ handle_waiting cpee, instance, uuid, @p[0].value, selfurl, cblist
223
+ handle_starting cpee, instance, @p[0].value
224
+ end
219
225
 
220
226
  send = {
221
227
  'CPEE-INSTANCE' => instance,
@@ -223,6 +229,9 @@ module CPEE
223
229
  'CPEE-INSTANCE-UUID' => uuid,
224
230
  'CPEE-BEHAVIOR' => @p[0].value
225
231
  }
232
+ if @p[0].value =~ /^wait/
233
+ @headers << Riddl::Header.new('CPEE-CALLBACK','true')
234
+ end
226
235
  @headers << Riddl::Header.new('CPEE-INSTANTIATION',JSON::generate(send))
227
236
  Riddl::Parameter::Complex.new('instance','application/json',JSON::generate(send))
228
237
  end
@@ -247,9 +256,11 @@ module CPEE
247
256
  if (instance, uuid = load_testset(tdoc,cpee)).first == -1
248
257
  @status = 500
249
258
  else
250
- handle_data cpee, instance, @p[data+1]&.value
251
- handle_waiting cpee, instance, uuid, behavior, selfurl, cblist
252
- handle_starting cpee, instance, behavior
259
+ EM.defer do
260
+ handle_data cpee, instance, @p[data+1]&.value
261
+ handle_waiting cpee, instance, uuid, behavior, selfurl, cblist
262
+ handle_starting cpee, instance, behavior
263
+ end
253
264
 
254
265
  send = {
255
266
  'CPEE-INSTANCE' => instance,
@@ -257,6 +268,9 @@ module CPEE
257
268
  'CPEE-INSTANCE-UUID' => uuid,
258
269
  'CPEE-BEHAVIOR' => behavior
259
270
  }
271
+ if @p[0].value =~ /^wait/
272
+ @headers << Riddl::Header.new('CPEE-CALLBACK','true')
273
+ end
260
274
  Riddl::Parameter::Complex.new('instance','application/json',JSON::generate(send))
261
275
  end
262
276
  end
@@ -280,6 +294,9 @@ module CPEE
280
294
  handle_data cpee, instance, @p[2]&.value
281
295
  handle_waiting cpee, instance, uuid, @p[0].value, selfurl, cblist
282
296
  handle_starting cpee, instance, @p[0].value
297
+ if @p[0].value =~ /^wait/
298
+ @headers << Riddl::Header.new('CPEE-CALLBACK','true')
299
+ end
283
300
  return Riddl::Parameter::Simple.new("url",cpee + instance)
284
301
  end
285
302
  end
@@ -34,7 +34,7 @@
34
34
  <parameter name="endpoints" type="string"/>
35
35
  </optional>
36
36
  <optional>
37
- <parameter name="stream" type="string"/>
37
+ <parameter name="customization" type="string"/>
38
38
  </optional>
39
39
  </message>
40
40
  <message name="url">
@@ -54,7 +54,7 @@
54
54
  <parameter name="endpoints" type="string"/>
55
55
  </optional>
56
56
  <optional>
57
- <parameter name="stream" type="string"/>
57
+ <parameter name="customization" type="string"/>
58
58
  </optional>
59
59
  </message>
60
60
  <message name="git">
@@ -76,7 +76,7 @@
76
76
  <parameter name="endpoints" type="string"/>
77
77
  </optional>
78
78
  <optional>
79
- <parameter name="stream" type="string"/>
79
+ <parameter name="customization" type="string"/>
80
80
  </optional>
81
81
  </message>
82
82
  <message name="instance">
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-instantiation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
- autorequire:
8
+ autorequire:
9
9
  bindir: tools
10
10
  cert_chain: []
11
- date: 2020-10-06 00:00:00.000000000 Z
11
+ date: 2021-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riddl
@@ -58,20 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1'
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: '1.5'
61
+ version: '2.1'
65
62
  type: :runtime
66
63
  prerelease: false
67
64
  version_requirements: !ruby/object:Gem::Requirement
68
65
  requirements:
69
66
  - - "~>"
70
67
  - !ruby/object:Gem::Version
71
- version: '1'
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '1.5'
68
+ version: '2.1'
75
69
  description: see http://cpee.org
76
70
  email: juergen.mangler@gmail.com
77
71
  executables:
@@ -93,7 +87,7 @@ homepage: http://cpee.org/
93
87
  licenses:
94
88
  - LGPL-3.0
95
89
  metadata: {}
96
- post_install_message:
90
+ post_install_message:
97
91
  rdoc_options: []
98
92
  require_paths:
99
93
  - lib
@@ -108,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
102
  - !ruby/object:Gem::Version
109
103
  version: '0'
110
104
  requirements: []
111
- rubygems_version: 3.1.2
112
- signing_key:
105
+ rubygems_version: 3.1.4
106
+ signing_key:
113
107
  specification_version: 4
114
108
  summary: Subprocess instantiation service for the cloud process execution engine (cpee.org)
115
109
  test_files: []