cpee 1.5.10 → 1.5.11

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: 60c62160d5a81af31291d43be2b7a15d7ec82280fbaf8100b2e7f6d1c9444acb
4
- data.tar.gz: 5c2ec7a78293aaeabd1d6b0a450ad8205c4e31e9dac2799a36020b1b4a04525d
3
+ metadata.gz: 7c028a21ea683c2b4021f66cb0707a5a36a65dd507998ded71e4c3edd061d4a0
4
+ data.tar.gz: dfafd97c3ecbe4f40b1cd1233b91ab54fd90dbc3fca3e70c3456f6cdcf234e79
5
5
  SHA512:
6
- metadata.gz: 6795bea238d2fb417ce780ce8335eee886019b1e712fed7a2bdded535822a9b9648bb941a6a44a0d5ee188da10fc0aed1ec01661b23b83cbc9846537686f2855
7
- data.tar.gz: f983dddac9dfbd8a3150e594958202a67910f7532a70ee5b27a67ec5c565e5dd3d9ef8a56320d7fe91216f8158c1ee5491582a7d64130798eb90eaaef19c7261
6
+ metadata.gz: 18e675ccef009528bad6d7852ff5e3d46549bd30bd632b3caa685c3ce353f357a961d54caf6355312d8e1b2eba3ece587539ede3105853b1ea9bab571610588a
7
+ data.tar.gz: 41be183fb35677883e3de3a3b7194822bb4a811643640749710b54056fdf202680128fc61be8969a68ea0fc5dd952d949bfd864f344c4f45e2575c4f4f993715
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "1.5.10"
3
+ s.version = "1.5.11"
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"
@@ -146,7 +146,7 @@ module CPEE
146
146
  end #}}}
147
147
  end #}}}
148
148
 
149
- class InstantiateUrl < Riddl::Implementation #{{{
149
+ class InstantiateGit < Riddl::Implementation #{{{
150
150
  include Helpers
151
151
 
152
152
  def response
@@ -154,28 +154,66 @@ module CPEE
154
154
  selfurl = @a[1]
155
155
  cblist = @a[2]
156
156
 
157
- status, res = Riddl::Client.new(@p[2].value.gsub(/ /,'%20')).get
157
+ status, res = Riddl::Client.new(File.join(@p[1].value,'raw',@p[2].value,@p[3].value).gsub(/ /,'%20')).get
158
158
  tdoc = if status >= 200 && status < 300
159
159
  res[0].value.read
160
160
  else
161
161
  (@status = 500) && return
162
162
  end
163
163
 
164
- if (instance, uuid = load_testset(tdoc,cpee,@p[0].value)).first == -1
164
+ if (instance, uuid = load_testset(tdoc,cpee)).first == -1
165
165
  @status = 500
166
166
  else
167
- handle_data cpee, instance, @p[3]&.value if @p[3]&.name == 'init'
168
- handle_endpoints cpee, instance, @p[3]&.value if @p[3]&.name == 'endpoints'
167
+ handle_data cpee, instance, @p[4]&.value if @p[4]&.name == 'init'
169
168
  handle_endpoints cpee, instance, @p[4]&.value if @p[4]&.name == 'endpoints'
169
+ handle_endpoints cpee, instance, @p[5]&.value if @p[5]&.name == 'endpoints'
170
+
171
+ handle_waiting cpee, instance, uuid, @p[0].value, selfurl, cblist
172
+ handle_starting cpee, instance, @p[0].value
173
+
174
+ send = {
175
+ 'CPEE-INSTANCE' => instance,
176
+ 'CPEE-INSTANCE-URL' => File.join(cpee,instance),
177
+ 'CPEE-INSTANCE-UUID' => uuid,
178
+ 'CPEE-BEHAVIOR' => @p[0].value
179
+ }
180
+ @headers << Riddl::Header.new('CPEE-INSTANTIATION',JSON::generate(send))
181
+ Riddl::Parameter::Complex.new('instance','application/json',JSON::generate(send))
182
+ end
183
+ end
184
+ end #}}}
185
+
186
+ class InstantiateUrl < Riddl::Implementation #{{{
187
+ include Helpers
188
+
189
+ def response
190
+ cpee = @h['X_CPEE'] || @a[0]
191
+ selfurl = @a[1]
192
+ cblist = @a[2]
193
+ name = @a[3] ? @p.pop.value : nil
194
+
195
+ status, res = Riddl::Client.new(@p[1].value.gsub(/ /,'%20')).get
196
+ tdoc = if status >= 200 && status < 300
197
+ res[0].value.read
198
+ else
199
+ (@status = 500) && return
200
+ end
170
201
 
