From 47d80d88e986fc039866c3a627ffe1140538d4b2 Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@fe.uni-lj.si> Date: Thu, 07 Apr 2016 08:04:04 +0000 Subject: [PATCH] Starting trisurf in background, however, all the files needs to be in the right directories (tapes, dumps) prior to the execution --- python/trisurf/trisurf.py | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/python/trisurf/trisurf.py b/python/trisurf/trisurf.py index 34c5ca8..dc1cb78 100644 --- a/python/trisurf/trisurf.py +++ b/python/trisurf/trisurf.py @@ -12,7 +12,7 @@ import psutil import time import datetime - +from subprocess import call, Popen # Process status TS_NOLOCK=0 # lock file does not exist @@ -248,6 +248,7 @@ ''' def __init__(self, subdir='run0', tape='', snapshot=''): self.subdir=subdir + self.fromSnapshot=False if(tape!=''): self.initFromTape(tape) if(snapshot!=''): @@ -265,7 +266,8 @@ except: print("Error reading snapshot file") exit(1) - + self.fromSnapshot=True + self.snapshotFile=snapshotfile root = tree.getroot() tapetxt=root.find('tape') version=root.find('trisurfversion') @@ -303,8 +305,15 @@ if(self.getStatus()==0): self.Dir=Directory(maindir=self.maindir,simdir=self.subdir) self.Dir.makeifnotexist() -# self.Dir.goto() + cwd=Directory(maindir=os.getcwd()) + self.Dir.goto() print("Starting trisurf-ng executable at "+self.Dir.fullpath()+"\n") + if(self.fromSnapshot==True): + params=["trisurf", "--restore-from-vtk",self.snapshotFile] + else: + params="trisurf" + Popen (params, stdout=False) + cwd.goto() else: print("Process already running. Not starting\n") return -- Gitblit v1.9.3