Skip to content
Snippets Groups Projects
Commit 4b7a46b6 authored by Christoph.Knote's avatar Christoph.Knote
Browse files

OK, it won't work, probably, but it's a first try.

parent 999b34e5
Branches
Tags
No related merge requests found
......@@ -112,6 +112,8 @@ class Experiment:
#: Log file of the last run
self.lastLog = None
self.pid = None
self.__new()
#: Namelist
......@@ -184,11 +186,12 @@ class Experiment:
return mech
def run(self, dumbOutput=False):
def run(self, dumbOutput=False, asynchronous=False):
'''
Run BOXMOX experiment
:param bool dumbOutput: Only load references to output files, instead of loading data? (faster, but not usable for analysis)
:param bool asynchronous: Run asynchronous?
'''
self.namelist.write(os.path.join(self.path, 'BOXMOX.nml'))
......@@ -200,11 +203,13 @@ class Experiment:
os.chdir(self.path)
try:
p = s.Popen("./" + self.mechanism + ".exe", stdout=s.PIPE, bufsize=1)
p.wait() # wait for the subprocess to exit
self.pid = s.Popen("./" + self.mechanism + ".exe", stdout=s.PIPE, bufsize=1)
if asynchronous:
return
self.pid.wait() # wait for the subprocess to exit
self.lastLog = []
for line in iter(p.stdout.readline, b''):
for line in iter(self.pid.stdout.readline, b''):
self.lastLog.append(line.replace('\n',''))
except Exception as e:
......@@ -293,6 +298,8 @@ class ExperimentFromExample(Experiment):
self.lastLog = None
self.pid = None
self.input = {}
self.output = {}
......@@ -333,6 +340,8 @@ class ExperimentFromExistingRun(Experiment):
self.lastLog = None
self.pid = None
self.input = {}
self.output = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment