-
Notifications
You must be signed in to change notification settings - Fork 0
/
launchruns.py
44 lines (31 loc) · 999 Bytes
/
launchruns.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
31
32
33
34
35
36
37
38
39
40
41
42
43
import os,commands,time
import numpy as np
system=os.system
System=commands.getoutput
#READ RUN CONFIGURATION
conf=dict()
execfile("runs.cfg",{},conf)
verbose=False
#LAUNCH RUNS
nrun=conf["nrun"]
while True:
for i in xrange(nrun):
suffix="%03d"%i
if verbose:print "Checking run %d..."%i
#CHECK IF RUN IS RUNNIG
if os.path.lexists("runs/run_%s/.start"%suffix):
if verbose:print "\tRunning..."
continue
#CHECK NUMBER OF RUNNING PROCESSES
nproc=System("at -l |wc -l")
if verbose:print "Number of running processes %d..."%int(nproc)
if int(nproc)>conf["runsim"]:
if verbose:print "\tMaximum number of processes running..."
break
print "Launching run %d..."%(i+1)
system("cd runs/run_%s;at now < run.sh"%suffix)
print "%d process checked..."%i
if i==nrun-1:break
print "Sleeping..."
time.sleep(1)
print "Done."