[bonfiredemokit] View of /ea/submit_par_file.py
View of /ea/submit_par_file.py
Parent Directory
| Revision Log
Revision 1 -
( download)
( as text)
( annotate)
Mon Aug 27 11:46:35 2012 UTC
(11 years, 9 months ago)
by agomez
File size: 1882 byte(s)
'''
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()
|