Statistics
| Branch: | Revision:

nepatest_popbabel / scripts / autoMPTimeRouter.py @ 60ba786f

History | View | Annotate | Download (884 Bytes)

1
from multiprocessing import Process
2
from time import sleep
3
import sys
4
import glob
5
import os
6
import subprocess
7
import datetime
8

    
9

    
10
def worker(name, subdir):
11
        if not glob.glob(subdir+'/*results.csv'):
12
                print 'Starting', name
13
                os.system("python fasttimerouter.py "+subdir+"/ > "+subdir+"/out.txt")
14
        else:
15
                print "Results already there in "+subdir
16
        print 'Exiting', name
17

    
18

    
19
if __name__ == '__main__':
20
        jobs=[]
21
        folder=sys.argv[1]
22
        print "RT dump analysis of "+folder
23
        for subf in glob.glob(folder+'h*run*'):
24
                print subf
25
                job = Process(target=worker, args=("worker "+subf,subf))
26
                jobs.append(job)
27

    
28
        for j in jobs:
29
                j.start()
30
                #j.join()
31

    
32
        def still_running(jobs):
33
                retval=True
34
                for j in jobs:
35
                        retval = retval and j.is_alive()
36
                return retval
37

    
38
        start=datetime.datetime.now()
39
        while(still_running(jobs)):
40
                now=datetime.datetime.now()
41
                print "running from", (now-start)
42
                sleep(5)