mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-27 08:17:17 +00:00
ModuleInfo now support logs.
This commit is contained in:
parent
ff6dcaf456
commit
3e88d0911d
1 changed files with 15 additions and 0 deletions
|
@ -8,8 +8,15 @@ import calendar
|
||||||
import redis
|
import redis
|
||||||
import os
|
import os
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
import json
|
||||||
from prettytable import PrettyTable
|
from prettytable import PrettyTable
|
||||||
|
|
||||||
|
# CONFIG VARIABLES
|
||||||
|
threshold_stucked_module = 60*60*1 #1 hour
|
||||||
|
log_filename = "../logs/moduleInfo.log"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
configfile = os.path.join(os.environ['AIL_BIN'], 'packages/config.cfg')
|
configfile = os.path.join(os.environ['AIL_BIN'], 'packages/config.cfg')
|
||||||
|
@ -41,12 +48,20 @@ if __name__ == "__main__":
|
||||||
num += 1
|
num += 1
|
||||||
startTime_readable = datetime.datetime.fromtimestamp(int(timestamp))
|
startTime_readable = datetime.datetime.fromtimestamp(int(timestamp))
|
||||||
processed_time_readable = str((datetime.datetime.now() - startTime_readable)).split('.')[0]
|
processed_time_readable = str((datetime.datetime.now() - startTime_readable)).split('.')[0]
|
||||||
|
|
||||||
|
if int((datetime.datetime.now() - startTime_readable).total_seconds()) > threshold_stucked_module:
|
||||||
|
log = open(log_filename, 'a')
|
||||||
|
log.write(json.dumps([queue, card, str(startTime_readable), str(processed_time_readable), path]) + "\n")
|
||||||
|
|
||||||
if int(card) > 0:
|
if int(card) > 0:
|
||||||
table1.add_row([num, queue, card, startTime_readable, processed_time_readable, path])
|
table1.add_row([num, queue, card, startTime_readable, processed_time_readable, path])
|
||||||
else:
|
else:
|
||||||
table2.add_row([num, queue, card, startTime_readable, processed_time_readable, path])
|
table2.add_row([num, queue, card, startTime_readable, processed_time_readable, path])
|
||||||
|
|
||||||
os.system('clear')
|
os.system('clear')
|
||||||
|
print 'Working queues:\n'
|
||||||
print table1
|
print table1
|
||||||
|
print '\n'
|
||||||
|
print 'Ideling queues:\n'
|
||||||
print table2
|
print table2
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
Loading…
Reference in a new issue