From 9f5ff50a40f78ecdf25ec6bcd4e5490152db81d6 Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@gmail.com> Date: Fri, 13 May 2016 07:56:43 +0000 Subject: [PATCH] Changed the way tsmgr is called --- python/myTestConfig.py | 17 ++++++++ python/trisurf/tsmgr.py | 60 ++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 0 deletions(-) diff --git a/python/myTestConfig.py b/python/myTestConfig.py new file mode 100644 index 0000000..23f9342 --- /dev/null +++ b/python/myTestConfig.py @@ -0,0 +1,17 @@ +from trisurf import tsmgr +from trisurf import trisurf + +run1=trisurf.Runner(snapshot='snapshot.vtu') +run1.setMaindir(("N","k","V","Np","Nm"),("nshell","xk0","constvolswitch","npoly","nmono")) +run1.setSubdir("run0") + +run2=trisurf.Runner(tape='tape', runArgs=['--force-from-tape']) +run2.setMaindir(("N","k","V","Np","Nm"),("nshell","xk0","constvolswitch","npoly","nmono")) +run2.setSubdir("run1") + + +#obligatory: combine all runs +Runs=[run1,run2] + +tsmgr.start(Runs) + diff --git a/python/trisurf/tsmgr.py b/python/trisurf/tsmgr.py new file mode 100644 index 0000000..e376805 --- /dev/null +++ b/python/trisurf/tsmgr.py @@ -0,0 +1,60 @@ +import sys, getopt +import tabulate + +def start(Runs): + argv=sys.argv[1:] + processno=0 + try: + opts, args = getopt.getopt(argv,"a:n:hrsc:") + except getopt.GetoptError: + print('tsmgr [-n process number] [-h] [-r] [-s] [-c comment text] [-a comment text]') + sys.exit(2) + for opt, arg in opts: + if opt == '-h': + print ('tsmgr [-n process number] [-h] [-r] [-s] [-c comment text] [-a comment text]') + sys.exit() + elif opt == '-r': + if processno: + localRuns=[Runs[processno-1]] + else: + localRuns=Runs + for run in localRuns: + run.start() + elif opt == '-s': + report=[] + i=1 + if processno: + localRuns=[Runs[processno-1]] + else: + localRuns=Runs + for run in localRuns: + line=run.getStatistics() + line.insert(0,i) + report.append(line) + i=i+1 + #print(reportstr) + print ("\n\nTrisurf running processes report\n") + print (tabulate.tabulate(report,headers=["Run no.", "Run start time", "ETA", "Status", "PID", "Path", "Comment"], tablefmt='fancy_grid')) + elif opt == '-n': + processno=int(arg) + if processno<1 or processno>len(Runs) : + processno=0 + elif opt == '-c': + comment = arg + if processno: + Runs[processno-1].writeComment(arg) + elif opt == '-a': + comment = arg + if processno: + Runs[processno-1].writeComment("\n"+arg, 'a') + + + else: + print('tsmgr [-n process number] [-h] [-r] [-s] [-c comment text] [-a comment text]') + sys.exit(2) + + + + + + -- Gitblit v1.9.3