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: ...@@ -114,6 +114,7 @@ class Experiment:
self.lastLog = None self.lastLog = None
self.pid = None self.pid = None
self.thread = None
self.__new() self.__new()
...@@ -192,10 +193,10 @@ class Experiment: ...@@ -192,10 +193,10 @@ class Experiment:
''' '''
Check if simulation is running (if started with asynchronous=True). Check if simulation is running (if started with asynchronous=True).
''' '''
if self.pid is None: if self.thread is None:
return False return False
else: else:
return self.pid.poll() is None return self.thread.isAlive()
def _run(self, dumbOutput=False): def _run(self, dumbOutput=False):
try: try:
...@@ -225,8 +226,8 @@ class Experiment: ...@@ -225,8 +226,8 @@ class Experiment:
os.chdir(self.path) os.chdir(self.path)
if asynchronous: if asynchronous:
thread = threading.Thread(target=self._run, args=(dumbOutput,)) self.thread = threading.Thread(target=self._run, args=(dumbOutput,))
thread.start() self.thread.start()
os.chdir(pwd) os.chdir(pwd)
return return
else: else:
...@@ -320,6 +321,7 @@ class ExperimentFromExample(Experiment): ...@@ -320,6 +321,7 @@ class ExperimentFromExample(Experiment):
self.lastLog = None self.lastLog = None
self.pid = None self.pid = None
self.thread = None
self.input = {} self.input = {}
self.output = {} self.output = {}
...@@ -362,6 +364,7 @@ class ExperimentFromExistingRun(Experiment): ...@@ -362,6 +364,7 @@ class ExperimentFromExistingRun(Experiment):
self.lastLog = None self.lastLog = None
self.pid = None self.pid = None
self.thread = None
self.input = {} self.input = {}
self.output = {} self.output = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment