Commit 8fcdaac5 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

fix a bug with errors handling

parent ab7f71e9
...@@ -429,9 +429,9 @@ class Workflow(threading.Thread): ...@@ -429,9 +429,9 @@ class Workflow(threading.Thread):
return gr return gr
def delete(self): def delete(self):
# first close the open files
self.stderrfh.close()
if self.get_status() in [self.STATUS_COMPLETED, self.STATUS_FAILED, self.STATUS_ABORTED]: if self.get_status() in [self.STATUS_COMPLETED, self.STATUS_FAILED, self.STATUS_ABORTED]:
# first close the open files
self.stderrfh.close()
utils.robust_rmtree(self.directory) utils.robust_rmtree(self.directory)
@staticmethod @staticmethod
...@@ -951,14 +951,16 @@ class Workflow(threading.Thread): ...@@ -951,14 +951,16 @@ class Workflow(threading.Thread):
if not keep_same_error_file: if not keep_same_error_file:
if hasattr(self, "stderr") and self.stderr is not None: if hasattr(self, "stderr") and self.stderr is not None:
os.rename( self.stderr, os.path.join(self.directory, str(time.time()) + self.STDERR_FILE_NAME + self.OLD_EXTENSION) ) os.rename( self.stderr, os.path.join(self.directory, str(time.time()) + self.STDERR_FILE_NAME + self.OLD_EXTENSION) )
stderr = os.path.join(self.directory, self.STDERR_FILE_NAME) stderr = os.path.join(self.directory, self.STDERR_FILE_NAME)
logger = logging.getLogger( "wf." + str(self.id) ) logger = logging.getLogger( "wf." + str(self.id) )
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
formatter = logging.Formatter( '## %(asctime)s :: %(message)s' ) formatter = logging.Formatter( '## %(asctime)s :: %(message)s' )
self.stderrfh = FileHandler(stderr, 'a') if self.stderrfh is not None:
self.stderrfh.setLevel(logging.ERROR) self.stderrfh = FileHandler(stderr, 'a')
self.stderrfh.setFormatter(formatter) self.stderrfh.setLevel(logging.ERROR)
logger.addHandler(self.stderrfh) self.stderrfh.setFormatter(formatter)
logger.addHandler(self.stderrfh)
return stderr return stderr
def _execute_weaver(self, engine_wrapper=None): def _execute_weaver(self, engine_wrapper=None):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment