cpee-model-management 1.2.2 → 1.2.3

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: 1410ff8045350ca1f2bd3c5484c43647989b4f6cfe48279ad07db1d437efa1f9
4
- data.tar.gz: b5763ad9ddecacc90e9fb82a41dc7d203690a11366b5e6af403b7ca632b16ae5
3
+ metadata.gz: cbd52e9e07809d503c71fb7b716fe287949a4aaf8030518110ae05f98295b8c1
4
+ data.tar.gz: 40289a6d6147b5358b088fa3885c8df2e2c50bb61bfbd54122ec8681489f99a1
5
5
  SHA512:
6
- metadata.gz: 7f8f434c1173d75de6bae7ab39b0fcfdc2e6477476dd903f04243760c22838702526e8a67c837f22af57cfbb9e5e7e3c91cb5dc3bae8d93068ed07756a32a013
7
- data.tar.gz: ea38c5d580c580f37fda8b7a08efcc34e3116958fec02f3f6f88443daee63012d9f40841d8ee059f88b0c2226c264399316e62576ad72a4b269f65d87f733fe8
6
+ metadata.gz: 0b7b76036df9e4ec5ebae8283d2d84d7eda794d1c195db080425d9cecba4650b7eabe52c785864c25af30bd29ad1a05bec63c66887e70b56e2f1b3ea5c783bea
7
+ data.tar.gz: a231affcade7800f587ea6bdfe2bdf3f1bce2ea8774d6e91e1c5bcc9bd1ff3da3b1ded34c9938170d89c165ced44a2203cd4723e7ec438c88c32076fa91f4a6d
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-model-management"
3
- s.version = "1.2.2"
3
+ s.version = "1.2.3"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "(Lifecycle) manage your process models in a directory or git repo."
@@ -724,10 +724,13 @@ module CPEE
724
724
  multi.set(File.join(prefix,'name'),attr['info'])
725
725
  multi.set(File.join(prefix,'cpu'),0)
726
726
  multi.set(File.join(prefix,'mem'),0)
727
- multi.set(File.join(prefix,'time'),0)
727
+ multi.set(File.join(prefix,'time'),Time.now.to_i)
728
728
  end
729
729
  elsif %w{stopping}.include?(content['state'])
730
- redis.set(File.join(prefix,'state'),content['state'])
730
+ redis.multi do |multi|
731
+ multi.set(File.join(prefix,'state'),content['state'])
732
+ multi.set(File.join(prefix,'time'),Time.now.to_i)
733
+ end
731
734
  elsif %w{stopped}.include?(content['state'])
732
735
  redis.multi do |multi|
733
736
  multi.decr(File.join(engine,'running'))
@@ -735,7 +738,7 @@ module CPEE
735
738
  multi.set(File.join(prefix,'state'),content['state'])
736
739
  multi.set(File.join(prefix,'cpu'),0)
737
740
  multi.set(File.join(prefix,'mem'),0)
738
- multi.set(File.join(prefix,'time'),0)
741
+ multi.set(File.join(prefix,'time'),Time.now.to_i)
739
742
  end
740
743
  elsif %w{running}.include?(content['state'])
741
744
  oldstate = redis.get(File.join(prefix,'state'))
@@ -748,16 +751,17 @@ module CPEE
748
751
  end
749
752
  end
750
753
 
