cpee 2.1.41 → 2.1.43

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: d269456c4ed16bc2f73b834e4c680e93c6f187e4b4ae24da9b5158bf0df6f9c0
4
- data.tar.gz: fc4b08c08ef7797727d14f02293c1087fc3ff4ed30ceb9febd86e07deec058c9
3
+ metadata.gz: efe2b979ffa5688e94ddc6d344f22a000ec05ee8431829a540a1e029eb6447e0
4
+ data.tar.gz: e806711116591e7cbf37132ca4950d6b824b90b85fe9806b8d0a2aa2186fe43d
5
5
  SHA512:
6
- metadata.gz: 29cd768da588727ae216e0d5c4474b791db7ac957e8b4b62035223fc8ac106efefaae8cababbac13dad6f77b4e76126dac5bf6e735fb9ad5b6151d04900c3d8b
7
- data.tar.gz: 0ac57fa8dadd564b2c4eb3fa16e82e7694c7bafcee4f9276274f613234fe2c385307bd2b80da17016f81b471002f782d4bff2e31524a3354e06a9af6a56488ab
6
+ metadata.gz: 7216bbfcc02ef6e23c085bdbe521f8f84d39c752415bc2e46498fcd658b88eed491e1387bbd85147b1defd9cc49b8872ff82d22ceabe9e4dd4d4035c25c53bf5
7
+ data.tar.gz: 25de4d62af41f018535725dbd93b493c0e12161553c070f6c1db6dcadcca4dac9621d442eabdb8c9cfc33783e7e622cc7c8e76682a13542c262bcb6d0f0c9ddd
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.41"
3
+ s.version = "2.1.43"
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.org). If you just need workflow execution, without a rest service exposing it, then use WEEL."
@@ -21,10 +21,10 @@ Gem::Specification.new do |s|
21
21
  s.email = 'juergen.mangler@gmail.com'
22
22
  s.homepage = 'http://cpee.org/'
23
23
 
24
- s.add_runtime_dependency 'riddl', '~> 0.114'
24
+ s.add_runtime_dependency 'riddl', '~> 0.126'
25
25
  s.add_runtime_dependency 'weel', '~> 1.99', '>= 1.99.99'
26
26
  s.add_runtime_dependency 'highline', '~> 2.0'
27
- s.add_runtime_dependency 'redis', '~> 4.1'
27
+ s.add_runtime_dependency 'redis', '~> 5.0'
28
28
  s.add_runtime_dependency 'rubyzip', '~>2'
29
29
  s.add_runtime_dependency 'charlock_holmes', '~>0'
30
30
  s.add_runtime_dependency 'mimemagic', '~>0'
@@ -70,8 +70,8 @@ module CPEE
70
70
  opts[:watchdog_start_off] ||= false
71
71
  opts[:infinite_loop_stop] ||= 10000
72
72
  opts[:workers] ||= 1
73
- opts[:workers_single] ||= ['end','forward-votes']
74
- opts[:workers_multi] ||= ['persist','forward-events']
73
+ opts[:workers_single] ||= ['end','persist','forward-votes']
74
+ opts[:workers_multi] ||= ['forward-events']
75
75
 
76
76
  opts[:dashing_frequency] ||= 3
77
77
  opts[:dashing_target] ||= nil
@@ -212,12 +212,13 @@ module CPEE
212
212
  next if File.exist?(s + '.lock')
213
213
  pid = (File.read(s + '.pid').to_i rescue nil)
214
214
  if (pid.nil? || !(Process.kill(0, pid) rescue false))
215
- if url.nil?
216
- system "#{s}.rb -p \"#{path}\" -d #{db} restart 1>/dev/null 2>&1"
215
+ cmd = if url.nil?
216
+ "-p \"#{path}\" -d #{db} -w #{workers} restart 1>/dev/null 2>&1"
217
217
  else
218
- system "#{s}.rb -u \"#{url}\" -d #{db} restart 1>/dev/null 2>&1"
218
+ "-u \"#{url}\" -d #{db} -w #{workers} restart 1>/dev/null 2>&1"
219
219
  end
220
- puts "➡ Service #{File.basename(s)} started ..."
220
+ system "#{s}.rb " + cmd + " 1>/dev/null 2>&1"
221
+ puts "➡ Service #{File.basename(s)} (#{cmd}) started ..."
221
222
  end
222
223
  end
223
224
  workers_multi.each do |s|
@@ -338,7 +339,7 @@ module CPEE
338
339
  :state => 'ready',
339
340
  :attributes => CPEE::Persistence::extract_list(id,opts,'attributes').to_h
340
341
  }
341
- CPEE::Message::send(:event,'state/change',File.join(opts[:url],'/'),id,uuid,name,content,redis,opts[:workers])
342
+ CPEE::Message::send(:event,'state/change',File.join(opts[:url],'/'),id,uuid,name,content,redis)
342
343
 
