cpee 2.1.101 → 2.1.102

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 269c5121fd56cc7234ff74bc1f84ea6705f11d6eeb36afabcdf1951e07e5c88a
4
- data.tar.gz: 6f12152051c5c42f8fa2695cd8087e0e030d4dec1c3cbdb5fc0ec60de75c13f6
3
+ metadata.gz: 5010919e54c7d79b545e7014b32b2fa8c9a57ae1d99cbb478027c93ef9a944c7
4
+ data.tar.gz: 556acc355be78bfdf3b51c2ef171795ca92dc8abf14569eb736cc208bc624677
5
5
  SHA512:
6
- metadata.gz: 35c90c419f756d9db88ef19ad4491200e84bbd30c9f1db57564ede45b869ad9d71725a35239889adbc5fff9aeeaaa6c0a20a5980bc3636dee3e051847154439d
7
- data.tar.gz: 7988040107a41c2c98c1fe4bb997ce3076bc2e3d33f270633512259ac3aee513ea769eea7322e7eacbf6a4b90b741b29d70ef930dd007fd09b74fe568634b04a
6
+ metadata.gz: eb2d4c8d1c20971179ef9c07883c3bb8669993588677d4c61720514c82f6d3644d58517a5d85821f1cd52f0621b5cc9643727b0369f7d8a85d6202cfa0576fd8
7
+ data.tar.gz: 33515554a3c69f90ddca7b479583258cf2a6ecd41b149dddcddfcc14e9abc371613770edf117b0a699765beb5b4c90f9a58216c1339036c3d90db73295b65bbd
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.101"
3
+ s.version = "2.1.102"
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."
@@ -75,13 +75,16 @@ module CPEE
75
75
  opts[:dashing_frequency] ||= 3
76
76
  opts[:dashing_target] ||= nil
77
77
 
78
- ### set redis_cmd to nil if you want to do global
79
- ### at least redis_path or redis_url and redis_db have to be set if you do global
80
- opts[:redis_path] ||= 'redis.sock' # use e.g. /tmp/redis.sock for global stuff. Look it up in your redis config
81
- opts[:redis_port] ||= 0
82
- opts[:redis_db] ||= 0
83
78
  ### optional redis stuff
84
- opts[:redis_url] ||= nil
79
+ ### port is parsed from redis url
80
+ ### when redis can not be connected, it is started, user, pass and port are extracted
81
+ ### opts[:redis_url] ||= unix://redis.sock
82
+ ### opts[:redis_url] ||= redis-socket://redis.sock
83
+ ### opts[:redis_url] ||= redis-socket:///tmp/redis.sock
84
+ ### opts[:redis_url] ||= redis://echo.bpm.in.tum.de:8798
85
+ ### opts[:redis_url] ||= redis://localhost:8798
86
+ opts[:redis_db] ||= 0
87
+ opts[:redis_url] ||= 'unix://redis.sock' # sadly we have to do this for now
85
88
  opts[:redis_unixsocket] ||= true
86
89
  opts[:redis_cmd] ||= 'redis-server --port #redis_port# --unixsocket #redis_path# --unixsocketperm 600 --pidfile #redis_pid# --dir #redis_db_dir# --dbfilename #redis_db_name# --databases 1 --save 900 1 --save 300 10 --save 60 10000 --rdbcompression yes --daemonize yes --protected-mode no'
87
90
  opts[:redis_pid] ||= 'redis.pid' # use e.g. /var/run/redis.pid if you do global. Look it up in your redis config
@@ -125,9 +128,9 @@ module CPEE
125
128
  CPEE::Message::set_workers(opts[:workers])
126
129
 
127
130
  parallel do
128
- CPEE::watch_services(opts[:watchdog_start_off],opts[:redis_url],File.join(opts[:basepath],opts[:redis_path]),opts[:redis_db],opts[:workers],opts[:workers_single],opts[:workers_multi])
131
+ CPEE::watch_services(opts[:watchdog_start_off],opts[:redis_url],opts[:redis_db],opts[:workers],opts[:workers_single],opts[:workers_multi])
129
132
  EM.add_periodic_timer(opts[:watchdog_frequency]) do ### start services
