cpee-model-management 1.1.0 → 1.1.1

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: 2407951bdeabf8fad81810a6c56b3ce1f8a28d17e583d6c32207424cdc11334a
4
- data.tar.gz: 9286ff4e9aa86127c7ce19ab0bd0da71b596b6ef035a99b48bea5bc4e85f1383
3
+ metadata.gz: 6fc783f8350eac7d65fbda35f275d4ea319878f2265e5d3e02eaf234eb0d4fd1
4
+ data.tar.gz: c16ceedc6068a9d0114ddc5456625f55a8a7072770d2e3af28479198a988282c
5
5
  SHA512:
6
- metadata.gz: 27df5a985c2441e656cfaefcb72377bbf720d04fe21c49fb9866c2b1b42d314af515f3dba981e8afb4fb616d2a9cdc897af8fd048d7547f57cfac594cac0ab1c
7
- data.tar.gz: 076150342b2320ac0103a245f2162e7c03450970c9d078cd1446b1f400996dea35f4350a0aacbeed696344d3d996337531e7a25daa42ab9e755b3c8687ef05cb
6
+ metadata.gz: 12fe97b8aa17301c3863fb983d0527efae7aacecfb313d5963a0a0d19aa30d73c00ff2b85275a1a0d50a48010d4185df3ff7fd9c4eae15c467ee230b8cc35154
7
+ data.tar.gz: 3a657a24d96ebde89e77378f35aed645e3548148c5c33ba28b064362030c5f9b35394e7704cf64b818d5d85b083ab0da84790575f1e8e601d25ae2e6ed0967d2
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-model-management"
3
- s.version = "1.1.0"
3
+ s.version = "1.1.1"
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."
@@ -678,6 +678,7 @@ module CPEE
678
678
  multi.del(File.join(prefix,'state'))
679
679
  multi.del(File.join(prefix,'cpu'))
680
680
  multi.del(File.join(prefix,'mem'))
681
+ multi.del(File.join(prefix,'time'))
681
682
  children.each do |child|
682
683
  if parent
683
684
  multi.set(File.join(engine,child,'parent'),parent)
@@ -706,6 +707,7 @@ module CPEE
706
707
  multi.set(File.join(prefix,'name'),attr['info'])
707
708
  multi.set(File.join(prefix,'cpu'),0)
708
709
  multi.set(File.join(prefix,'mem'),0)
710
+ multi.set(File.join(prefix,'time'),0)
709
711
  end
710
712
  elsif %w{stopping}.include?(content['state'])
711
713
  redis.set(File.join(prefix,'state'),content['state'])
@@ -716,13 +718,16 @@ module CPEE
716
718
  multi.set(File.join(prefix,'state'),content['state'])
717
719
  multi.set(File.join(prefix,'cpu'),0)
718
720
  multi.set(File.join(prefix,'mem'),0)
721
+ multi.set(File.join(prefix,'time'),0)
719
722
  end
720
723
  elsif %w{running}.include?(content['state'])
721
724
  oldstate = redis.get(File.join(prefix,'state'))
722
725
  redis.multi do |multi|
723
726
  multi.decr(File.join(engine,oldstate)) rescue nil
724
727
  multi.incr(File.join(engine,'running'))
728
+ multi.set(File.join(prefix,'name'),attr['info'])
725
729
  multi.set(File.join(prefix,'state'),content['state'])
730
+ multi.set(File.join(prefix,'time'),Time.now.to_i)
726
731
  end
727
732
  end
728
733
 
@@ -756,6 +761,7 @@ module CPEE
756
761
  end
757
762
  elsif topic == 'status' && event_name == 'resource_utilization'
758
763
  redis.multi do |multi|
764
+ multi.set(File.join(prefix,'name'),attr['info'])
759
765
  multi.set(File.join(prefix,'cpu'),content['utime'] + content['stime'])
760
766
  multi.set(File.join(prefix,'mem'),content['mib'])
761
767
  end
data/tools/cpee-moma CHANGED
@@ -8,6 +8,7 @@ require 'zip'
8
8
  require 'typhoeus'
