1 : |
agomez |
9 |
#
|
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 Frameqork Programme (FP7/2007-2013)
|
10 : |
|
|
# under agreement number 257386
|
11 : |
|
|
#
|
12 : |
|
|
# This software is provided with ABSOLUTELY NO WARRANTY
|
13 : |
|
|
#
|
14 : |
agomez |
1 |
'''
|
15 : |
|
|
Created on 20/03/2012
|
16 : |
|
|
|
17 : |
|
|
@author: R. Valin
|
18 : |
|
|
'''
|
19 : |
|
|
|
20 : |
|
|
#import matplotlib.pyplot as plt
|
21 : |
|
|
from multiprocessing import Process
|
22 : |
|
|
import json
|
23 : |
|
|
import os
|
24 : |
|
|
import sys
|
25 : |
|
|
import time
|
26 : |
|
|
#from exp.ea
|
27 : |
|
|
#import experiment_type as expt
|
28 : |
|
|
#from exp.ea
|
29 : |
|
|
import ea_bonfire as ea
|
30 : |
|
|
#import pp
|
31 : |
|
|
|
32 : |
|
|
def sub(e_cont):
|
33 : |
|
|
# print 'Ruta completa del Json que define experimento:'
|
34 : |
|
|
# #filej=raw_input()
|
35 : |
|
|
# filej="/home/cesga/bonfire/examples/cluster_fr.json"
|
36 : |
|
|
# print filej
|
37 : |
|
|
# if os.path.exists(filej):
|
38 : |
|
|
# jsonf=open(filej, 'r')
|
39 : |
|
|
# expt=json.loads(jsonf.read())
|
40 : |
|
|
# print expt
|
41 : |
|
|
# jsonf.close()
|
42 : |
|
|
# else:
|
43 : |
|
|
# print "File doesn't exist"
|
44 : |
|
|
|
45 : |
|
|
#duration = 120
|
46 : |
|
|
multi = 1
|
47 : |
|
|
|
48 : |
|
|
#for i in exp:
|
49 : |
|
|
# print i
|
50 : |
|
|
# m=str(i)
|
51 : |
|
|
j=0
|
52 : |
|
|
while j < multi:
|
53 : |
|
|
#save(locations)
|
54 : |
|
|
#location=info_location[m]
|
55 : |
|
|
#instance=info_instance[m]
|
56 : |
|
|
#store=info_storage[m]
|
57 : |
|
|
print 'Repetition before ea:', j, os.getpid()
|
58 : |
|
|
j=ea.ea_bf(e_cont,j)
|
59 : |
|
|
j=j+1
|
60 : |
|
|
#time.sleep(float(130))
|
61 : |
|
|
|
62 : |
|
|
if __name__ == '__main__':
|
63 : |
|
|
if len(sys.argv) < 3:
|
64 : |
|
|
sys.stderr.write('Two JSON files are needed')
|
65 : |
|
|
#sys.stderr.write('Usage: sys.argv[0] ')
|
66 : |
|
|
sys.exit(1)
|
67 : |
|
|
|
68 : |
|
|
filej=["/home/cesga/bonfire/examples/"+sys.argv[1], "/home/cesga/bonfire/examples/"+sys.argv[2]]
|
69 : |
|
|
for i in filej:
|
70 : |
|
|
print 'File:', i
|
71 : |
|
|
if not os.path.exists(i):
|
72 : |
|
|
sys.stderr.write('ERROR: file '+i+ 'does not exist!')
|
73 : |
|
|
sys.exit(1)
|
74 : |
|
|
expt=[]
|
75 : |
|
|
for i in filej:
|
76 : |
|
|
if os.path.exists(i):
|
77 : |
|
|
jsonf=open(i, 'r')
|
78 : |
|
|
expt.append(json.loads(jsonf.read()))
|
79 : |
|
|
print "Reading:", i
|
80 : |
|
|
print expt
|
81 : |
|
|
jsonf.close()
|
82 : |
|
|
else:
|
83 : |
|
|
print "File doesn't exist"
|
84 : |
|
|
|
85 : |
|
|
p1 = Process(target=sub, args=(expt[0],))
|
86 : |
|
|
p2 = Process(target=sub, args=(expt[1],))
|
87 : |
|
|
p1.start()
|
88 : |
|
|
time.sleep(2)
|
89 : |
|
|
p2.start()
|
90 : |
|
|
|
91 : |
|
|
|
92 : |
|
|
|
93 : |
|
|
|