130
- CPEE::watch_services(opts[:watchdog_start_off],opts[:redis_url],File.join(opts[:basepath],opts[:redis_path]),opts[:redis_db],opts[:workers],opts[:workers_single],opts[:workers_multi])
133
+ CPEE::watch_services(opts[:watchdog_start_off],opts[:redis_url],opts[:redis_db],opts[:workers],opts[:workers_single],opts[:workers_multi])
131
134
  end
132
135
  EM.defer do ### catch all sse connections
133
136
  CPEE::Notifications::sse_distributor(opts)
@@ -220,7 +223,7 @@ module CPEE
220
223
  end
221
224
  end
222
225
 
223
- def self::watch_services(watchdog_start_off,url,path,db,workers,workers_single,workers_multi)
226
+ def self::watch_services(watchdog_start_off,url,db,workers,workers_single,workers_multi)
224
227
  return if watchdog_start_off
225
228
  EM.defer do
226
229
  workers_single.each do |s|
@@ -228,11 +231,7 @@ module CPEE
228
231
  next if File.exist?(s + '.lock')
229
232
  pid = (File.read(s + '.pid').to_i rescue nil)
230
233
  if (pid.nil? || !(Process.kill(0, pid) rescue false))
231
- cmd = if url.nil?
232
- "-p \"#{path}\" -d #{db} -w #{workers} restart 1>/dev/null 2>&1"
233
- else
234
- "-u \"#{url}\" -d #{db} -w #{workers} restart 1>/dev/null 2>&1"
235
- end
234
+ cmd = "-u \"#{url}\" -d #{db} -w #{workers} restart 1>/dev/null 2>&1"
236
235
  system "#{s}.rb " + cmd + " 1>/dev/null 2>&1"
237
236
  puts "➡ Service #{File.basename(s)} (#{cmd}) started ..."
238
237
  end
data/lib/cpee/redis.rb CHANGED
@@ -13,18 +13,13 @@
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
15
  require 'redis'
16
+ require 'uri'
16
17
 
17
18
  module CPEE
18
19
  def self::redis_connect(opts,name=nil)
19
20
  if opts[:redis_cmd].nil?
20
21
  begin
21
- if opts[:redis_path]
22
- opts[:redis_dyn] = Proc.new { |name| Redis.new(path: opts[:redis_path], db: opts[:redis_db], id: name.gsub(/[^a-zA-Z0-9]/,'-') ) }
23
- elsif opts[:redis_url]
24
- opts[:redis_dyn] = Proc.new { |name| Redis.new(url: opts[:redis_url], db: opts[:redis_db], id: name.gsub(/[^a-zA-Z0-9]/,'-') ) }
25
- else
26
- raise
27
- end
22
+ opts[:redis_dyn] = Proc.new { |name| Redis.new(url: opts[:redis_url], db: opts[:redis_db], id: name.gsub(/[^a-zA-Z0-9]/,'-') ) }
28
23
  opts[:redis] = opts[:redis_dyn].call name.gsub(/[^a-zA-Z0-9]/,'-')
29
24
  opts[:redis].dbsize
30
25
  rescue
@@ -32,19 +27,31 @@ module CPEE
32
27
  exit
33
28
  end
34
29
  else # we always assume file socket if redis is startet locally
35
- opts[:redis_dyn] = if opts[:redis_path]
36
- Proc.new { |name| Redis.new(path: File.join(opts[:basepath],opts[:redis_path]), db: opts[:redis_db].to_i, id: name.gsub(/[^a-zA-Z0-9]/,'-') ) }
37
- elsif opts[:redis_url]
38
- Proc.new { |name| Redis.new(url: opts[:redis_url], db: opts[:redis_db], id: name.gsub(/[^a-zA-Z0-9]/,'-') ) }
30
+ uri = URI::parse(opts[:redis_url])
31
+ if uri.scheme == 'unix' || uri.scheme == 'redis-socket'
32
+ opts[:redis_path] = File.join(uri.host,uri.path).sub(/\/$/,'')
33
+ if !File.absolute_path? opts[:redis_path]
34
+ opts[:redis_url] = 'unix://' + File.join(opts[:basepath],opts[:redis_path])
35
+ end
36
+ opts[:redis_port] = 0
37
+ opts[:redis_unixsocket] = true
39
38
  else
