Revision 18 -
(download)
(as text)
(annotate)
Tue Oct 9 16:17:03 2012 UTC
(11 years, 10 months ago)
by agomez File size: 2035 byte(s)
Changed comments to English and test
#
# BonFIRE Virtual Clusters on Federated Clouds Demonstration Kit
#
# Copyright (c) Fundacion Centro Tecnologico de Supercomputacion de Galicia 2012
#
# License Apache Software
#
# The research leading to these results has received funding from
# the European Community's Seventh Framework Programme (FP7/2007-2013)
# under agreement number 257386
#
# This software is provided with ABSOLUTELY NO WARRANTY
#
'''
Created on 06/02/2012
@author: R. Valin
'''
import os
def s_time(time,level):
# locations='fr-inria'
# storage='@BonFIRE Debian Squeeze 2G v3'
# instance='lite'
# time=dict()
# time['broker']=1
dire = os.getcwd()
d = os.path.dirname(dire+'/output/')
#print 'instance', instance
print dire+'/output/'
if not os.path.exists(d):
os.makedirs(d)
file1 = open(d +'/time_cluster'+str(os.getpid())+'.csv', 'a')
file1.write(level+','+str(time)+'\n')
file1.close()
def st_cluster(sub_time,stats,iter,location,uris):
#stats
dire = os.getcwd()
d = os.path.dirname(dire+'/output/'+location+'/')
print dire+'/output/'+location+'/'
if not os.path.exists(d):
os.makedirs(d)
file1 = open(d + '/time_cluster'+str(os.getpid())+'.csv', 'a')
#Here we print the head of the file of the first experiment
if iter is 0:
for i in stats:
print i+'\t'+str(stats[str(i)])
file1.write(i+'\t')
file1.write(i+'\n')
#Here we print stats
file1.write(str(sub_time)+'\t')
for j in stats:
file1.write(str(stats[str(j)])+'\t')
for m in uris:
print m
file1.write(m+'\t')
file1.write('\n')
file1.close()
#mm=simplejson.dumps(jdata.decode(kk)['resources'])
#jdata= json.JSONDecoder()
#for i in jdata.decode(mm):
#kk=(mm)
#for j in mm:
# print j.
# for j in [i['resources']]:
# print j.split(',')