171
- handle_waiting cpee, instance, uuid, @p[1].value, selfurl, cblist
172
- handle_starting cpee, instance, @p[1].value
202
+ if (instance, uuid = load_testset(tdoc,cpee,name)).first == -1
203
+ @status = 500
204
+ else
205
+ handle_data cpee, instance, @p[2]&.value if @p[2]&.name == 'init'
206
+ handle_endpoints cpee, instance, @p[2]&.value if @p[2]&.name == 'endpoints'
207
+ handle_endpoints cpee, instance, @p[3]&.value if @p[3]&.name == 'endpoints'
208
+
209
+ handle_waiting cpee, instance, uuid, @p[0].value, selfurl, cblist
210
+ handle_starting cpee, instance, @p[0].value
173
211
 
174
212
  send = {
175
213
  'CPEE-INSTANCE' => instance,
176
214
  'CPEE-INSTANCE-URL' => File.join(cpee,instance),
177
215
  'CPEE-INSTANCE-UUID' => uuid,
178
- 'CPEE-BEHAVIOR' => @p[1].value
216
+ 'CPEE-BEHAVIOR' => @p[0].value
179
217
  }
180
218
  @headers << Riddl::Header.new('CPEE-INSTANTIATION',JSON::generate(send))
181
219
  Riddl::Parameter::Complex.new('instance','application/json',JSON::generate(send))
@@ -291,7 +329,11 @@ module CPEE
291
329
  run InstantiateXML, opts[:cpee], false if post 'xml'
292
330
  end
293
331
  on resource 'url' do
294
- run InstantiateUrl, opts[:cpee], opts[:self], opts[:cblist] if post 'url'
332
+ run InstantiateUrl, opts[:cpee], opts[:self], opts[:cblist], false if post 'url'
333
+ run InstantiateUrl, opts[:cpee], opts[:self], opts[:cblist], true if post 'url_info'
334
+ end
335
+ on resource 'git' do
336
+ run InstantiateGit, opts[:cpee], opts[:self], opts[:cblist] if post 'git'
295
337
  end
296
338
  on resource 'instance' do
297
339
  run HandleInstance, opts[:cpee] if post 'instance'
@@ -16,7 +16,7 @@
16
16
  <parameter name="init" type="string"/>
17
17
  </optional>
18
18
  </message>
19
- <message name="url">
19
+ <message name="url_info">
20
20
  <parameter name="info" type="string"/>
21
21
  <parameter name="behavior" type="string">
22
22
  <choice>
@@ -34,6 +34,42 @@
34
34
  <parameter name="endpoints" type="string"/>
35
35
  </optional>
36
36
  </message>
