-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd039a2
commit d70d98d
Showing
2 changed files
with
43 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,45 @@ | ||
#!/usr/bin/python26 | ||
import sys | ||
import datetime | ||
import json | ||
from pprint import pprint | ||
FILE="/crabprod/CSstoragePath/Monitor-json/monitor-multicore-production-2014-10-15-Z19:28.json" | ||
with open(FILE) as json_data: | ||
|
||
|
||
print " Pool Name, Date, Time,", | ||
firstline=0 | ||
|
||
import glob | ||
FILES=glob.glob("/crabprod/CSstoragePath/Monitor-json/monitor-multicore-*.json") | ||
for FILE in FILES : | ||
|
||
with open(FILE) as json_data: | ||
d = json.load(json_data) | ||
json_data.close() | ||
pprint(d) | ||
#pprint(d) | ||
|
||
TABLES=d['Multi-core pilot monitoring'] | ||
if firstline==0 : | ||
firstline=1 | ||
for TABLE in sorted(TABLES) : | ||
if 'Cpus' in TABLE : | ||
print TABLE+" Total,"+TABLE+" Wasted,", | ||
|
||
POOL=FILE.split('-') | ||
print (POOL[3]+",").ljust(11), | ||
|
||
now=int(d['Multi-core pilot monitoring']['Time']) | ||
readable_date=datetime.datetime.utcfromtimestamp(now).strftime('%Y-%m-%d, %H:%M:%S,') | ||
|
||
print readable_date, | ||
|
||
for TABLE in sorted(TABLES) : | ||
if 'Cpus' in TABLE : | ||
busy=0 | ||
total=0 | ||
for data in d['Multi-core pilot monitoring'][TABLE]['data']: | ||
if data[1]=="Busy" : busy+=data[2] | ||
total+=data[2] | ||
wasted=total-busy | ||
print str(total).rjust(6)+", "+str(wasted).rjust(6)+",", | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters