cpee 2.1.32 → 2.1.33

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: f1021b5fe513c40b5d489dc062285fe8295693da2f0e93cf7027b31b48b48bd6
4
- data.tar.gz: f3c04a3878251f76ef08cfabc841e2612bb99c41074234807a15d8b1c483f9aa
3
+ metadata.gz: 682e529161147c9cefe172e0428a514f6a0f0ab1da0e584584d2a40cdf1e8b31
4
+ data.tar.gz: fd3509bbf881ad2325ca56a785224b5528af1b8c925fb8572e6f07f8542b214e
5
5
  SHA512:
6
- metadata.gz: 3182222b1327b83a77c3c2936b1147d2bbf2ed1b442c5e6bbf25d79a0b430211cee29b375ce88a8852fbfd5b5e260862d3ccc53a63828c257ead2cb995382547
7
- data.tar.gz: 8aaa771f5d6ace88b4704364d2dd657ce15478dae0201e0ef24f6287988166433e741bade35cf5994a1238e9430c34970c146ffe6243cfd2e6afcf27f8c98055
6
+ metadata.gz: 4e33966fe123d62a6da0a1cdd50cf2fc991a0f2646fcf1d7214d2ca11784ccd9a2dfb0e5d27c272d36b1eedf95135bb64e2d3c799caba374abbc8345deeef674
7
+ data.tar.gz: 24885c7f3c35c86c204048c5db47ae5ddb79bc2b29d1aaa619d2f2155efbfb607c205bf319e5360e8bbf71bb2f071ba412492a11a34dc673e4d13daf5386f432
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.32"
3
+ s.version = "2.1.33"
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."
@@ -24,9 +24,9 @@ Gem::Specification.new do |s|
24
24
  s.add_runtime_dependency 'riddl', '~> 0.114'
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 'json', '~>2.1'
28
27
  s.add_runtime_dependency 'redis', '~> 4.1'
29
28
  s.add_runtime_dependency 'rubyzip', '~>2'
30
29
  s.add_runtime_dependency 'charlock_holmes', '~>0'
31
30
  s.add_runtime_dependency 'mimemagic', '~>0'
31
+ s.add_runtime_dependency 'get_process_mem', '~>0.2'
32
32
  end
@@ -68,6 +68,9 @@ module CPEE
68
68
  opts[:watchdog_start_off] ||= false
69
69
  opts[:infinite_loop_stop] ||= 10000
70
70
 
71
+ opts[:dashing_frequency] ||= 3
72
+ opts[:dashing_target] ||= nil
73
+
71
74
  ### set redis_cmd to nil if you want to do global
72
75
  ### at least redis_path or redis_url and redis_db have to be set if you do global
73
76
  opts[:redis_path] ||= 'redis.sock' # use e.g. /tmp/redis.sock for global stuff. Look it up in your redis config
@@ -114,6 +117,55 @@ module CPEE
114
117
  EM.add_periodic_timer(opts[:sse_keepalive_frequency]) do
115
118
  CPEE::Notifications::sse_heartbeat(opts)
116
119
  end
120
+
121
+ if opts[:dashing_target]
122
+ cpu_last = 0
123
+ idl_last = 0
124
+ EM.add_periodic_timer(opts[:dashing_frequency]) do
125
+ src = `cat /proc/stat | head -n 1`.split("\n")
126
+ srm = `cat /proc/meminfo`.split("\n")
127
+ sc = {}
128
+ sm = {}
129
+ src.each do |e|
130
+ x = e.split(' ')
131
+ sc[x[0]] = x[1..-1].map{|r| r.to_i}
132
+ end
133
+ srm.each do |e|
134
+ x = e.split(/\s+/)
135
+ sm[x[0].chop] = x[1].to_i
136
+ end
137
+ scc = 0
138
+ sci = 0
139
+ sc.each do |_,e|
140
+ scc = e[0..4].sum
141
+ sci = e[3]
142
+ end
143
+ cpu_delta = scc - cpu_last
144
+ cpu_idle = sci - idl_last
145
+ cpu_used = cpu_delta - cpu_idle
146
+ cpu_usage = '%.2f' % (100 * cpu_used / cpu_delta.to_f)
147
+ mem_tot = '%.1f' % (sm['MemTotal']/1024.0)
148
+ mem_fre = '%.1f' % (sm['MemFree']/1024.0)
149
+ mem_ava = '%.1f' % (sm['MemAvailable']/1024.0)
150
+ mem_buc = '%.1f' % ((sm['Buffers'] + sm['Cached'] + sm['SReclaimable'])/1024.0)
151
+ mem_usd = '%.1f' % ((sm['MemTotal'] - sm['MemFree'] - sm['Buffers'] - sm['Cached'] - sm['SReclaimable'])/1024.0)
152
+
153
+ # puts "CPU usage at #{cpu_usage}%"
154
+ # puts "Mem usage at #{mem_tot}/#{mem_fre}/#{mem_usd}/#{mem_buc}/#{mem_ava}"
155
+ content = {}
156
+ content['cpu_usage'] = cpu_usage
157
+ content['mem_total'] = mem_tot
158
+ content['mem_free'] = mem_fre
159
+ content['mem_available'] = mem_ava
160
+ content['mem_bufferedandcached'] = mem_buc
161
+ content['mem_used'] = mem_usd
162
+ CPEE::Message::send_url(:event,'node/resource_utilization',File.join(opts[:url],'/'),content,File.join(opts[:dashing_target],'/dash/events'))
163
+
164
+ # Keep this as last for our next read
165
+ idl_last = sci
166
+ cpu_last = scc
167
+ end
168
+ end
117
169
  end
