cpee-instantiation 1.0.3 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cpee-instantiation.gemspec +2 -2
- data/lib/cpee-instantiation/instantiation.rb +32 -24
- data/lib/cpee-instantiation/instantiation.xml +3 -3
- data/tools/cpee-instantiation +5 -3
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d8b35ec9b565e1bab33b2b5a241aca5bef057a5346e318a200f97ee5a747858
|
4
|
+
data.tar.gz: ce3baeadef619b73cafdcb68911fd80a3fa1431e3c9e4e4943073774dcd7fecd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 148655d1172ff9741a123fb868d6f96aecde9b520482d6611073b0fe25ac1ad8b0edc0cc041e683ed578565fe8559d5b539fe719d25e9c7dc4af3ff319ce4f2b
|
7
|
+
data.tar.gz: 5ab0d7a92da34ebb58e533a99226a1d89764272aaf1b324a913214e9ceaef3b52789646dd1c645316490c066cface0093d8c871d46a54959b95412ded8e7510c
|
data/cpee-instantiation.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cpee-instantiation"
|
3
|
-
s.version = "1.0.
|
3
|
+
s.version = "1.0.9"
|
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.
|
26
|
+
s.add_runtime_dependency 'cpee', '~> 2.1', '>= 2.1.4'
|
27
27
|
end
|
@@ -30,12 +30,13 @@ 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,
|
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|
|
37
37
|
doc.register_namespace 'desc', 'http://cpee.org/ns/description/1.0'
|
38
38
|
doc.register_namespace 'prop', 'http://cpee.org/ns/properties/2.0'
|
39
|
+
doc.register_namespace 'sub', 'http://riddl.org/ns/common-patterns/notifications-producer/2.0'
|
39
40
|
|
40
41
|
srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
|
41
42
|
res = srv.resource('/')
|
@@ -44,13 +45,13 @@ module CPEE
|
|
44
45
|
e.text = name
|
45
46
|
end
|
46
47
|
end
|
47
|
-
if
|
48
|
-
JSON.parse(
|
48
|
+
if customization && !customization.empty?
|
49
|
+
JSON.parse(customization).each do |e|
|
49
50
|
begin
|
50
|
-
|
51
|
-
if
|
52
|
-
XML::Smart::string(
|
53
|
-
doc.find("//desc:call[@id=\"#{e['id']}\"]/desc:parameters/desc:
|
51
|
+
customization = Typhoeus.get e['url']
|
52
|
+
if customization.success?
|
53
|
+
XML::Smart::string(customization.response_body) do |str|
|
54
|
+
doc.find("//desc:call[@id=\"#{e['id']}\"]/desc:parameters/desc:customization").each do |ele|
|
54
55
|
ele.replace_by str.root
|
55
56
|
end
|
56
57
|
end
|
@@ -70,23 +71,30 @@ module CPEE
|
|
70
71
|
|
71
72
|
inp = XML::Smart::string('<properties xmlns="http://cpee.org/ns/properties/2.0"/>')
|
72
73
|
inp.register_namespace 'prop', 'http://cpee.org/ns/properties/2.0'
|
73
|
-
%w{
|
74
|
+
%w{executionhandler positions dataelements endpoints attributes description transformation}.each do |item|
|
74
75
|
ele = doc.find("/*/prop:#{item}")
|
75
76
|
inp.root.add(ele.first) if ele.any?
|
76
77
|
end
|
77
78
|
res = srv.resource("/#{ins}/properties").put Riddl::Parameter::Complex.new('properties','application/xml',inp.to_s)
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
79
|
+
# TODO new versions
|
80
|
+
doc.find('/*/sub:subscriptions/sub:subscription').each do |s|
|
81
|
+
parts = []
|
82
|
+
if id = s.attributes['id']
|
83
|
+
parts << Riddl::Parameter::Simple.new('id', id)
|
84
|
+
end
|
85
|
+
parts << Riddl::Parameter::Simple.new('url', s.attributes['url'])
|
86
|
+
s.find('sub:topic').each do |t|
|
87
|
+
p s.find('sub:event').map{ |e| e.text }
|
88
|
+
if (evs = t.find('sub:event').map{ |e| e.text }.join(',')).length > 0
|
89
|
+
parts << Riddl::Parameter::Simple.new('topic', t.attributes['id'])
|
90
|
+
parts << Riddl::Parameter::Simple.new('events', evs)
|
91
|
+
end
|
92
|
+
if (vos = t.find('sub:vote').map{ |e| e.text }.join(',')).length > 0
|
93
|
+
parts << Riddl::Parameter::Simple.new('topic', t.attributes['id'])
|
94
|
+
parts << Riddl::Parameter::Simple.new('votes', vos)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
status,body = Riddl::Client::new(cpee+ins+'/notifications/subscriptions/').post parts
|
90
98
|
end
|
91
99
|
end
|
92
100
|
end
|
@@ -167,8 +175,8 @@ module CPEE
|
|
167
175
|
else
|
168
176
|
(@status = 500) && return
|
169
177
|
end
|
170
|
-
|
171
|
-
if (instance, uuid = load_testset(tdoc,cpee,nil,
|
178
|
+
customization = @p.find{ |e| e.name == 'customization' }&.value
|
179
|
+
if (instance, uuid = load_testset(tdoc,cpee,nil,customization)).first == -1
|
172
180
|
@status = 500
|
173
181
|
else
|
174
182
|
EM.defer do
|
@@ -210,8 +218,8 @@ module CPEE
|
|
210
218
|
else
|
211
219
|
(@status = 500) && return
|
212
220
|
end
|
213
|
-
|
214
|
-
if (instance, uuid = load_testset(tdoc,cpee,name,
|
221
|
+
customization = @p.find{ |e| e.name == 'customization' }&.value
|
222
|
+
if (instance, uuid = load_testset(tdoc,cpee,name,customization)).first == -1
|
215
223
|
@status = 500
|
216
224
|
else
|
217
225
|
EM.defer do
|
@@ -34,7 +34,7 @@
|
|
34
34
|
<parameter name="endpoints" type="string"/>
|
35
35
|
</optional>
|
36
36
|
<optional>
|
37
|
-
<parameter name="
|
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="
|
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="
|
79
|
+
<parameter name="customization" type="string"/>
|
80
80
|
</optional>
|
81
81
|
</message>
|
82
82
|
<message name="instance">
|
data/tools/cpee-instantiation
CHANGED
@@ -30,7 +30,7 @@ ARGV.options { |opt|
|
|
30
30
|
opt.on("Options:")
|
31
31
|
opt.on("--help", "-h", "This text") { puts opt; exit }
|
32
32
|
opt.on("")
|
33
|
-
opt.on(wrap("[DIR]
|
33
|
+
opt.on(wrap("[DIR] scaffolds a sample instantiation service. Post a testset to a model to keep going in one operation."))
|
34
34
|
opt.parse!
|
35
35
|
}
|
36
36
|
if (ARGV.length != 1)
|
@@ -40,8 +40,10 @@ else
|
|
40
40
|
p1 = ARGV[0]
|
41
41
|
end
|
42
42
|
|
43
|
+
insta = "#{curpath}/../server/"
|
43
44
|
if !File.exists?(p1)
|
44
|
-
FileUtils.cp_r(
|
45
|
+
FileUtils.cp_r(insta,p1)
|
45
46
|
else
|
46
|
-
|
47
|
+
FileUtils.cp_r(Dir.glob(File.join(insta,'*')).delete_if{|e| e =~ /\.conf/ },p1,remove_destination: true)
|
48
|
+
puts 'Directory already exists, updating ...'
|
47
49
|
end
|
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.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
8
8
|
autorequire:
|
9
9
|
bindir: tools
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: riddl
|
@@ -58,20 +58,20 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1'
|
61
|
+
version: '2.1'
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
64
|
+
version: 2.1.4
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: '1'
|
71
|
+
version: '2.1'
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: 2.1.4
|
75
75
|
description: see http://cpee.org
|
76
76
|
email: juergen.mangler@gmail.com
|
77
77
|
executables:
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.1.
|
111
|
+
rubygems_version: 3.1.6
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Subprocess instantiation service for the cloud process execution engine (cpee.org)
|