37
+ <message name="url">
38
+ <parameter name="behavior" type="string">
39
+ <choice>
40
+ <value>fork_ready</value>
41
+ <value>fork_running</value>
42
+ <value>wait_ready</value>
43
+ <value>wait_running</value>
44
+ </choice>
45
+ </parameter>
46
+ <parameter name="url" type="string"/>
47
+ <optional>
48
+ <parameter name="init" type="string"/>
49
+ </optional>
50
+ <optional>
51
+ <parameter name="endpoints" type="string"/>
52
+ </optional>
53
+ </message>
54
+ <message name="git">
55
+ <parameter name="behavior" type="string">
56
+ <choice>
57
+ <value>fork_ready</value>
58
+ <value>fork_running</value>
59
+ <value>wait_ready</value>
60
+ <value>wait_running</value>
61
+ </choice>
62
+ </parameter>
63
+ <parameter name="repo" type="string"/>
64
+ <parameter name="branch" type="string"/>
65
+ <parameter name="path" type="string"/>
66
+ <optional>
67
+ <parameter name="init" type="string"/>
68
+ </optional>
69
+ <optional>
70
+ <parameter name="endpoints" type="string"/>
71
+ </optional>
72
+ </message>
37
73
  <message name="instance">
38
74
  <parameter name="behavior" type="string">
39
75
  <choice>
@@ -65,6 +101,10 @@
65
101
  </resource>
66
102
  <resource relative="url">
67
103
  <post in="url" out="result"/>
104
+ <post in="url_info" out="result"/>
105
+ </resource>
106
+ <resource relative="git">
107
+ <post in="git" out="result"/>
68
108
  </resource>
69
109
  <resource relative="callback">
70
110
  <resource>
