cpee 2.1.104 → 2.1.106
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/cpee.gemspec +1 -1
- data/server/executionhandlers/eval/backend/run.rb +10 -14
- data/server/executionhandlers/eval/execution.rb +51 -15
- data/server/executionhandlers/ruby/execution.rb +31 -14
- 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 +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 120f815f0f7416213d0187df51838246bfadbdbbc837e5d4d838bf906fc5fc6d
|
|
4
|
+
data.tar.gz: 675707c9d0963d88092549224c4701d11ca857921915c732267126595198062b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 307601239e89aff52adbafbecd178ae742adf8b503e19f895b598152b28992b7300f3489afc87a2f91cc2f776320555759a761f3707ad125ae33091eb9dce1bc
|
|
7
|
+
data.tar.gz: 53659f21aa9416ad069b43efb1519b6b9cbcd6ee4da0305a53b282ce63e96e14b150bbad40f6b32d763d84c6665f41461c1d3bf8c34e643afaf558a54f564621
|
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.106"
|
|
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."
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
+
require 'cpee/constants'
|
|
1
2
|
require 'yaml'
|
|
2
3
|
opts = YAML::load_file(File.join(__dir__,'opts.yaml'))
|
|
3
4
|
opts[:pidf] = __FILE__ + '.pid'
|
|
4
5
|
opts[:pid] = Process.pid
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
controller
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
connectionhandler = File.join(opts[:executionhandlers], opts[:executionhandler],'connection.rb')
|
|
16
|
-
if File.exist? global_connectionhandler
|
|
17
|
-
require global_connectionhandler
|
|
18
|
-
elsif File.exist? connectionhandler
|
|
19
|
-
require connectionhandler
|
|
7
|
+
opts[:global_executionhandlers] = CPEE::GLOBAL_EXECUTIONHANDLERS unless opts[:global_executionhandlers]
|
|
8
|
+
['controller.rb','connection.rb'].each do |f|
|
|
9
|
+
global_thing = File.join(opts[:global_executionhandlers],opts[:executionhandler],f)
|
|
10
|
+
thing = File.join(opts[:executionhandlers], opts[:executionhandler],f)
|
|
11
|
+
if File.exist? global_thing
|
|
12
|
+
require global_thing
|
|
13
|
+
elsif File.exist? thing
|
|
14
|
+
require thing
|
|
15
|
+
end
|
|
20
16
|
end
|
|
21
17
|
|
|
22
18
|
require_relative 'instance'
|
|
@@ -35,7 +35,7 @@ module CPEE
|
|
|
35
35
|
hw = CPEE::Persistence::extract_item(id,opts,'executionhandler')
|
|
36
36
|
endpoints = CPEE::Persistence::extract_list(id,opts,'endpoints')
|
|
37
37
|
dataelements = CPEE::Persistence::extract_list(id,opts,'dataelements')
|
|
38
|
-
attributes = CPEE::Persistence::extract_list(id,opts,'attributes')
|
|
38
|
+
attributes = CPEE::Persistence::extract_list(id,opts,'attributes').to_h
|
|
39
39
|
positions = CPEE::Persistence::extract_set(id,opts,'positions')
|
|
40
40
|
positions.map! do |k, v|
|
|
41
41
|
[ k, v, CPEE::Persistence::extract_item(id,opts,File.join('positions',k,'@passthrough')) ]
|
|
@@ -46,9 +46,14 @@ module CPEE
|
|
|
46
46
|
iopts[:redis_url] = opts[:redis_url]
|
|
47
47
|
iopts[:redis_db] = opts[:redis_db]
|
|
48
48
|
iopts[:workers] = opts[:workers]
|
|
49
|
-
iopts[:global_executionhandlers] = opts[:global_executionhandlers]
|
|
50
|
-
iopts[:executionhandlers] = opts[:executionhandlers]
|
|
51
49
|
iopts[:executionhandler] = hw
|
|
50
|
+
if attributes.has_key?('remote')
|
|
51
|
+
uri = URI::parse(attributes['remote'])
|
|
52
|
+
iopts[:executionhandlers] = File.join(uri.path,File.basename(opts[:executionhandlers]))
|
|
53
|
+
else
|
|
54
|
+
iopts[:executionhandlers] = opts[:executionhandlers]
|
|
55
|
+
iopts[:global_executionhandlers] = opts[:global_executionhandlers]
|
|
56
|
+
end
|
|
52
57
|
|
|
53
58
|
File.open(File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Eval::BACKEND_OPTS)),'w') do |f|
|
|
54
59
|
YAML::dump(iopts,f)
|
|
@@ -56,24 +61,55 @@ module CPEE
|
|
|
56
61
|
template = ERB.new(File.read(ExecutionHandler::Eval::BACKEND_TEMPLATE), trim_mode: '-')
|
|
57
62
|
res = template.result_with_hash(dsl: dsl, dataelements: dataelements, endpoints: endpoints, positions: positions)
|
|
58
63
|
File.write(File.join(opts[:instances],id.to_s,ExecutionHandler::Eval::BACKEND_INSTANCE),res)
|
|
64
|
+
if attributes.has_key?('remote')
|
|
65
|
+
uri = URI::parse(attributes['remote'])
|
|
66
|
+
Net::SSH.start(uri.host,uri.user,:keys => [ opts[:ssh_key] ] ) do |ssh|
|
|
67
|
+
ssh.exec!("rm -rf #{File.join(uri.path,id.to_s,'*')}")
|
|
68
|
+
ssh.scp.upload!(File.join(opts[:instances],id.to_s),uri.path,:recursive=>true)
|
|
69
|
+
end
|
|
70
|
+
File.write(File.join(opts[:instances],id.to_s,'.remote'),attributes['remote'])
|
|
71
|
+
end
|
|
59
72
|
end
|
|
60
73
|
|
|
61
74
|
def self::run(id,opts)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
if File.exist? File.join(opts[:instances],id.to_s,'.remote')
|
|
76
|
+
uri = URI::parse(File.read(File.join(opts[:instances],id.to_s,'.remote')))
|
|
77
|
+
exe = File.join(uri.path,id.to_s,File.basename(BACKEND_RUN))
|
|
78
|
+
Net::SSH.start(uri.host,uri.user,:keys => [ opts[:ssh_key] ] ) do |ssh|
|
|
79
|
+
ssh.exec!("ruby #{exe} >#{exe}.out 2>#{exe}.err &")
|
|
80
|
+
end
|
|
81
|
+
else
|
|
82
|
+
exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Eval::BACKEND_RUN))
|
|
83
|
+
pid = Kernel.spawn(opts[:libs_preloaderrun] + ' ' + exe , :pgroup => true, :in => '/dev/null', :out => exe + '.out', :err => exe + '.err')
|
|
84
|
+
Process.detach pid
|
|
85
|
+
File.write(exe + '.pid',pid)
|
|
86
|
+
end
|
|
66
87
|
end
|
|
67
88
|
|
|
68
89
|
def self::stop(id,opts) ### return: bool to tell if manually changing redis is necessary
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
90
|
+
if File.exist? File.join(opts[:instances],id.to_s,'.remote')
|
|
91
|
+
uri = URI::parse(File.read(File.join(opts[:instances],id.to_s,'.remote')))
|
|
92
|
+
exe = File.join(uri.path,id.to_s,File.basename(BACKEND_RUN))
|
|
93
|
+
Net::SSH.start(uri.host,uri.user,:keys => [ opts[:ssh_key] ] ) do |ssh|
|
|
94
|
+
pid = ssh.exec!("cat #{exe}.pid 2>/dev/null")
|
|
95
|
+
if pid != '' && ssh.exec!("kill -0 #{pid} >/dev/null 2>&1; echo $?").strip == '0'
|
|
96
|
+
ssh.exec!("kill -SIGHUP #{pid}")
|
|
97
|
+
false
|
|
98
|
+
else
|
|
99
|
+
ssh.exec!("rm #{exe}.pid")
|
|
100
|
+
true
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
else
|
|
104
|
+
exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Eval::BACKEND_RUN))
|
|
105
|
+
pid = File.read(exe + '.pid') rescue nil
|
|
106
|
+
if pid && (Process.kill(0, pid.to_i) rescue false)
|
|
107
|
+
Process.kill('HUP', pid.to_i) rescue nil
|
|
108
|
+
false
|
|
109
|
+
else # its not running, so clean up
|
|
110
|
+
File.unlink(exe + '.pid') rescue nil
|
|
111
|
+
true
|
|
112
|
+
end
|
|
77
113
|
end
|
|
78
114
|
end
|
|
79
115
|
end
|
|
@@ -76,27 +76,44 @@ module CPEE
|
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def self::run(id,opts)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
if File.exist? File.join(opts[:instances],id.to_s,'.remote')
|
|
80
|
+
uri = URI::parse(File.read(File.join(opts[:instances],id.to_s,'.remote')))
|
|
81
|
+
exe = File.join(uri.path,id.to_s,File.basename(BACKEND_RUN))
|
|
82
|
+
Net::SSH.start(uri.host,uri.user,:keys => [ opts[:ssh_key] ] ) do |ssh|
|
|
83
|
+
ssh.exec!("ruby #{exe} >#{exe}.out 2>#{exe}.err &")
|
|
84
|
+
end
|
|
85
|
+
else
|
|
84
86
|
exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Ruby::BACKEND_RUN))
|
|
85
87
|
pid = Kernel.spawn(opts[:libs_preloaderrun] + ' ' + exe , :pgroup => true, :in => '/dev/null', :out => exe + '.out', :err => exe + '.err')
|
|
86
88
|
Process.detach pid
|
|
87
89
|
File.write(exe + '.pid',pid)
|
|
88
|
-
|
|
90
|
+
end
|
|
89
91
|
end
|
|
90
92
|
|
|
91
93
|
def self::stop(id,opts) ### return: bool to tell if manually changing redis is necessary
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
if File.exist? File.join(opts[:instances],id.to_s,'.remote')
|
|
95
|
+
uri = URI::parse(File.read(File.join(opts[:instances],id.to_s,'.remote')))
|
|
96
|
+
exe = File.join(uri.path,id.to_s,File.basename(BACKEND_RUN))
|
|
97
|
+
Net::SSH.start(uri.host,uri.user,:keys => [ opts[:ssh_key] ] ) do |ssh|
|
|
98
|
+
pid = ssh.exec!("cat #{exe}.pid 2>/dev/null")
|
|
99
|
+
if pid != '' && ssh.exec!("kill -0 #{pid} >/dev/null 2>&1; echo $?").strip == '0'
|
|
100
|
+
ssh.exec!("kill -SIGHUP #{pid}")
|
|
101
|
+
false
|
|
102
|
+
else
|
|
103
|
+
ssh.exec!("rm #{exe}.pid")
|
|
104
|
+
true
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
else
|
|
108
|
+
exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Ruby::BACKEND_RUN))
|
|
109
|
+
pid = File.read(exe + '.pid') rescue nil
|
|
110
|
+
if pid && (Process.kill(0, pid.to_i) rescue false)
|
|
111
|
+
Process.kill('HUP', pid.to_i) rescue nil
|
|
112
|
+
false
|
|
113
|
+
else # its not running, so clean up
|
|
114
|
+
File.unlink(exe + '.pid') rescue nil
|
|
115
|
+
true
|
|
116
|
+
end
|
|
100
117
|
end
|
|
101
118
|
end
|
|
102
119
|
end
|
data/server/routing/end.pid
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
601746
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
601788
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
601774
|
data/server/routing/persist.pid
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
601760
|