343
344
  @headers << Riddl::Header.new("CPEE-INSTANCE", id.to_s)
344
345
  @headers << Riddl::Header.new("CPEE-INSTANCE-URL", File.join(opts[:url].to_s,id.to_s,'/'))
@@ -59,23 +59,27 @@ class Controller
59
59
  @psredis = @opts[:redis_dyn].call "Instance #{@id} Callback Response"
60
60
  @psredis.psubscribe('callback-response:*','callback-end:*') do |on|
61
61
  on.pmessage do |pat, what, message|
62
- if pat == 'callback-response:*' && @callback_keys.has_key?(what[18..-1])
63
- index = message.index(' ')
64
- mess = message[index+1..-1]
65
- instance = message[0...index]
66
- m = JSON.parse(mess)
67
- resp = []
68
- m['content']['values'].each do |e|
69
- if e[1][0] == 'simple'
70
- resp << Riddl::Parameter::Simple.new(e[0],e[1][1])
71
- elsif e[1][0] == 'complex'
72
- resp << Riddl::Parameter::Complex.new(e[0],e[1][1],File.open(e[1][2]))
62
+ if pat == 'callback-response:*'
63
+ _, worker, identifier = what.split(':')
64
+ if @callback_keys.has_key?(identifier)
65
+ index = message.index(' ')
66
+ mess = message[index+1..-1]
67
+ instance = message[0...index]
68
+ m = JSON.parse(mess)
69
+ resp = []
70
+ m['content']['values'].each do |e|
71
+ if e[1][0] == 'simple'
72
+ resp << Riddl::Parameter::Simple.new(e[0],e[1][1])
73
+ elsif e[1][0] == 'complex'
74
+ resp << Riddl::Parameter::Complex.new(e[0],e[1][1],File.open(e[1][2]))
75
+ end
73
76
  end
77
+ @callback_keys[identifier].send(:callback,resp,m['content']['headers'])
74
78
  end
75
- @callback_keys[what[18..-1]].send(:callback,resp,m['content']['headers'])
76
79
  end
77
80
  if pat == 'callback-end:*'
78
- @callback_keys.delete(what[13..-1])
81
+ _, worker, identifier = what.split(':')
82
+ @callback_keys.delete(identifier)
79
83
  end
80
84
  end
81
85
  end