@@ -0,0 +1 @@
1
+ 7174
data/tools/cpee CHANGED
@@ -33,11 +33,11 @@ ARGV.options { |opt|
33
33
  opt.on("Options:")
34
34
  opt.on("--help", "-h", "This text") { puts opt; exit }
35
35
  opt.on("")
36
- opt.on(wrap("[archive DIR URL] save properties from all finished instances listed at URL into DIR. Examples:\ncpee archive ./archive http://localhost:9298/\ncpee archive ./archive http://localhost:9298/1/\ncpee archive ./archive http://localhost:9298/1-200"))
36
+ opt.on(wrap("[archive DIR URL] save properties from all finished instances listed at URL into DIR. Examples:\ncpee archive ./archive http://localhost:9298/1/\ncpee archive ./archive http://localhost:9298/1-200\ncpee archive ./archive http://localhost:9298/*"))
37
37
  opt.on("")
38
- opt.on(wrap("[abandon URL] running processes are stopped; ready or stopped processes are abandoned. Examples:\ncpee abandon http://localhost:9298/1/\ncpee abandon http://localhost:9298/1-200"))
38
+ opt.on(wrap("[abandon URL] running processes are stopped; ready or stopped processes are abandoned. Examples:\ncpee abandon http://localhost:9298/1/\ncpee abandon http://localhost:9298/1-200\ncpee abandon http://localhost:9298/*"))
39
39
  opt.on("")
40
- opt.on(wrap("[start URL] stopped processes are started; all others are not touched. Examples:\ncpee start http://localhost:9298/1-200"))
40
+ opt.on(wrap("[start URL] stopped processes are started; all others are not touched. Examples:\ncpee start http://localhost:9298/1\ncpee start http://localhost:9298/1-200\ncpee start http://localhost:9298/*"))
41
41
  opt.on("")
42
42
  opt.on(wrap("[delete! URL] DANGER ZONE. Vanishes forever. Not in archive. Examples:\ncpee delete! http://localhost:9298/1/"))
43
43
  opt.on("")
@@ -107,10 +107,23 @@ elsif command == 'inst'
107
107
  puts 'Directory already exists.'
108
108
  end
109
109
  elsif command == 'archive'
110
+ p2 = File.join(p2,'*') if p2 =~ /([a-zA-Z]|\/)$/
110
111
  base = File.dirname(p2)
111
112
  names = []
112
113
  if File.basename(p2) =~ /(\d+)-(\d+)/
113
114
  names = ($1.to_i..$2.to_i).to_a
115
+ elsif File.basename(p2) == '*'
116
+ res = Typhoeus.get(File.join(base))
117
+ if res.success?
118
+ XML::Smart.string(res.response_body) do |doc|
119
+ doc.find('//instance/@id').each do |ele|
120
+ names << ele.value
121
+ end
122
+ end
123
+ names.reverse!
124
+ else
125
+ exit
126
+ end
114
127
  else
115
128
  names << File.basename(p2)
116
129
  end
@@ -147,10 +160,23 @@ elsif command == 'archive'
147
160
  end
148
161
  end
149
162
  elsif command == 'abandon'
163
+ p1 = File.join(p1,'*') if p1 =~ /([a-zA-Z]|\/)$/
150
164
  base = File.dirname(p1)
151
165
  names = []
152
166
  if File.basename(p1) =~ /(\d+)-(\d+)/
153
167
  names = ($1.to_i..$2.to_i).to_a
168
+ elsif File.basename(p1) == '*'
169
+ res = Typhoeus.get(File.join(base))
170
+ if res.success?
171
+ XML::Smart.string(res.response_body) do |doc|
172
+ doc.find('//instance/@id').each do |ele|
173
+ names << ele.value
174
+ end
175
+ end
176
+ names.reverse!
177
+ else
178
+ exit
179
+ end
154
180
  else
155
181
  names << File.basename(p1)
156
182
  end
@@ -160,18 +186,27 @@ elsif command == 'abandon'
160
186
  case res.response_body
161
187
  when "ready", "stopped" then
162
188
  Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=abandoned")
163
- when "running" then
164
- Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=stopped")
165
- sleep 1
166
- Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=abandoned")
167
189
  end
168
190
  end
169
191
  end
170
192
  elsif command == 'start'
193
+ p1 = File.join(p1,'*') if p1 =~ /([a-zA-Z]|\/)$/
171
194
  base = File.dirname(p1)
172
195
  names = []
173
196
  if File.basename(p1) =~ /(\d+)-(\d+)/
174
197
  names = ($1.to_i..$2.to_i).to_a
198
+ elsif File.basename(p1) == '*'
199
+ res = Typhoeus.get(File.join(base))
200
+ if res.success?
201
+ XML::Smart.string(res.response_body) do |doc|
202
+ doc.find('//instance/@id').each do |ele|
203
+ names << ele.value
204
+ end
205
+ end
206
+ names.reverse!
207
+ else
208
+ exit
209
+ end
175
210
  else
176
211
  names << File.basename(p1)
177
212
  end
@@ -180,13 +215,16 @@ elsif command == 'start'
180
215
  if res.success?
181
216
  case res.response_body
182
217
  when "stopped" then
183
- Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=running")
218
+ keep_alive = Typhoeus.get(File.join(base,name.to_s,'properties','values','attributes','keep_alive','/'))
219
+ if keep_alive.success?
220
+ Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=running")
221
+ end
184
222
  end
185
223
  end
186
224
  end
187
225
  elsif command == 'delete!'
188
226
  Typhoeus.delete(File.join(p1,'/'))
189
- else
227
+ elsif command == 'new'
190
228
  if !File.exists?(p1)
191
229
  FileUtils.cp_r("#{curpath}/server/",p1)
192
230
  FileUtils.mkdir("#{p1}/instances") rescue nil
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.10
4
+ version: 1.5.11
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-29 00:00:00.000000000 Z
14
+ date: 2019-11-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: riddl
@@ -287,6 +287,7 @@ files:
287
287
  - log/trace_sic.yaml
288
288
  - log/xes_xml.rb
289
289
  - log/xes_yaml.rb
290
+ - server/dev.pid
290
291
  - server/dev.rb
291
292
  - server/handlerwrappers/default.rb
292
293
  - server/handlerwrappers/soap.rb
@@ -303,7 +304,6 @@ files:
303
304
  - server/resources/topics.xml
304
305
  - server/resources/transformation.xml
305
306
  - server/resources/transformation_dslx.xsl
306
- - server/server.pid
307
307
  - server/server.rb
308
308
  - test/callback.rb
309
309
  - tools/cpee
@@ -1 +0,0 @@
1
- 29054