40
- raise
39
+ opts[:redis_port] = uri.port
40
+ opts[:redis_path] = nil
41
+ opts[:redis_unixsocket] = false
41
42
  end
42
43
 
44
+ opts[:redis_dyn] = Proc.new { |name| Redis.new(url: opts[:redis_url], db: opts[:redis_db], id: name.gsub(/[^a-zA-Z0-9]/,'-') ) }
45
+
43
46
  tried = false
44
47
  begin
45
48
  opts[:redis] = opts[:redis_dyn].call name.gsub(/[^a-zA-Z0-9]/,'-')
46
49
  opts[:redis].dbsize
47
50
  rescue => e
51
+ puts e.message
52
+ puts e.backtrace
53
+ exit
54
+
48
55
  res = unless tried
49
56
  rcmd = opts[:redis_cmd]
50
57
  if opts[:redis_path]
@@ -52,11 +59,22 @@ module CPEE
52
59
  else
53
60
  rcmd.gsub! /#redis_path#\s+/, ''
54
61
  end
55
- rcmd.gsub! /#redis_db_dir#/, opts[:basepath]
62
+ if File.absolute_path? opts[:redis_db_name]
63
+ rcmd.gsub! /#redis_db_dir#/, File.dirname(opts[:redis_db_name])
64
+ else
65
+ rcmd.gsub! /#redis_db_dir#/, opts[:basepath]
66
+ end
56
67
  rcmd.gsub! /#redis_db_name#/, opts[:redis_db_name]
57
- rcmd.gsub! /#redis_pid#/, File.join(opts[:basepath],opts[:redis_pid])
68
+ if File.absolute_path? opts[:redis_pid]
69
+ rcmd.gsub! /#redis_pid#/, opts[:redis_pid]
70
+ else
71
+ rcmd.gsub! /#redis_pid#/, File.join(opts[:basepath],opts[:redis_pid])
72
+ end
58
73
  rcmd.gsub! /#redis_port#/, opts[:redis_port].to_s
59
- rcmd.gsub! /--unixsocket\s+/, '' if opts[:redis_unixsocket] == false
74
+ if opts[:redis_unixsocket] == false
75
+ rcmd.gsub! /--unixsocket\s+/, ''
76
+ rcmd.gsub! /--unixsocketperm\s+\d+\s+/, ''
77
+ end
60
78
  puts 'starting redis ... it will keep running, just to let you know ...'
61
79
  system rcmd
62
80
  else
@@ -1,6 +1,5 @@
1
1
  :host: localhost
2
2
  :url: http://localhost:8298/
3
- :redis_path: /tmp/redis.sock
4
- :redis_db: 3
3
+ :redis_db: 1
5
4
  :executionhandlers: ../../executionhandlers/
6
5
  :executionhandler: eval
@@ -35,6 +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
39
  positions = CPEE::Persistence::extract_set(id,opts,'positions')
39
40
  positions.map! do |k, v|
40
41
  [ k, v, CPEE::Persistence::extract_item(id,opts,File.join('positions',k,'@passthrough')) ]
@@ -43,7 +44,6 @@ module CPEE
43
44
  iopts[:host] = opts[:host]
44
45
  iopts[:url] = opts[:url]
45
46
  iopts[:redis_url] = opts[:redis_url]
46
- iopts[:redis_path] = File.join(opts[:basepath],opts[:redis_path])
47
47
  iopts[:redis_db] = opts[:redis_db]
48
48
  iopts[:workers] = opts[:workers]
