1 : |
agomez |
10 |
#
|
2 : |
|
|
# BonFIRE Virtual Clusters on Federated Clouds Demonstration Kit
|
3 : |
|
|
#
|
4 : |
|
|
# Copyright (c) Fundacion Centro Tecnologico de Supercomputacion de Galicia 2012
|
5 : |
|
|
#
|
6 : |
|
|
# License GPL Version 3
|
7 : |
|
|
#
|
8 : |
|
|
# The research leading to these results has received funding from
|
9 : |
|
|
# the European Community's Seventh Framework Programme (FP7/2007-2013)
|
10 : |
|
|
# under agreement number 257386
|
11 : |
|
|
#
|
12 : |
|
|
# This software is provided with ABSOLUTELY NO WARRANTY
|
13 : |
|
|
#
|
14 : |
|
|
'''
|
15 : |
|
|
Created on 06/02/2012
|
16 : |
|
|
|
17 : |
|
|
@author: R. Valin
|
18 : |
|
|
'''
|
19 : |
|
|
import os
|
20 : |
|
|
|
21 : |
|
|
def s_time(time,level):
|
22 : |
|
|
|
23 : |
|
|
# locations='fr-inria'
|
24 : |
|
|
# storage='@BonFIRE Debian Squeeze 2G v3'
|
25 : |
|
|
# instance='lite'
|
26 : |
|
|
# time=dict()
|
27 : |
|
|
# time['broker']=1
|
28 : |
|
|
dire = os.getcwd()
|
29 : |
|
|
d = os.path.dirname(dire+'/output/')
|
30 : |
|
|
#print 'instance', instance
|
31 : |
|
|
print dire+'/output/'
|
32 : |
|
|
if not os.path.exists(d):
|
33 : |
|
|
os.makedirs(d)
|
34 : |
|
|
|
35 : |
|
|
file1 = open(d +'/time_cluster'+str(os.getpid())+'.csv', 'a')
|
36 : |
|
|
file1.write(level+','+str(time)+'\n')
|
37 : |
|
|
file1.close()
|
38 : |
|
|
|
39 : |
|
|
|
40 : |
|
|
def st_cluster(sub_time,stats,iter,location,uris):
|
41 : |
|
|
|
42 : |
|
|
#stats
|
43 : |
|
|
dire = os.getcwd()
|
44 : |
|
|
d = os.path.dirname(dire+'/output/'+location+'/')
|
45 : |
|
|
print dire+'/output/'+location+'/'
|
46 : |
|
|
if not os.path.exists(d):
|
47 : |
|
|
os.makedirs(d)
|
48 : |
|
|
|
49 : |
|
|
file1 = open(d + '/time_cluster'+str(os.getpid())+'.csv', 'a')
|
50 : |
|
|
#Here we print the head of the file of the first experiment
|
51 : |
|
|
if iter is 0:
|
52 : |
|
|
for i in stats:
|
53 : |
|
|
print i+'\t'+str(stats[str(i)])
|
54 : |
|
|
file1.write(i+'\t')
|
55 : |
|
|
file1.write(i+'\n')
|
56 : |
|
|
|
57 : |
|
|
#Here we print stats
|
58 : |
|
|
file1.write(str(sub_time)+'\t')
|
59 : |
|
|
for j in stats:
|
60 : |
|
|
file1.write(str(stats[str(j)])+'\t')
|
61 : |
|
|
for m in uris:
|
62 : |
|
|
print m
|
63 : |
|
|
file1.write(m+'\t')
|
64 : |
|
|
file1.write('\n')
|
65 : |
|
|
file1.close()
|
66 : |
|
|
|
67 : |
|
|
|
68 : |
|
|
|
69 : |
|
|
|
70 : |
|
|
|
71 : |
|
|
|
72 : |
|
|
|
73 : |
|
|
|
74 : |
|
|
#mm=simplejson.dumps(jdata.decode(kk)['resources'])
|
75 : |
|
|
#jdata= json.JSONDecoder()
|
76 : |
|
|
#for i in jdata.decode(mm):
|
77 : |
|
|
|
78 : |
|
|
|
79 : |
|
|
|
80 : |
|
|
#kk=(mm)
|
81 : |
|
|
#for j in mm:
|
82 : |
|
|
# print j.
|
83 : |
|
|
|
84 : |
|
|
|
85 : |
|
|
|
86 : |
|
|
# for j in [i['resources']]:
|
87 : |
|
|
# print j.split(',')
|