[bonfiredemokit] Annotation of /ea/save_time.py
Annotation of /ea/save_time.py
Parent Directory
| Revision Log
Revision 1 -
(view)
(download)
(as text)
1 : |
agomez |
1 |
'''
|
2 : |
|
|
Created on 06/02/2012
|
3 : |
|
|
|
4 : |
|
|
@author: R. Valin
|
5 : |
|
|
'''
|
6 : |
|
|
import os
|
7 : |
|
|
|
8 : |
|
|
def s_time(time,level):
|
9 : |
|
|
|
10 : |
|
|
# locations='fr-inria'
|
11 : |
|
|
# storage='@BonFIRE Debian Squeeze 2G v3'
|
12 : |
|
|
# instance='lite'
|
13 : |
|
|
# time=dict()
|
14 : |
|
|
# time['broker']=1
|
15 : |
|
|
dire = os.getcwd()
|
16 : |
|
|
d = os.path.dirname(dire+'/output/')
|
17 : |
|
|
#print 'instance', instance
|
18 : |
|
|
print dire+'/output/'
|
19 : |
|
|
if not os.path.exists(d):
|
20 : |
|
|
os.makedirs(d)
|
21 : |
|
|
|
22 : |
|
|
file1 = open(d +'/time_cluster'+str(os.getpid())+'.csv', 'a')
|
23 : |
|
|
file1.write(level+','+str(time)+'\n')
|
24 : |
|
|
file1.close()
|
25 : |
|
|
|
26 : |
|
|
|
27 : |
|
|
def st_cluster(sub_time,stats,iter,location,uris):
|
28 : |
|
|
|
29 : |
|
|
#stats
|
30 : |
|
|
dire = os.getcwd()
|
31 : |
|
|
d = os.path.dirname(dire+'/output/'+location+'/')
|
32 : |
|
|
print dire+'/output/'+location+'/'
|
33 : |
|
|
if not os.path.exists(d):
|
34 : |
|
|
os.makedirs(d)
|
35 : |
|
|
|
36 : |
|
|
file1 = open(d + '/time_cluster'+str(os.getpid())+'.csv', 'a')
|
37 : |
|
|
#Here we print the head of the file of the first experiment
|
38 : |
|
|
if iter is 0:
|
39 : |
|
|
for i in stats:
|
40 : |
|
|
print i+'\t'+str(stats[str(i)])
|
41 : |
|
|
file1.write(i+'\t')
|
42 : |
|
|
file1.write(i+'\n')
|
43 : |
|
|
|
44 : |
|
|
#Here we print stats
|
45 : |
|
|
file1.write(str(sub_time)+'\t')
|
46 : |
|
|
for j in stats:
|
47 : |
|
|
file1.write(str(stats[str(j)])+'\t')
|
48 : |
|
|
for m in uris:
|
49 : |
|
|
print m
|
50 : |
|
|
file1.write(m+'\t')
|
51 : |
|
|
file1.write('\n')
|
52 : |
|
|
file1.close()
|
53 : |
|
|
|
54 : |
|
|
|
55 : |
|
|
|
56 : |
|
|
|
57 : |
|
|
|
58 : |
|
|
|
59 : |
|
|
|
60 : |
|
|
|
61 : |
|
|
#mm=simplejson.dumps(jdata.decode(kk)['resources'])
|
62 : |
|
|
#jdata= json.JSONDecoder()
|
63 : |
|
|
#for i in jdata.decode(mm):
|
64 : |
|
|
|
65 : |
|
|
|
66 : |
|
|
|
67 : |
|
|
#kk=(mm)
|
68 : |
|
|
#for j in mm:
|
69 : |
|
|
# print j.
|
70 : |
|
|
|
71 : |
|
|
|
72 : |
|
|
|
73 : |
|
|
# for j in [i['resources']]:
|
74 : |
|
|
# print j.split(',')
|
|