9
9
  require 'json'
10
10
  require 'securerandom'
11
+ require 'redis'
11
12
 
12
13
  def wrap(s, width=78, indent=18)
13
14
  lines = []
@@ -62,10 +63,12 @@ ARGV.options { |opt|
62
63
  opt.on(wrap("[cpui DIR] scaffolds a sample html client. New versions might require manual merging if you changed something."))
63
64
  opt.on("")
64
65
  opt.on(wrap("[convert] converts all testsets in the current directory to design terminology."))
66
+ opt.on("")
67
+ opt.on(wrap("[consistent] makes the instances db consistent. can only be run in server dir."))
65
68
  opt.parse!
66
69
  }
67
70
  if (ARGV.length == 0) ||
68
- (ARGV.length == 1 && !(%w(convert).include?(ARGV[0]))) ||
71
+ (ARGV.length == 1 && !(%w(convert consistent).include?(ARGV[0]))) ||
69
72
  (ARGV.length == 2 && !(%w(cpui new).include?(ARGV[0]))) ||
70
73
  (ARGV.length > 2)
71
74
  puts ARGV.options
@@ -182,6 +185,62 @@ elsif command == 'convert'
182
185
  File.unlink(f + '.creator') rescue nil
183
186
  File.unlink(f + '.author') rescue nil
184
187
  end
188
+ elsif command == 'consistent'
189
+ redis = Redis.new(path: 'redis.sock', db: 0)
190
+ redis.keys('*/instances').each do |instances|
191
+ engine = File.dirname(instances)
192
+ s_ready = s_running = s_stopped = 0
193
+ redis.lrange(instances,0,-1).each do |i|
194
+ prefix = File.join(engine,i.to_s)
195
+ url = redis.get(File.join(prefix,'instance-url'))
196
+ res = Typhoeus.get(url, :followlocation => true)
197
+ if res.success?
198
+ oldstate = redis.get(File.join(prefix,'state'))
199
+ case oldstate
200
+ when 'ready'
201
+ s_ready += 1
202
+ when 'running'
203
+ s_running += 1
204
+ when 'stopped'
205
+ s_stopped += 1
206
+ end
207
+ else
208
+ parent = redis.get(File.join(prefix,'parent'))
209
+ oldstate = redis.get(File.join(prefix,'state'))
210
+ children = redis.lrange(File.join(prefix,'children'),0,-1)
211
+ redis.multi do |multi|
212
+ multi.decr(File.join(engine,oldstate)) rescue nil
213
+ multi.incr(File.join(engine,'total_abandoned'))
214
+ multi.lrem(File.join(engine,'instances'),0,i.to_s)
215
+ multi.del(File.join(prefix,'instance-url'))
216
+ multi.del(File.join(prefix,'author'))
217
+ multi.del(File.join(prefix,'path'))
218
+ multi.del(File.join(prefix,'name'))
219
+ multi.del(File.join(prefix,'state'))
220
+ multi.del(File.join(prefix,'cpu'))
221
+ multi.del(File.join(prefix,'mem'))
222
+ multi.del(File.join(prefix,'time'))
223
+ children.each do |child|
224
+ if parent
225
+ multi.set(File.join(engine,child,'parent'),parent)
226
+ else
227
+ multi.del(File.join(engine,child,'parent'))
228
+ end
229
+ end
230
+ multi.del(File.join(prefix,'children'))
231
+ multi.del(File.join(prefix,'parent'))
232
+ if parent
233
+ multi.lrem(File.join(engine,parent,'children'),0,i.to_s)
234
+ end
235
+ end
236
+ end
237
+ end
238
+ redis.multi do |multi|
239
+ multi.set(File.join(engine,'ready'),s_ready.to_i)
240
+ multi.set(File.join(engine,'running'),s_running.to_i)
241
+ multi.set(File.join(engine,'stopped'),s_stopped.to_i)
242
+ end
243
+ end
185
244
  elsif command == 'new'
186
245
  if !File.exists?(p1)
187
246
  FileUtils.mkdir(File.join(p1)) rescue nil
