--- ea/submit_par_file.py 2012/08/30 12:48:07 9 +++ ea/submit_par_file.py 2012/08/31 10:40:38 10 @@ -1,93 +1,93 @@ -# -# BonFIRE Virtual Clusters on Federated Clouds Demonstration Kit -# -# Copyright (c) Fundacion Centro Tecnologico de Supercomputacion de Galicia 2012 -# -# License GPL Version 3 -# -# The research leading to these results has received funding from -# the European Community's Seventh Frameqork Programme (FP7/2007-2013) -# under agreement number 257386 -# -# This software is provided with ABSOLUTELY NO WARRANTY -# -''' -Created on 20/03/2012 - -@author: R. Valin -''' - -#import matplotlib.pyplot as plt -from multiprocessing import Process -import json -import os -import sys -import time -#from exp.ea -#import experiment_type as expt -#from exp.ea -import ea_bonfire as ea -#import pp - -def sub(e_cont): -# print 'Ruta completa del Json que define experimento:' -# #filej=raw_input() -# filej="/home/cesga/bonfire/examples/cluster_fr.json" -# print filej -# if os.path.exists(filej): -# jsonf=open(filej, 'r') -# expt=json.loads(jsonf.read()) -# print expt -# jsonf.close() -# else: -# print "File doesn't exist" - - #duration = 120 - multi = 1 - -#for i in exp: -# print i -# m=str(i) - j=0 - while j < multi: - #save(locations) - #location=info_location[m] - #instance=info_instance[m] - #store=info_storage[m] - print 'Repetition before ea:', j, os.getpid() - j=ea.ea_bf(e_cont,j) - j=j+1 - #time.sleep(float(130)) - -if __name__ == '__main__': - if len(sys.argv) < 3: - sys.stderr.write('Two JSON files are needed') - #sys.stderr.write('Usage: sys.argv[0] ') - sys.exit(1) - - filej=["/home/cesga/bonfire/examples/"+sys.argv[1], "/home/cesga/bonfire/examples/"+sys.argv[2]] - for i in filej: - print 'File:', i - if not os.path.exists(i): - sys.stderr.write('ERROR: file '+i+ 'does not exist!') - sys.exit(1) - expt=[] - for i in filej: - if os.path.exists(i): - jsonf=open(i, 'r') - expt.append(json.loads(jsonf.read())) - print "Reading:", i - print expt - jsonf.close() - else: - print "File doesn't exist" - - p1 = Process(target=sub, args=(expt[0],)) - p2 = Process(target=sub, args=(expt[1],)) - p1.start() - time.sleep(2) - p2.start() - - - - +# +# BonFIRE Virtual Clusters on Federated Clouds Demonstration Kit +# +# Copyright (c) Fundacion Centro Tecnologico de Supercomputacion de Galicia 2012 +# +# License GPL Version 3 +# +# 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 20/03/2012 + +@author: R. Valin +''' + +#import matplotlib.pyplot as plt +from multiprocessing import Process +import json +import os +import sys +import time +#from exp.ea +#import experiment_type as expt +#from exp.ea +import ea_bonfire as ea +#import pp + +def sub(e_cont): +# print 'Ruta completa del Json que define experimento:' +# #filej=raw_input() +# filej="/home/cesga/bonfire/examples/cluster_fr.json" +# print filej +# if os.path.exists(filej): +# jsonf=open(filej, 'r') +# expt=json.loads(jsonf.read()) +# print expt +# jsonf.close() +# else: +# print "File doesn't exist" + + #duration = 120 + multi = 1 + +#for i in exp: +# print i +# m=str(i) + j=0 + while j < multi: + #save(locations) + #location=info_location[m] + #instance=info_instance[m] + #store=info_storage[m] + print 'Repetition before ea:', j, os.getpid() + j=ea.ea_bf(e_cont,j) + j=j+1 + #time.sleep(float(130)) + +if __name__ == '__main__': + if len(sys.argv) < 3: + sys.stderr.write('Two JSON files are needed') + #sys.stderr.write('Usage: sys.argv[0] ') + sys.exit(1) + + filej=["../examples/"+sys.argv[1], "../examples/"+sys.argv[2]] + for i in filej: + print 'File:', i + if not os.path.exists(i): + sys.stderr.write('ERROR: file '+i+ 'does not exist!') + sys.exit(1) + expt=[] + for i in filej: + if os.path.exists(i): + jsonf=open(i, 'r') + expt.append(json.loads(jsonf.read())) + print "Reading:", i + print expt + jsonf.close() + else: + print "File doesn't exist" + + p1 = Process(target=sub, args=(expt[0],)) + p2 = Process(target=sub, args=(expt[1],)) + p1.start() + time.sleep(2) + p2.start() + + + +