git://git.onelab.eu
/
monitor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
run external checks on hosts to determine their boot state.
[monitor.git]
/
findbadpcu.py
diff --git
a/findbadpcu.py
b/findbadpcu.py
index
1af600c
..
f7a3576
100755
(executable)
--- a/
findbadpcu.py
+++ b/
findbadpcu.py
@@
-15,7
+15,7
@@
import threading
import monitor
from monitor.pcu import reboot
from monitor import config
import monitor
from monitor.pcu import reboot
from monitor import config
-from monitor.database
import FindbadPCURecordSync, FindbadPCURecord
+from monitor.database
.info.model import FindbadPCURecordSync, FindbadPCURecord, session
from monitor import util
from monitor.wrapper import plc, plccache
from nodequery import pcu_select
from monitor import util
from monitor.wrapper import plc, plccache
from nodequery import pcu_select
@@
-274,7
+274,7
@@
def recordPingAndSSH(request, result):
fbrec = FindbadPCURecord(
date_checked=datetime.fromtimestamp(values['date_checked']),
fbrec = FindbadPCURecord(
date_checked=datetime.fromtimestamp(values['date_checked']),
- r
ecor
d=fbsync.round,
+ r
oun
d=fbsync.round,
plc_pcuid=pcu_id,
plc_pcu_stats=values['plc_pcu_stats'],
dns_status=values['dnsmatch'],
plc_pcuid=pcu_id,
plc_pcu_stats=values['plc_pcu_stats'],
dns_status=values['dnsmatch'],
@@
-283,6
+283,11
@@
def recordPingAndSSH(request, result):
reboot_trial_status="%s" % values['reboot'],
)
fbnodesync.round = global_round
reboot_trial_status="%s" % values['reboot'],
)
fbnodesync.round = global_round
+
+ fbnodesync.flush()
+ fbsync.flush()
+ fbrec.flush()
+
count += 1
print "%d %s %s" % (count, nodename, values)
count += 1
print "%d %s %s" % (count, nodename, values)
@@
-308,6
+313,7
@@
def checkAndRecordState(l_pcus, cohash):
for pcuname in l_pcus:
pcu_id = int(pcuname)
fbnodesync = FindbadPCURecordSync.findby_or_create(plc_pcuid=pcu_id, if_new_set={'round' : 0})
for pcuname in l_pcus:
pcu_id = int(pcuname)
fbnodesync = FindbadPCURecordSync.findby_or_create(plc_pcuid=pcu_id, if_new_set={'round' : 0})
+ fbnodesync.flush()
node_round = fbnodesync.round
if node_round < global_round:
node_round = fbnodesync.round
if node_round < global_round:
@@
-340,6
+346,7
@@
def checkAndRecordState(l_pcus, cohash):
print FindbadPCURecordSync.query.count()
print FindbadPCURecord.query.count()
print FindbadPCURecordSync.query.count()
print FindbadPCURecord.query.count()
+ session.flush()
def main():
def main():
@@
-358,6
+365,8
@@
def main():
global_round += 1
fbsync.round = global_round
global_round += 1
fbsync.round = global_round
+ fbsync.flush()
+
if config.site is not None:
api = plc.getAuthAPI()
site = api.GetSites(config.site)
if config.site is not None:
api = plc.getAuthAPI()
site = api.GetSites(config.site)