@@ -23,7 +23,8 @@ Daemonite.new do |opts|
23
23
  opts[:runtime_opts] += [
24
24
  ["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
25
25
  ["--path=PATH", "-pPATH", "Specify redis path, e.g. /tmp/redis.sock", ->(p){ opts[:redis_path] = p }],
26
- ["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }]
26
+ ["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }],
27
+ ["--workers=NUM", "-wNUM", "Number of workers that are expected, e.g. 3", ->(p) { opts[:workers] = p.to_i }]
27
28
  ]
28
29
 
29
30
  on startup do
@@ -49,7 +49,8 @@ Daemonite.new do |opts|
49
49
  opts[:runtime_opts] += [
50
50
  ["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
51
51
  ["--path=PATH", "-pPATH", "Specify redis path, e.g. /tmp/redis.sock", ->(p){ opts[:redis_path] = p }],
52
- ["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }]
52
+ ["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }],
53
+ ["--workers=NUM", "-wNUM", "Number of workers that are expected, e.g. 3", ->(p) { opts[:workers] = p.to_i }]
53
54
  ]
54
55
 
55
56
  on startup do
@@ -27,44 +27,43 @@ Daemonite.new do |opts|
27
27
  ["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
28
28
  ["--path=PATH", "-pPATH", "Specify redis path, e.g. /tmp/redis.sock", ->(p){ opts[:redis_path] = p }],
29
29
  ["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }],
30
- ["--worker=NUM", "-wNUM", "Specify the worker id, e.g. 0", ->(p) { opts[:worker] = p.to_i }]
30
+ ["--workers=NUM", "-wNUM", "Number of workers that are expected, e.g. 3", ->(p) { opts[:workers] = p.to_i }]
31
31
  ]
32
32
 
33
- on setup do
34
- opts[:worker] ||= 0
35
- opts[:worker] = ('%02i' % opts[:worker]).freeze
36
- opts[:pidfile] = File.basename(opts[:pidfile],'.pid') + '-' + opts[:worker].to_s + '.pid'
37
- end
38
-
39
33
  on startup do
40
34
  opts[:redis_path] ||= '/tmp/redis.sock'.freeze
41
35
  opts[:redis_db] ||= 1
42
- opts[:events] = [
43
- 'event:' + opts[:worker].to_s + ':state/change',
44
- 'event:' + opts[:worker].to_s + ':executionhandler/change',
45
- 'event:' + opts[:worker].to_s + ':description/change',
46
- 'event:' + opts[:worker].to_s + ':dataelements/change',
47
- 'event:' + opts[:worker].to_s + ':endpoints/change',
48
- 'event:' + opts[:worker].to_s + ':attributes/change',
49
- 'event:' + opts[:worker].to_s + ':transformation/change',
50
- 'event:' + opts[:worker].to_s + ':status/change',
51
- 'event:' + opts[:worker].to_s + ':position/change',
52
- 'event:' + opts[:worker].to_s + ':handler/change',
53
- 'callback:' + opts[:worker].to_s + ':activity/content'
54
- ].freeze
36
+ opts[:events] = []
37
+ 0.upto(opts[:workers]-1) do |w|
38
+ opts[:events] += [
39
+ 'event:' + ('%02i' % w) + ':state/change',
40
+ 'event:' + ('%02i' % w) + ':executionhandler/change',
41
+ 'event:' + ('%02i' % w) + ':description/change',
42
+ 'event:' + ('%02i' % w) + ':dataelements/change',
43
+ 'event:' + ('%02i' % w) + ':endpoints/change',
44
+ 'event:' + ('%02i' % w) + ':attributes/change',
45
+ 'event:' + ('%02i' % w) + ':transformation/change',
46
+ 'event:' + ('%02i' % w) + ':status/change',
47
+ 'event:' + ('%02i' % w) + ':position/change',
48
+ 'event:' + ('%02i' % w) + ':handler/change',
49
+ 'callback:' + ('%02i' % w) + ':activity/content'
50
+ ]
51
+ end
52
+ opts[:events].freeze
55
53
  CPEE::redis_connect opts, 'Server Routing Persist'
56
54
  opts[:pubsubredis] = opts[:redis_dyn].call 'Server Routing Persist Sub'
55
+ rescue => e
56
+ puts e.message
57
+ puts e.backtrace
57
58
  end
58
59
 
59
60
  run do
60
- p opts[:events]
61
61
  opts[:pubsubredis].subscribe(opts[:events]) do |on|
62
62
  on.message do |what, message|
63
- p 'rrrr'
64
63
  mess = JSON.parse(message[message.index(' ')+1..-1])
65
64
  instance = mess.dig('instance')
66
65
  case what
67
- when 'callback:' + opts[:worker] + ':activity/content'
66
+ when /callback:\d+:activity\/content/
68
67
  key = mess.dig('content','key')
69
68
  opts[:redis].multi do |multi|
70
69
  multi.sadd("instance:#{instance}/callbacks",key)
@@ -73,28 +72,28 @@ Daemonite.new do |opts|
73
72
  multi.set("instance:#{instance}/callback/#{key}/position",mess.dig('content','activity'))
74
73
  multi.set("instance:#{instance}/callback/#{key}/type",'callback')
75
74
  end
76
- when 'event:' + opts[:worker] + ':state/change'
75
+ when /event:\d+:state\/change/
77
76
  opts[:redis].multi do |multi|
78
77
  unless mess.dig('content','state') == 'purged'
79
78
  multi.set("instance:#{instance}/state",mess.dig('content','state'))
80
79
  multi.set("instance:#{instance}/state/@changed",mess.dig('timestamp'))
81
80
  end
82
81
  end
83
- when 'event:' + opts[:worker] + ':executionhandler/change'
82
+ when /event:\d+:executionhandler\/change/
84
83
  opts[:redis].set("instance:#{instance}/executionhandler",mess.dig('content','executionhandler'))
85
- when 'event:' + opts[:worker] + ':description/change'
84
+ when /event:\d+:description\/change/
86
85
  opts[:redis].multi do |multi|
87
86
  multi.set("instance:#{instance}/description",mess.dig('content','description'))
88
87
  multi.set("instance:#{instance}/dslx",mess.dig('content','dslx'))
89
88
  multi.set("instance:#{instance}/dsl",mess.dig('content','dsl'))
90
89
  end
91
- when 'event:' + opts[:worker] + ':dataelements/change', 'event:' + opts[:worker] + ':endpoints/change', 'event:' + opts[:worker] + ':attributes/change'
90
+ when /event:\d+:dataelements\/change/, /event:\d+:endpoints\/change/, /event:\d+:attributes\/change/
92
91
  topic = mess.dig('topic')
93
92
  opts[:redis].multi do |multi|
94
93
  mess.dig('content','changed')&.each_with_index do |c,i|
95
- unless what == 'event:' + opts[:worker] + ':attributes/change' && c == 'uuid'
94
+ unless what =~ /event:\d+:attributes\/change/ && c == 'uuid'
96
95
  multi.zadd("instance:#{instance}/#{topic}",i,c)
97
- if what == 'event:' + opts[:worker] + ':dataelements/change'
96
+ if what =~ /event:\d+:dataelements\/change/
98
97
  multi.set("instance:#{instance}/#{topic}/#{c}",CPEE::ValueHelper::generate(mess.dig('content','values',c)))
99
98
  else
100
99
  multi.set("instance:#{instance}/#{topic}/#{c}",mess.dig('content','values',c))
@@ -102,13 +101,13 @@ Daemonite.new do |opts|
102
101
  end
103
102
  end
104
103
  mess.dig('content','deleted')&.to_a&.each do |c|
105
- unless what == 'event:' + opts[:worker] + ':attributes/change' && c == 'uuid'
104
+ unless what =~ /event:\d+:attributes\/change/ && c == 'uuid'
106
105
  multi.zrem("instance:#{instance}/#{topic}",c)
107
106
  multi.del("instance:#{instance}/#{topic}/#{c}")
108
107
  end
109
108
  end
110
109
  end
111
- when 'event:' + opts[:worker] + ':transformation/change'
110
+ when /event:\d+:transformation\/change/
112
111
  opts[:redis].multi do |multi|
113
112
  multi.set("instance:#{instance}/transformation/description",mess.dig('content','description'))
114
113
  multi.set("instance:#{instance}/transformation/description/@type",mess.dig('content','description_type'))
@@ -117,12 +116,12 @@ Daemonite.new do |opts|
117
116
  multi.set("instance:#{instance}/transformation/endpoints",mess.dig('content','endpoints'))
118
117
  multi.set("instance:#{instance}/transformation/endpoints/@type",mess.dig('content','endpoints_type'))
119
118
  end
120
- when 'event:' + opts[:worker] + ':status/change'
119
+ when /event:\d+:status\/change/
121
120
  opts[:redis].multi do |multi|
122
121
  multi.set("instance:#{instance}/status/id",mess.dig('content','id'))
123
122
  multi.set("instance:#{instance}/status/message",mess.dig('content','message'))
124
123
  end
125
- when 'event:' + opts[:worker] + ':position/change'
124
+ when /event:\d+:position\/change/
126
125
  opts[:redis].multi do |multi|
127
126
  c = mess.dig('content')
128
127
  c.dig('unmark')&.each do |ele|
@@ -149,7 +148,7 @@ Daemonite.new do |opts|
149
148
  multi.set("instance:#{instance}/positions/#{ele['position']}",'after')
150
149
  end
151
150
  end
152
- when 'event:' + opts[:worker] + ':handler/change'
151
+ when /event:\d+:handler\/change/
153
152
  opts[:redis].multi do |multi|
154
153
  mess.dig('content','changed').each do |c|
155
154
  multi.sadd("instance:#{instance}/handlers",mess.dig('content','key'))
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.41
4
+ version: 2.1.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: tools
12
12
  cert_chain: []
13
- date: 2023-03-02 00:00:00.000000000 Z
13
+ date: 2023-03-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: riddl
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '0.114'
21
+ version: '0.126'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '0.114'
28
+ version: '0.126'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: weel
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -66,14 +66,14 @@ dependencies:
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '4.1'
69
+ version: '5.0'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '4.1'
76
+ version: '5.0'
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: rubyzip
79
79
  requirement: !ruby/object:Gem::Requirement
@@ -707,21 +707,9 @@ files:
707
707
  - server/resources/states.xml
708
708
  - server/resources/topics.xml
709
709
  - server/resources/transformation.xml
710
- - server/routing/end.pid
711
710
  - server/routing/end.rb
712
- - server/routing/forward-events-00.pid
713
- - server/routing/forward-events-01.pid
714
- - server/routing/forward-events-02.pid
715
- - server/routing/forward-events-03.pid
716
- - server/routing/forward-events-04.pid
717
711
  - server/routing/forward-events.rb
718
- - server/routing/forward-votes.pid
719
712
  - server/routing/forward-votes.rb
720
- - server/routing/persist-00.pid
721
- - server/routing/persist-01.pid
722
- - server/routing/persist-02.pid
723
- - server/routing/persist-03.pid
724
- - server/routing/persist-04.pid
725
713
  - server/routing/persist.rb
726
714
  - server/server.conf
727
715
  - server/server.pid
@@ -1 +0,0 @@
1
- 1944554
@@ -1 +0,0 @@
1
- 1944613
@@ -1 +0,0 @@
1
- 1944633
@@ -1 +0,0 @@
1
- 1944637
@@ -1 +0,0 @@
1
- 1944645
@@ -1 +0,0 @@
1
- 1944650
@@ -1 +0,0 @@
1
- 1944558
@@ -1 +0,0 @@
1
- 1944562
@@ -1 +0,0 @@
1
- 1944566
@@ -1 +0,0 @@
1
- 1944570
@@ -1 +0,0 @@
1
- 1944598
@@ -1 +0,0 @@
1
- 1944602