cpee-model-management 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cpee-model-management.gemspec +1 -1
- data/lib/cpee-model-management/implementation.rb +7 -1
- data/tools/cpee-moma +60 -1
- data/ui/favicon.ico +0 -0
- data/ui/index.html +4 -4
- data/ui/instances.html +7 -1
- data/ui/instances_view.html +90 -0
- data/ui/js/stats.js +6 -2
- data/ui/resources.html +7 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 684d2a9f94f7110a2f207e688a2ef7a8da53bba2848effdf4086e4c5a4dd4f80
|
4
|
+
data.tar.gz: 329fbd356f4dd5e1fb8e096cbfd5663cc9b7649047392fa02adf92b4488b74da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08595da884d0f3dd930163bee205f473c8bb4542b3e6f7751b29c8aa6ef62544ea5c2336d301b965f90dbb02da90d7a7956a8ae4e4fd0a15692bbd0b382b9445'
|
7
|
+
data.tar.gz: f4965adaaa306efd9800b2fffe972f139bd52259056e54d4b068bd20577351ffee6ed31b743c6a32732466e6b7cb7f48dbf2c7a637e00d2a473a93ebf145460f
|
@@ -493,7 +493,7 @@ module CPEE
|
|
493
493
|
nil
|
494
494
|
end
|
495
495
|
end
|
496
|
-
rescue
|
496
|
+
rescue => e
|
497
497
|
retry
|
498
498
|
end
|
499
499
|
|
@@ -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/favicon.ico
ADDED
Binary file
|
data/ui/index.html
CHANGED
@@ -20,7 +20,8 @@
|
|
20
20
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
21
21
|
<head>
|
22
22
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
23
|
-
<title>
|
23
|
+
<title>Process Hub</title>
|
24
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
24
25
|
|
25
26
|
<!-- libs, do not modify. When local than load local libs. -->
|
26
27
|
<script type="text/javascript" src="/js_libs/jquery.min.js"></script>
|
@@ -72,7 +73,7 @@
|
|
72
73
|
</ui-tabbar>
|
73
74
|
<ui-content class="noselect">
|
74
75
|
<ui-area data-belongs-to-tab="models">
|
75
|
-
<p>Your Models are saved/versioned in <a target='_blank' href='https://git-scm.com/'>GIT</a>. So fret not. Just send an email to <a href="mail:helpdesk@
|
76
|
+
<p>Your Models are saved/versioned in <a target='_blank' href='https://git-scm.com/'>GIT</a>. So fret not. Just send an email to <a href="mail:helpdesk@cpee.org">helpdesk@cpee.org</a> if you are lost. And as always: <a target='_blank' href='https://www.youtube.com/watch?v=kkxj5xVLyj0&feature=youtu.be&t=56'>get dressed for success</a>.</p>
|
76
77
|
<table id="models" class='ui-table'>
|
77
78
|
<thead>
|
78
79
|
<th></th>
|
@@ -179,9 +180,8 @@
|
|
179
180
|
<td class="num">(<span></span>)</td>
|
180
181
|
<td class="state"><span class='value'></span> <span class='abandon'>[<a href='#' title='abandon'>a</a>]</span></td>
|
181
182
|
<td class="author"><em>unknown</em></td>
|
182
|
-
<td class="cpu"></td>
|
183
|
-
<td>/</td>
|
184
183
|
<td class="mem"></em></td>
|
184
|
+
<td class="active"></em></td>
|
185
185
|
</tr>
|
186
186
|
<tr class="sub">
|
187
187
|
<td colspan="6"><table></table></td>
|
data/ui/instances.html
CHANGED
@@ -20,7 +20,8 @@
|
|
20
20
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
21
21
|
<head>
|
22
22
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
23
|
-
<title>Instances</title>
|
23
|
+
<title>Process Hub Instances</title>
|
24
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
24
25
|
|
25
26
|
<!-- libs, do not modify. When local than load local libs. -->
|
26
27
|
<script type="text/javascript" src="/js_libs/jquery.min.js"></script>
|
@@ -56,6 +57,11 @@
|
|
56
57
|
<link rel="stylesheet" href="css/stats.css" type="text/css"/>
|
57
58
|
<link rel="stylesheet" href="css/stats_standalone.css" type="text/css"/>
|
58
59
|
<script type="text/javascript" src="js/stats.js"></script>
|
60
|
+
<style>
|
61
|
+
[is="x-ui-"] {
|
62
|
+
overflow: scroll;
|
63
|
+
}
|
64
|
+
</style>
|
59
65
|
</head>
|
60
66
|
<body is="x-ui-">
|
61
67
|
<p>
|
@@ -0,0 +1,90 @@
|
|
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>Process Hub Instances</title>
|
24
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
25
|
+
|
26
|
+
<!-- libs, do not modify. When local than load local libs. -->
|
27
|
+
<script type="text/javascript" src="/js_libs/jquery.min.js"></script>
|
28
|
+
<script type="text/javascript" src="/js_libs/jquery.browser.js"></script>
|
29
|
+
<script type="text/javascript" src="/js_libs/jquery.svg.min.js"></script>
|
30
|
+
<script type="text/javascript" src="/js_libs/jquery.svgdom.min.js"></script>
|
31
|
+
<script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
|
32
|
+
<script type="text/javascript" src="/js_libs/util.js"></script>
|
33
|
+
<script type="text/javascript" src="/js_libs/printf.js"></script>
|
34
|
+
<script type="text/javascript" src="/js_libs/strftime.min.js"></script>
|
35
|
+
<script type="text/javascript" src="/js_libs/parsequery.js"></script>
|
36
|
+
<script type="text/javascript" src="/js_libs/underscore.min.js"></script>
|
37
|
+
<script type="text/javascript" src="/js_libs/jquery.caret.min.js"></script>
|
38
|
+
<script type="text/javascript" src="/js_libs/jquery.cookie.js"></script>
|
39
|
+
<script type="text/javascript" src="/js_libs/plotly.min.js"></script>
|
40
|
+
|
41
|
+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
|
42
|
+
|
43
|
+
<script type="text/javascript" src="/js_libs/relaxngui.js"></script>
|
44
|
+
|
45
|
+
<script type="text/javascript" src="/js_libs/uidash.js"></script>
|
46
|
+
<script type="text/javascript" src="/js_libs/custommenu.js"></script>
|
47
|
+
|
48
|
+
<link rel="stylesheet" href="/js_libs/custommenu.css" type="text/css"/>
|
49
|
+
<link rel="stylesheet" href="/js_libs/uidash.css" type="text/css"/>
|
50
|
+
|
51
|
+
<link rel="stylesheet" href="/global_ui/ui.css" type="text/css"/>
|
52
|
+
|
53
|
+
<link rel="stylesheet" href="/js_libs/relaxngui.css" type="text/css"/>
|
54
|
+
|
55
|
+
<!-- custom stuff, play arround -->
|
56
|
+
<link rel="stylesheet" href="css/design.css" type="text/css"/>
|
57
|
+
<link rel="stylesheet" href="css/stats.css" type="text/css"/>
|
58
|
+
<link rel="stylesheet" href="css/stats_standalone.css" type="text/css"/>
|
59
|
+
<script type="text/javascript" src="js/stats.js"></script>
|
60
|
+
<style>
|
61
|
+
[is="x-ui-"] {
|
62
|
+
overflow: scroll;
|
63
|
+
}
|
64
|
+
</style>
|
65
|
+
</head>
|
66
|
+
<body is="x-ui-">
|
67
|
+
<p>
|
68
|
+
Show ready, running and stopped instances.
|
69
|
+
</p>
|
70
|
+
<template id="stats_instances">
|
71
|
+
<h1 class="stats_title">Engine: </h1>
|
72
|
+
<table class='instances'></table>
|
73
|
+
</template>
|
74
|
+
<template id="stats_instance">
|
75
|
+
<tr class="text">
|
76
|
+
<td class="name"><a href='' target='_blank'><em>no name</em></a></td>
|
77
|
+
<td class="num">(<span></span>)</td>
|
78
|
+
<td class="state"><span class='value'></span></td>
|
79
|
+
<td class="author"><em>unknown</em></td>
|
80
|
+
<td class="cpu"></td>
|
81
|
+
<td>/</td>
|
82
|
+
<td class="mem"></em></td>
|
83
|
+
</tr>
|
84
|
+
<tr class="sub">
|
85
|
+
<td colspan="6"><table></table></td>
|
86
|
+
</tr>
|
87
|
+
</template>
|
88
|
+
<div id='instances'></div>
|
89
|
+
</body>
|
90
|
+
</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
@@ -20,7 +20,8 @@
|
|
20
20
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
21
21
|
<head>
|
22
22
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
23
|
-
<title>Resources</title>
|
23
|
+
<title>Process Hub Resources</title>
|
24
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
24
25
|
|
25
26
|
<!-- libs, do not modify. When local than load local libs. -->
|
26
27
|
<script type="text/javascript" src="/js_libs/jquery.min.js"></script>
|
@@ -55,6 +56,11 @@
|
|
55
56
|
<link rel="stylesheet" href="css/stats.css" type="text/css"/>
|
56
57
|
<link rel="stylesheet" href="css/stats_standalone.css" type="text/css"/>
|
57
58
|
<script type="text/javascript" src="js/stats.js"></script>
|
59
|
+
<style>
|
60
|
+
[is="x-ui-"] {
|
61
|
+
overflow: scroll;
|
62
|
+
}
|
63
|
+
</style>
|
58
64
|
</head>
|
59
65
|
<body is="x-ui-">
|
60
66
|
<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.
|
4
|
+
version: 1.1.2
|
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-
|
11
|
+
date: 2022-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: riddl
|
@@ -84,8 +84,10 @@ files:
|
|
84
84
|
- ui/css/design.css
|
85
85
|
- ui/css/stats.css
|
86
86
|
- ui/css/stats_standalone.css
|
87
|
+
- ui/favicon.ico
|
87
88
|
- ui/index.html
|
88
89
|
- ui/instances.html
|
90
|
+
- ui/instances_view.html
|
89
91
|
- ui/js/design.js
|
90
92
|
- ui/js/stats.js
|
91
93
|
- ui/resources.html
|