Skip to content

Commit

Permalink
TaskRunner: ensure errors have been logged
Browse files Browse the repository at this point in the history
Python 3 buffers stderr, which means the exception traceback printed to
stderr might be held back until the process finishes. Instead, ensure that
it gets out promptly, before we process another element.
  • Loading branch information
PaulPrice committed Apr 3, 2018
1 parent c1eb65a commit 176ab54
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/lsst/pipe/base/cmdLineTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ def __call__(self, args):

if not isinstance(e, TaskError):
traceback.print_exc(file=sys.stderr)

# Ensure all errors have been logged and aren't hanging around in a buffer
sys.stdout.flush()
sys.stderr.flush()

task.writeMetadata(dataRef)

# remove MDC so it does not show up outside of task context
Expand Down

0 comments on commit 176ab54

Please sign in to comment.