751
- url, author, path, name, state, parent = redis.mget(
754
+ url, author, path, name, state, time, parent = redis.mget(
752
755
  File.join(prefix,'instance-url'),
753
756
  File.join(prefix,'author'),
754
757
  File.join(prefix,'path'),
755
758
  File.join(prefix,'name'),
756
759
  File.join(prefix,'state'),
760
+ File.join(prefix,'time'),
757
761
  File.join(prefix,'parent')
758
762
  )
759
763
  receivers.each do |conn|
760
- conn.send JSON::generate(:topic => topic, :event => event_name, :engine => engine, :uuid => notification['instance-uuid'], :url => url, :author => author, :path => path.to_s, :name => name, :state => content['state'], :parent => parent.to_s)
764
+ conn.send JSON::generate(:topic => topic, :event => event_name, :engine => engine, :uuid => notification['instance-uuid'], :url => url, :author => author, :path => path.to_s, :name => name, :state => content['state'], :time => time, :parent => parent.to_s)
761
765
  end
762
766
  elsif topic == 'task' && event_name == 'instantiation'
763
767
  redis.multi do |multi|
@@ -765,16 +769,17 @@ module CPEE
765
769
  multi.set(File.join(engine,content['received']['CPEE-INSTANCE-UUID'],'parent'),notification['instance-uuid'])
766
770
  end
767
771
  prefix = File.join(engine,content['received']['CPEE-INSTANCE-UUID'].to_s)
768
- url, author, path, name, state, parent = redis.mget(
772
+ url, author, path, name, state, time, parent = redis.mget(
769
773
  File.join(prefix,'instance-url'),
770
774
  File.join(prefix,'author'),
771
775
  File.join(prefix,'path'),
772
776
  File.join(prefix,'name'),
773
777
  File.join(prefix,'state'),
778
+ File.join(prefix,'time'),
774
779
  File.join(prefix,'parent')
775
780
  )
776
781
  receivers.each do |conn|
777
- conn.send JSON::generate(:topic => 'state', :event => 'change', :engine => engine, :uuid => content['received']['CPEE-INSTANCE-UUID'], :url => url, :author => author, :path => path.to_s, :name => name, :state => state, :parent => parent.to_s)
782
+ conn.send JSON::generate(:topic => 'state', :event => 'change', :engine => engine, :uuid => content['received']['CPEE-INSTANCE-UUID'], :url => url, :author => author, :path => path.to_s, :name => name, :state => state, :time => time, :parent => parent.to_s)
778
783
  end
779
784
  elsif topic == 'status' && event_name == 'resource_utilization'
780
785
  redis.multi do |multi|
@@ -821,7 +826,7 @@ module CPEE
821
826
  doc = XML::Smart.string('<instances/>')
822
827
  redis.lrange(File.join(engine,'instances'),0,-1).each do |i|
823
828
  prefix = File.join(engine,i.to_s)
824
- url, author, path, name, state, cpu, mem, parent = redis.mget(
829
+ url, author, path, name, state, cpu, mem, parent,time = redis.mget(
825
830
  File.join(prefix,'instance-url'),
826
831
  File.join(prefix,'author'),
827
832
  File.join(prefix,'path'),
@@ -829,9 +834,10 @@ module CPEE
829
834
  File.join(prefix,'state'),
830
835
  File.join(prefix,'cpu'),
831
836
  File.join(prefix,'mem'),
832
- File.join(prefix,'parent')
837
+ File.join(prefix,'parent'),
838
+ File.join(prefix,'time')
833
839
  )
834
- doc.root.add('instance', :uuid => i, :url => url, :author => author, :path => path, :name => name, :state => state, :cpu => cpu, :mem => mem, :parent => parent)
840
+ doc.root.add('instance', :uuid => i, :url => url, :author => author, :path => path, :name => name, :state => state, :cpu => cpu, :mem => mem, :parent => parent, :time => time)
835
841
  end
836
842
  Riddl::Parameter::Complex.new('tree','text/xml',doc.to_s)
837
843
  end
@@ -842,7 +848,7 @@ module CPEE
842
848
  engine = @p[0].value
843
849
  uuid = @r[-1]
844
850
  prefix = File.join(engine,uuid.to_s)
845
- url, author, path, name, state, cpu, mem, parent = redis.mget(
851
+ url, author, path, name, state, cpu, mem, parent, time = redis.mget(
846
852
  File.join(prefix,'instance-url'),
847
853
  File.join(prefix,'author'),
848
854
  File.join(prefix,'path'),
@@ -850,9 +856,11 @@ module CPEE
850
856
  File.join(prefix,'state'),
851
857
  File.join(prefix,'cpu'),
852
858
  File.join(prefix,'mem'),
853
- File.join(prefix,'parent')
859
+ File.join(prefix,'parent'),
860
+ File.join(prefix,'time')
861
+
854
862
  )
855
- Riddl::Parameter::Complex.new('instance','application/json',JSON.generate(:uuid => uuid, :url => url, :author => author, :path => path, :name => name, :state => state, :cpu => cpu, :mem => mem, :parent => parent))
863
+ Riddl::Parameter::Complex.new('instance','application/json',JSON.generate(:uuid => uuid, :url => url, :author => author, :path => path, :name => name, :state => state, :cpu => cpu, :mem => mem, :parent => parent, :time => time))
856
864
  end
857
865
  end #}}}
858
866
 
data/ui/index.html CHANGED
@@ -167,7 +167,7 @@
167
167
  <td class="state"><span class='value'></span> <span class='abandon'>[<a href='#' title='abandon'>a</a>]</span></td>
168
168
  <td class="author"><em>unknown</em></td>
169
169
  <td class="mem"></em></td>
170
- <td class="active"></em></td>
170
+ <td class="time"></em></td>
171
171
  </tr>
172
172
  <tr class="sub">
173
173
  <td colspan="6"><table></table></td>
data/ui/js/stats.js CHANGED
@@ -61,12 +61,12 @@ function instance_change(d) {
61
61
  if ($('[data-id=' + d.uuid + ']').length > 0) {
62
62
  if ($('[data-id=' + d.uuid + ']').attr('data-parent') != parent) {
63
63
  $('[data-id=' + d.uuid + ']').remove()
64
- instance_add(iname,d.uuid,d.url,d.name,d.state,d.author,0,0,d.parent)
64
+ instance_add(iname,d.uuid,d.url,d.name,d.state,d.author,0,0,d.time,d.parent)
65
65
  } else {
66
- instance_upd(d.uuid,d.name,d.state,d.author,0,0,d.parent)
66
+ instance_upd(d.uuid,d.name,d.state,d.author,0,0,d.time,d.parent)
67
67
  }
68
68
  } else {
69
- instance_add(iname,d.uuid,d.url,d.name,d.state,d.author,0,0,d.parent)
69
+ instance_add(iname,d.uuid,d.url,d.name,d.state,d.author,0,0,d.time,d.parent)
70
70
  }
71
71
  } else if (d.state == 'abandoned' || d.state == 'finished') {
72
72
  if ($('tr.sub[data-id=' + d.uuid + '] > td > table > tr').length > 0) {
@@ -77,14 +77,14 @@ function instance_change(d) {
77
77
  } else {
78
78
  if ($('tr.sub[data-id=' + d.uuid + ']').attr('data-parent') != d.parent) {
79
79
  $('[data-id=' + d.uuid + ']').remove()
80
- instance_add(iname,d.uuid,d.url,d.name,d.state,d.author,0,0,d.parent)
80
+ instance_add(iname,d.uuid,d.url,d.name,d.state,d.author,0,0,d.time,d.parent)
81
81
  } else {
82
- instance_upd(d.uuid,d.name,d.state,d.author,0,0,d.parent)
82
+ instance_upd(d.uuid,d.name,d.state,d.author,0,0,d.time,d.parent)
83
83
  }
84
84
  }
85
85
  }
86
86
 
87
- function instance_upd(uuid,name,state,author,cpu,mem,parent) {
87
+ function instance_upd(uuid,name,state,author,cpu,mem,time,parent) {
88
88
  if (name != "") {
89
89
  $('[data-id=' + uuid + '] > .name a').text(name)
90
90
  $('[data-id=' + uuid + '] > .name a').attr('title',name)
@@ -94,13 +94,14 @@ function instance_upd(uuid,name,state,author,cpu,mem,parent) {
94
94
  if (author != "") {
95
95
  $('[data-id=' + uuid + '] > .author').text(author)
96
96
  }
97
+ $('[data-id=' + uuid + '] > .time').text((new Date(time * 1000)).strftime("%H:%M:%S (%b-%d)"))
97
98
  instance_res(uuid,cpu,mem)
98
99
  }
99
100
  function instance_res(uuid,cpu,mem) {
100
101
  $('[data-id=' + uuid + '] > .cpu').text($.sprintf('%05.2f',cpu))
101
102
  $('[data-id=' + uuid + '] > .mem').text($.sprintf('%05.2f',mem))
102
103
  }
103
- function instance_add(iname,uuid,url,name,state,author,cpu,mem,parent) {
104
+ function instance_add(iname,uuid,url,name,state,author,cpu,mem,time,parent) {
104
105
  let inode = document.importNode($("#stats_instance")[0].content,true);
105
106
  $('.sub',inode).attr('id',uuid)
106
107
  $('.sub',inode).attr('data-id',uuid)
@@ -120,6 +121,7 @@ function instance_add(iname,uuid,url,name,state,author,cpu,mem,parent) {
120
121
  }
121
122
  $('.cpu',inode).text($.sprintf('%05.2f',cpu))
122
123
  $('.mem',inode).text($.sprintf('%05.2f',mem))
124
+ $('.time',inode).text((new Date(time * 1000)).strftime("%H:%M:%S (%b-%d)"))
123
125
  if (parent == "") {
124
126
  $('#instances_' + iname).append(inode)
125
127
  } else {
@@ -154,7 +156,7 @@ function instances_init(ename) {
154
156
  success: (result) => {
155
157
  $('instance',result).each(async (i,ele)=>{
156
158
  const e = $(ele);
157
- setTimeout(()=>{instance_add(iname,e.attr('uuid'),e.attr('url'),e.attr('name'),e.attr('state'),e.attr('author'),e.attr('cpu'),e.attr('mem'),e.attr('parent'))},0)
159
+ setTimeout(()=>{instance_add(iname,e.attr('uuid'),e.attr('url'),e.attr('name'),e.attr('state'),e.attr('author'),e.attr('cpu'),e.attr('mem'),e.attr('time'),e.attr('parent'))},0)
158
160
  })
159
161
  }
160
162
  })
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-model-management
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
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: 2024-03-19 00:00:00.000000000 Z
11
+ date: 2024-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riddl
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
- rubygems_version: 3.4.10
114
+ rubygems_version: 3.5.9
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: "(Lifecycle) manage your process models in a directory or git repo."