data/ui/index.html CHANGED
@@ -179,9 +179,8 @@
179
179
  <td class="num">(<span></span>)</td>
180
180
  <td class="state"><span class='value'></span> <span class='abandon'>[<a href='#' title='abandon'>a</a>]</span></td>
181
181
  <td class="author"><em>unknown</em></td>
182
- <td class="cpu"></td>
183
- <td>/</td>
184
182
  <td class="mem"></em></td>
183
+ <td class="active"></em></td>
185
184
  </tr>
186
185
  <tr class="sub">
187
186
  <td colspan="6"><table></table></td>
data/ui/instances.html CHANGED
@@ -56,6 +56,11 @@
56
56
  <link rel="stylesheet" href="css/stats.css" type="text/css"/>
57
57
  <link rel="stylesheet" href="css/stats_standalone.css" type="text/css"/>
58
58
  <script type="text/javascript" src="js/stats.js"></script>
59
+ <style>
60
+ [is="x-ui-"] {
61
+ overflow: scroll;
62
+ }
63
+ </style>
59
64
  </head>
60
65
  <body is="x-ui-">
61
66
  <p>
@@ -0,0 +1,89 @@
1
+ <!--
2
+ This file is part of CPEE-MODEL-MANAGEMENT.
3
+
4
+ CPEE-MODEL-MANAGEMENT is free software: you can redistribute it and/or
5
+ modify it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation, either version 3 of the License, or (at your
7
+ option) any later version.
8
+
9
+ CPEE-MODEL-MANAGEMENT is distributed in the hope that it will be useful, but
10
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
+ more details.
13
+
14
+ You should have received a copy of the GNU General Public License along with
15
+ CPEE-MODEL-MANAGEMENT (file LICENSE in the main directory). If not, see
16
+ <http://www.gnu.org/licenses/>.
17
+ -->
18
+
19
+ <!DOCTYPE html>
20
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
21
+ <head>
22
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
23
+ <title>Instances</title>
24
+
25
+ <!-- libs, do not modify. When local than load local libs. -->
26
+ <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
27
+ <script type="text/javascript" src="/js_libs/jquery.browser.js"></script>
28
+ <script type="text/javascript" src="/js_libs/jquery.svg.min.js"></script>
29
+ <script type="text/javascript" src="/js_libs/jquery.svgdom.min.js"></script>
30
+ <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
31
+ <script type="text/javascript" src="/js_libs/util.js"></script>
32
+ <script type="text/javascript" src="/js_libs/printf.js"></script>
33
+ <script type="text/javascript" src="/js_libs/strftime.min.js"></script>
34
+ <script type="text/javascript" src="/js_libs/parsequery.js"></script>
35
+ <script type="text/javascript" src="/js_libs/underscore.min.js"></script>
36
+ <script type="text/javascript" src="/js_libs/jquery.caret.min.js"></script>
37
+ <script type="text/javascript" src="/js_libs/jquery.cookie.js"></script>
38
+ <script type="text/javascript" src="/js_libs/plotly.min.js"></script>
39
+
40
+ <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
41
+
42
+ <script type="text/javascript" src="/js_libs/relaxngui.js"></script>
43
+
44
+ <script type="text/javascript" src="/js_libs/uidash.js"></script>
45
+ <script type="text/javascript" src="/js_libs/custommenu.js"></script>
46
+
47
+ <link rel="stylesheet" href="/js_libs/custommenu.css" type="text/css"/>
48
+ <link rel="stylesheet" href="/js_libs/uidash.css" type="text/css"/>
49
+
50
+ <link rel="stylesheet" href="/global_ui/ui.css" type="text/css"/>
51
+
52
+ <link rel="stylesheet" href="/js_libs/relaxngui.css" type="text/css"/>
53
+
54
+ <!-- custom stuff, play arround -->
55
+ <link rel="stylesheet" href="css/design.css" type="text/css"/>
56
+ <link rel="stylesheet" href="css/stats.css" type="text/css"/>
57
+ <link rel="stylesheet" href="css/stats_standalone.css" type="text/css"/>
58
+ <script type="text/javascript" src="js/stats.js"></script>
59
+ <style>
60
+ [is="x-ui-"] {
61
+ overflow: scroll;
62
+ }
63
+ </style>
64
+ </head>
65
+ <body is="x-ui-">
66
+ <p>
67
+ Show ready, running and stopped instances.
68
+ </p>
69
+ <template id="stats_instances">
70
+ <h1 class="stats_title">Engine: </h1>
71
+ <table class='instances'></table>
72
+ </template>
73
+ <template id="stats_instance">
74
+ <tr class="text">
75
+ <td class="name"><a href='' target='_blank'><em>no name</em></a></td>
76
+ <td class="num">(<span></span>)</td>
77
+ <td class="state"><span class='value'></span></td>
78
+ <td class="author"><em>unknown</em></td>
79
+ <td class="cpu"></td>
80
+ <td>/</td>
81
+ <td class="mem"></em></td>
82
+ </tr>
83
+ <tr class="sub">
84
+ <td colspan="6"><table></table></td>
85
+ </tr>
86
+ </template>
87
+ <div id='instances'></div>
88
+ </body>
89
+ </html>
data/ui/js/stats.js CHANGED
@@ -87,6 +87,7 @@ function instance_change(d) {
87
87
  function instance_upd(uuid,name,state,author,cpu,mem,parent) {
88
88
  if (name != "") {
89
89
  $('[data-id=' + uuid + '] > .name a').text(name)
90
+ $('[data-id=' + uuid + '] > .name a').attr('title',name)
90
91
  }
91
92
  $('[data-id=' + uuid + '] > .state span.value').text(state)
92
93
  $('[data-id=' + uuid + '] > .state').attr('data-state',state)
@@ -110,6 +111,7 @@ function instance_add(iname,uuid,url,name,state,author,cpu,mem,parent) {
110
111
  $('.num span',inode).text(url.split(/[\\/]/).pop())
111
112
  if (name != "") {
112
113
  $('.name a',inode).text(name)
114
+ $('.name a',inode).attr('title',name)
113
115
  }
114
116
  $('.state span.value',inode).text(state)
115
117
  $('.state',inode).attr('data-state',state)
@@ -137,6 +139,8 @@ function instances_striping(iname) {
137
139
  })
138
140
  }
139
141
 
142
+ function timer(ms) { return new Promise(res => setTimeout(res, ms)); }
143
+
140
144
  function instances_init(ename) {
141
145
  const iname = ename.replace(/[^a-z0-9A-Z]/g,'-').replace(/-$/,'')
142
146
  let inode = document.importNode($("#stats_instances")[0].content,true);
@@ -148,9 +152,9 @@ function instances_init(ename) {
148
152
  url: 'server/dash/instances',
149
153
  data: { engine: ename },
150
154
  success: (result) => {
151
- $('instance',result).each((i,ele)=>{
155
+ $('instance',result).each(async (i,ele)=>{
152
156
  const e = $(ele);
153
- 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'))
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)
154
158
  })
155
159
  }
156
160
  })
data/ui/resources.html CHANGED
@@ -55,6 +55,11 @@
55
55
  <link rel="stylesheet" href="css/stats.css" type="text/css"/>
56
56
  <link rel="stylesheet" href="css/stats_standalone.css" type="text/css"/>
57
57
  <script type="text/javascript" src="js/stats.js"></script>
58
+ <style>
59
+ [is="x-ui-"] {
60
+ overflow: scroll;
61
+ }
62
+ </style>
58
63
  </head>
59
64
  <body is="x-ui-">
60
65
  <p>
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.1.0
4
+ version: 1.1.1
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: 2022-05-09 00:00:00.000000000 Z
11
+ date: 2022-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riddl
@@ -86,6 +86,7 @@ files:
86
86
  - ui/css/stats_standalone.css
87
87
  - ui/index.html
88
88
  - ui/instances.html
89
+ - ui/instances_view.html
89
90
  - ui/js/design.js
90
91
  - ui/js/stats.js
91
92
  - ui/resources.html