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

Using thread to determine running, isntead of Popen.

parent 86438fd0
Branches
Tags
No related merge requests found
......@@ -114,6 +114,7 @@ class Experiment:
self.lastLog = None
self.pid = None
self.thread = None
self.__new()
......@@ -192,10 +193,10 @@ class Experiment:
'''
Check if simulation is running (if started with asynchronous=True).
'''
if self.pid is None:
if self.thread is None:
return False
else:
return self.pid.poll() is None
return self.thread.isAlive()
def _run(self, dumbOutput=False):
try:
......@@ -225,8 +226,8 @@ class Experiment:
os.chdir(self.path)
if asynchronous:
thread = threading.Thread(target=self._run, args=(dumbOutput,))
thread.start()
self.thread = threading.Thread(target=self._run, args=(dumbOutput,))
self.thread.start()
os.chdir(pwd)
return
else:
......@@ -320,6 +321,7 @@ class ExperimentFromExample(Experiment):
self.lastLog = None
self.pid = None
self.thread = None
self.input = {}
self.output = {}
......@@ -362,6 +364,7 @@ class ExperimentFromExistingRun(Experiment):
self.lastLog = None
self.pid = None
self.thread = 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