118
170
 
119
171
  cleanup do
data/lib/cpee/message.rb CHANGED
@@ -39,6 +39,26 @@ module CPEE
39
39
  )
40
40
  end
41
41
 
42
+ def self::send_url(type, event, cpee, content={}, backend)
43
+ topic = ::File::dirname(event)
44
+ name = ::File::basename(event)
45
+ client = Riddl::Client.new(backend)
46
+ payload = {
47
+ WHO => cpee,
48
+ 'topic' => topic,
49
+ 'type' => type,
50
+ 'name' => name,
51
+ 'timestamp' => Time.now.xmlschema(3),
52
+ 'content' => content
53
+ }
54
+ client = Riddl::Client.new(backend)
55
+ client.post [
56
+ Riddl::Parameter::Simple::new('type',type),
57
+ Riddl::Parameter::Simple::new('topic',topic),
58
+ Riddl::Parameter::Simple::new('event',name),
59
+ Riddl::Parameter::Complex::new('notification','application/json',JSON::generate(payload))
60
+ ]
61
+ end
42
62
  end
43
63
 
44
64
  end
@@ -15,6 +15,7 @@
15
15
  require 'charlock_holmes'
16
16
  require 'mimemagic'
17
17
  require 'base64'
18
+ require 'get_process_mem'
18
19
 
19
20
  class ConnectionWrapper < WEEL::ConnectionWrapperBase
20
21
  def self::loop_guard(arguments,id,count) # {{{
@@ -192,6 +193,7 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
192
193
 
193
194
  def inform_activity_done # {{{
194
195
  @controller.notify("activity/done", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position)
196
+ @controller.notify("status/resource_utilization", :mib => GetProcessMem.new.mb, **Process.times.to_h)
195
197
  end # }}}
196
198
  def inform_activity_manipulate # {{{
197
199
  @controller.notify("activity/manipulating", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position)
@@ -311,10 +313,14 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
311
313
  end
312
314
 
313
315
  def callback(result=nil,options={})
314
- @controller.notify("activity/receiving", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => structurize_result(result), :annotations => @anno)
316
+ recv = structurize_result(result)
317
+ @controller.notify("activity/receiving", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => recv, :annotations => @anno)
315
318
  @guard_files += result
316
319
  @handler_returnValue = simplify_result(result)
317
320
  @handler_returnOptions = options
321
+ if options['CPEE_EVENT']
322
+ @controller.notify("task/#{headers['CPEE_EVENT'].gsub(/[^\w_-]/,'')}", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => recv)
323
+ end
318
324
  if options['CPEE_UPDATE']
319
325
  if options['CPEE_UPDATE_STATUS']
320
326
  @controller.notify("activity/status", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :status => options['CPEE_UPDATE_STATUS'])
@@ -41,6 +41,7 @@
41
41
  <vote>change</vote>
42
42
  </topic>
43
43
  <topic id='status'>
44
+ <event>resource_utilization</event>
44
45
  <event>change</event>
45
46
  </topic>
46
47
  <topic id='dataelements'>
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.32
4
+ version: 2.1.33
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: 2022-02-03 00:00:00.000000000 Z
13
+ date: 2022-04-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: riddl
@@ -61,49 +61,49 @@ dependencies:
61
61
  - !ruby/object:Gem::Version
62
62
  version: '2.0'
63
63
  - !ruby/object:Gem::Dependency
64
- name: json
64
+ name: redis
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '2.1'
69
+ version: '4.1'
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: '2.1'
76
+ version: '4.1'
77
77
  - !ruby/object:Gem::Dependency
78
- name: redis
78
+ name: rubyzip
79
79
  requirement: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '4.1'
83
+ version: '2'
84
84
  type: :runtime
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '4.1'
90
+ version: '2'
91
91
  - !ruby/object:Gem::Dependency
92
- name: rubyzip
92
+ name: charlock_holmes
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '2'
97
+ version: '0'
98
98
  type: :runtime
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: '2'
104
+ version: '0'
105
105
  - !ruby/object:Gem::Dependency
106
- name: charlock_holmes
106
+ name: mimemagic
107
107
  requirement: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
@@ -117,19 +117,19 @@ dependencies:
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  - !ruby/object:Gem::Dependency
120
- name: mimemagic
120
+ name: get_process_mem
121
121
  requirement: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '0'
125
+ version: '0.2'
126
126
  type: :runtime
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '0'
132
+ version: '0.2'
133
133
  description: see http://cpee.org
134
134
  email: juergen.mangler@gmail.com
135
135
  executables:
@@ -664,13 +664,9 @@ files:
664
664
  - server/resources/states.xml
665
665
  - server/resources/topics.xml
666
666
  - server/resources/transformation.xml
667
- - server/routing/end.pid
668
667
  - server/routing/end.rb
669
- - server/routing/forward-events.pid
670
668
  - server/routing/forward-events.rb
671
- - server/routing/forward-votes.pid
672
669
  - server/routing/forward-votes.rb
673
- - server/routing/persist.pid
674
670
  - server/routing/persist.rb
675
671
  - server/server.conf
676
672
  - server/server.rb
@@ -1 +0,0 @@
1
- 2206017
@@ -1 +0,0 @@
1
- 2206021
@@ -1 +0,0 @@
1
- 2206025
@@ -1 +0,0 @@
1
- 2206029