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):
return gr
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]:
# first close the open files
self.stderrfh.close()
utils.robust_rmtree(self.directory)
@staticmethod
......@@ -951,14 +951,16 @@ class Workflow(threading.Thread):
if not keep_same_error_file:
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) )
stderr = os.path.join(self.directory, self.STDERR_FILE_NAME)
logger = logging.getLogger( "wf." + str(self.id) )
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter( '## %(asctime)s :: %(message)s' )
self.stderrfh = FileHandler(stderr, 'a')
self.stderrfh.setLevel(logging.ERROR)
self.stderrfh.setFormatter(formatter)
logger.addHandler(self.stderrfh)
if self.stderrfh is not None:
self.stderrfh = FileHandler(stderr, 'a')
self.stderrfh.setLevel(logging.ERROR)
self.stderrfh.setFormatter(formatter)
logger.addHandler(self.stderrfh)
return stderr
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