49
49
  iopts[:global_executionhandlers] = opts[:global_executionhandlers]
@@ -1,7 +1,6 @@
1
1
  :host: localhost
2
2
  :url: http://localhost:8298/
3
- :redis_path: /tmp/redis.sock
4
- :redis_db: 3
3
+ :redis_db: 1
5
4
  :executionhandlers: ../../executionhandlers/
6
5
  :executionhandler: ruby
7
6
  :url_result_transformation: http://localhost:9302/structurize
@@ -35,6 +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
39
  positions = CPEE::Persistence::extract_set(id,opts,'positions')
39
40
  positions.map! do |k, v|
40
41
  [ k, v, CPEE::Persistence::extract_item(id,opts,File.join('positions',k,'@passthrough')) ]
@@ -43,7 +44,6 @@ module CPEE
43
44
  iopts[:host] = opts[:host]
44
45
  iopts[:url] = opts[:url]
45
46
  iopts[:redis_url] = opts[:redis_url]
46
- iopts[:redis_path] = File.join(opts[:basepath],opts[:redis_path])
47
47
  iopts[:redis_db] = opts[:redis_db]
48
48
  iopts[:workers] = opts[:workers]
49
49
  iopts[:global_executionhandlers] = opts[:global_executionhandlers]
@@ -56,13 +56,23 @@ module CPEE
56
56
  template = ERB.new(File.read(ExecutionHandler::Ruby::BACKEND_TEMPLATE), trim_mode: '-')
57
57
  res = template.result_with_hash(dsl: dsl, dataelements: dataelements, endpoints: endpoints, positions: positions)
58
58
  File.write(File.join(opts[:instances],id.to_s,ExecutionHandler::Ruby::BACKEND_INSTANCE),res)
59
+ # if attributes['remote']
60
+ # ### scp instance files to the remote server under run (under instance id)
61
+ # ### touch local .remote with connection details
62
+ # end
59
63
  end
60
64
 
61
65
  def self::run(id,opts)
62
- exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Ruby::BACKEND_RUN))
63
- pid = Kernel.spawn(opts[:libs_preloaderrun] + ' ' + exe , :pgroup => true, :in => '/dev/null', :out => exe + '.out', :err => exe + '.err')
64
- Process.detach pid
65
- File.write(exe + '.pid',pid)
66
+ ### if File file .remote
67
+ ### connect to remote
68
+ ### run same as below
69
+ ### else
70
+ ### Determine whether we run locally or remote
71
+ exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Ruby::BACKEND_RUN))
72
+ pid = Kernel.spawn(opts[:libs_preloaderrun] + ' ' + exe , :pgroup => true, :in => '/dev/null', :out => exe + '.out', :err => exe + '.err')
73
+ Process.detach pid
74
+ File.write(exe + '.pid',pid)
75
+ ### end
66
76
  end
67
77
 
68
78
  def self::stop(id,opts) ### return: bool to tell if manually changing redis is necessary
@@ -1 +1 @@
1
- 3817762
1
+ 377213
@@ -22,13 +22,11 @@ require_relative '../../lib/cpee/redis'
22
22
  Daemonite.new do |opts|
