forked from fgolemo/EC14-LargeSoftSim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_experiment.py
30 lines (22 loc) · 883 Bytes
/
start_experiment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import ConfigParser
import os, sys
import subprocess
config = ConfigParser.RawConfigParser()
config.read(sys.argv[1])
if len(sys.argv) > 2:
run = sys.argv[2]
else:
run = 0
if len(sys.argv) > 3:
delay = "-W depend=afterok:"+sys.argv[3]
else:
delay = ""
path_prefix = config.get("Experiment", "path_prefix")
name = config.get("Experiment", "name")
total = path_prefix+name
walltime = config.get("Experiment","self_wall_time")
base = os.path.dirname(os.path.realpath(__file__))
cmd = 'qsub -o '+total+'/logs/main.run' + str(run) + '.output.log -e '+total+'/logs/main.run'+ str(run) +'.error.log -l walltime=' + walltime + ' ' + delay + ' -v config='+os.path.abspath(sys.argv[1])+',run='+str(run)+',cwd='+base+' '+base+'/controller/scripts/main_resub.sh'
print cmd
output = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
print output