fix around sandbox analysis, increase delay UI work for predictions @TODO: predictions

master
Steve L. Nyemba 8 years ago
parent 045482975a
commit 1fa603ae3c

@ -36,6 +36,7 @@ monitor.processes.init = function(x){
// This is designed not to let the user wander or wonder what is going on // This is designed not to let the user wander or wonder what is going on
// //
jx.dom.get.children('menu')[0].click() jx.dom.get.children('menu')[0].click()
setTimeout(monitor.sandbox.init,3000)
} }
monitor.processes.render = function(label,data) { monitor.processes.render = function(label,data) {
@ -263,6 +264,7 @@ monitor.processes.summary.init = function(logs){
monitor.sandbox = {} monitor.sandbox = {}
monitor.sandbox.init = function () { monitor.sandbox.init = function () {
jx.dom.hide('inspect_sandbox')
var httpclient = HttpClient.instance() var httpclient = HttpClient.instance()
httpclient.get('/sandbox', function (x) { httpclient.get('/sandbox', function (x) {
var r = JSON.parse(x.responseText) var r = JSON.parse(x.responseText)
@ -300,5 +302,6 @@ monitor.sandbox.render = function (logs) {
] ]
var grid = $('#sandbox_status').jsGrid(options) var grid = $('#sandbox_status').jsGrid(options)
jx.dom.show('inspect_sandbox')
} }

@ -22,21 +22,18 @@
}) })
</script> </script>
<body> <body>
<div class="caption border-bottom">
<div class="left">Monitoring</div>
<div class="right">Trends</div>
</div>
<div class="left small" style="width:15%"> <div class="left small" style="width:15%">
<div><input id="find_scope" type="text" placeholder="Find Context"></div>
<div id="menu" class="menu"></div> <div id="menu" class="menu"></div>
</div> </div>
<div class="left info "> <div class="left info ">
<div class="" style="text-transform:capitalize; height:28px">Monitoring <span id="latest_processes_label" class="bold"></span> <div class="" style="text-transform:capitalize; ">
<div class="right menu"> <div class="left">Monitoring
<div class="right menu-item"><i class="fa fa-refresh"></i></div> <span id="latest_processes_label" class="bold"></span>
</div> </div>
<div class="right button border" style="margin-right:15px">Predict</div>
</div> </div>
<div class = "border-right" style="padding:2px; margin:4px; height:170px"> <div class = "border-right" style="padding:2px; margin:4px; height:170px">
@ -74,8 +71,8 @@
<div class="border-top" style="padding:4px;"> <div class="border-top" style="padding:4px;">
<div style="height:48px"> <div style="height:48px">
<b>Python Virtual Environment Analysis</b> <b>Python Virtual Environment Analysis</b>
<div class="right button border" onclick="monitor.sandbox.init()">Inspect</div> <div id="inspect_sandbox" class="right button border" style="display:none" onclick="monitor.sandbox.init()">Inspect</div>
<div class="small">Last fetch <span id="sandbox_date"></span></div> <div class="small">Last Lookup <span id="sandbox_date"></span></div>
</div> </div>
<div class=""> <div class="">
<div id="sandbox_status" class="grid"> <div id="sandbox_status" class="grid">

@ -65,7 +65,8 @@ class Env(Analysis):
r = [ self.evaluate(id) for id in self.values] ; r = [ self.evaluate(id) for id in self.values] ;
N = len(r) N = len(r)
n = sum(r) n = sum(r)
value = n/N value = 100 * round(n/N,2)
print '*** ',value
missing = [self.values[i] for i in range(0,N) if r[i] == 0] missing = [self.values[i] for i in range(0,N) if r[i] == 0]
return dict(self.getNow(),**{"value":value,"missing":missing}) return dict(self.getNow(),**{"value":value,"missing":missing})
@ -100,7 +101,7 @@ class Sandbox(Analysis):
sandbox_modules = self.get_sandbox_requirements() sandbox_modules = self.get_sandbox_requirements()
N = len(required_modules) N = len(required_modules)
n = len(Set(required_modules) - Set(sandbox_modules)) n = len(Set(required_modules) - Set(sandbox_modules))
value = 1 - (n/N) value = round(1 - (n/N),2)*100
missing = list(Set(required_modules) - Set(sandbox_modules)) missing = list(Set(required_modules) - Set(sandbox_modules))
return dict(self.getNow(),**{"value":value,"missing":missing}) return dict(self.getNow(),**{"value":value,"missing":missing})
@ -231,7 +232,7 @@ class Monitor (Thread):
self.prune() self.prune()
HALF_HOUR = 60*5 HALF_HOUR = 60*25
time.sleep(HALF_HOUR) time.sleep(HALF_HOUR)
print "Stopped ..." print "Stopped ..."
def prune(self) : def prune(self) :

Loading…
Cancel
Save