From 9154b3cc571c2461010573f84b91fcf84830cf5a Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@fe.uni-lj.si> Date: Wed, 16 Mar 2016 08:18:50 +0000 Subject: [PATCH] Improved reporting. Added per process ID possibilities --- python/tsmgr | 97 +++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 91 insertions(+), 6 deletions(-) diff --git a/python/tsmgr b/python/tsmgr index 69d3f7f..4b2b13f 100755 --- a/python/tsmgr +++ b/python/tsmgr @@ -1,16 +1,101 @@ #!/usr/bin/python3 - +import sys, getopt from trisurf import trisurf +import tabulate - +# -- configuration of the multiple/single run -- run1=trisurf.Runner(snapshot='snapshot.vtu') run1.setMaindir(("N","k","V","Np","Nm"),("nshell","xk0","constvolswitch","npoly","nmono")) run1.setSubdir("run0") -run1.start() + +run2=trisurf.Runner(snapshot='snapshot.vtu') +run2.setMaindir(("N","k","V","Np","Nm"),("nshell","xk0","constvolswitch","npoly","nmono")) +run2.setSubdir("run1") + + +#obligatory: combine all runs +Runs=[run1,run2] + + + +#------------------ NO NEED TO TOUCH THE CODE BELOW ------------------------------ + +# -- reading command line switches and acting accordingly -- +argv=sys.argv[1:] +processno=0 +try: + opts, args = getopt.getopt(argv,"n:hrsc:") +except getopt.GetoptError: + print('tsmgr [-n process number] [-h] [-r] [-s] [-c comment text]') + sys.exit(2) +for opt, arg in opts: + if opt == '-h': + print ('tsmgr [-n process number] [-h] [-r] [-s] [-c 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) + + + else: + print('tsmgr [-n process number] [-h] [-r] [-s] [-c comment text]') + sys.exit(2) + + + + + + + + + +# -- OBSOLETE and TESTING -- + + + + + +# elif opt in ("-i", "--ifile"): +# inputfile = arg +# elif opt in ("-o", "--ofile"): +# outputfile = arg +# print ('Input file is "', inputfile) +# print ('Output file is "', outputfile) + + + +#run1.start() #run -print(run1) -run1.getStatistics() -print(run1.statistics) +#print(run1) +#run1.getStatistics() +#print(run1.statistics) #print(run1.tape) #print(run1.tape.getValue('nshell')) -- Gitblit v1.9.3