23
23
  opts[:runtime_opts] += [
24
24
  ["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
25
- ["--path=PATH", "-pPATH", "Specify redis path, e.g. /tmp/redis.sock", ->(p){ opts[:redis_path] = p }],
26
25
  ["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }],
27
26
  ["--workers=NUM", "-wNUM", "Number of workers that are expected, e.g. 3", ->(p) { opts[:workers] = p.to_i }]
28
27
  ]
29
28
 
30
29
  on startup do
31
- opts[:redis_path] ||= '/tmp/redis.sock' if opts[:redis_url].nil?
32
30
  opts[:redis_db] ||= 1 if opts[:redis_db].nil?
33
31
 
34
32
  CPEE::redis_connect opts, 'Server Routing End'
@@ -1 +1 @@
1
- 3817526
1
+ 377231
@@ -22,7 +22,6 @@ require_relative '../../lib/cpee/redis'
22
22
  Daemonite.new do |opts|
23
23
  opts[:runtime_opts] += [
24
24
  ["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
25
- ["--path=PATH", "-pPATH", "Specify redis path, e.g. /tmp/redis.sock", ->(p){ opts[:redis_path] = p }],
26
25
  ["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }],
27
26
  ["--worker=NUM", "-wNUM", "Specify the worker id, e.g. 0", ->(p) { opts[:worker] = p.to_i }]
28
27
  ]
@@ -34,7 +33,6 @@ Daemonite.new do |opts|
34
33
  end
35
34
 
36
35
  on startup do
37
- opts[:redis_path] ||= '/tmp/redis.sock' if opts[:redis_url].nil?
38
36
  opts[:redis_db] ||= 1 if opts[:redis_db].nil?
39
37
  CPEE::redis_connect opts, 'Server Routing Forward Events'
40
38
  opts[:pubsubredis] = opts[:redis_dyn].call 'Server Routing Forward Events Sub'
@@ -1 +1 @@
1
- 3817682
1
+ 377225
@@ -49,13 +49,11 @@ end #}}}
49
49
  Daemonite.new do |opts|
50
50
  opts[:runtime_opts] += [
51
51
  ["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
52
- ["--path=PATH", "-pPATH", "Specify redis path, e.g. /tmp/redis.sock", ->(p){ opts[:redis_path] = p }],
53
52
  ["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }],
54
53
  ["--workers=NUM", "-wNUM", "Number of workers that are expected, e.g. 3", ->(p) { opts[:workers] = p.to_i }]
55
54
  ]
56
55
 
57
56
  on startup do
58
- opts[:redis_path] ||= '/tmp/redis.sock' if opts[:redis_url].nil?
59
57
  opts[:redis_db] ||= 1 if opts[:redis_db].nil?
60
58
 
61
59
  CPEE::redis_connect opts, 'Server Routing Forward Votes'
@@ -1 +1 @@
1
- 3817733
1
+ 377219
@@ -25,13 +25,11 @@ EVENTS =
25
25
  Daemonite.new do |opts|
26
26
  opts[:runtime_opts] += [
27
27
  ["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
28
- ["--path=PATH", "-pPATH", "Specify redis path, e.g. /tmp/redis.sock", ->(p){ opts[:redis_path] = p }],
29
28
  ["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }],
30
29
  ["--workers=NUM", "-wNUM", "Number of workers that are expected, e.g. 3", ->(p) { opts[:workers] = p.to_i }]
31
30
  ]
32
31
 
33
32
  on startup do
34
- opts[:redis_path] ||= '/tmp/redis.sock' if opts[:redis_url].nil?
35
33
  opts[:redis_db] ||= 1 if opts[:redis_db].nil?
36
34
  opts[:events] = []
37
35
  0.upto(opts[:workers]-1) do |w|
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: 2.1.101
4
+ version: 2.1.102
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -1054,12 +1054,6 @@ files:
1054
1054
  - server/routing/end.pid
1055
1055
  - server/routing/end.rb
1056
1056
  - server/routing/forward-events-00.pid
1057
- - server/routing/forward-events-01.pid
1058
- - server/routing/forward-events-02.pid
1059
- - server/routing/forward-events-03.pid
1060
- - server/routing/forward-events-04.pid
1061
- - server/routing/forward-events-05.pid
1062
- - server/routing/forward-events-06.pid
1063
1057
  - server/routing/forward-events.rb
1064
1058
  - server/routing/forward-votes.pid
1065
1059
  - server/routing/forward-votes.rb
@@ -1 +0,0 @@
1
- 3817540
@@ -1 +0,0 @@
1
- 3817554
@@ -1 +0,0 @@
1
- 3817568
@@ -1 +0,0 @@
1
- 3817582
@@ -1 +0,0 @@
1
- 3817596
@@ -1 +0,0 @@
1
- 3817610