Skip to content

Commit

Permalink
allow pipeline fail messages to be a string. Fix #166
Browse files Browse the repository at this point in the history
  • Loading branch information
nsheff committed Aug 26, 2019
1 parent f5082bc commit 956683d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pypiper/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ def complete(self):
""" Stop a completely finished pipeline. """
self.stop_pipeline(status=COMPLETE_FLAG)

def fail_pipeline(self, e, dynamic_recover=False):
def fail_pipeline(self, exc, dynamic_recover=False):
"""
If the pipeline does not complete, this function will stop the pipeline gracefully.
It sets the status flag to failed and skips the normal success completion procedure.
Expand Down Expand Up @@ -1651,10 +1651,13 @@ def fail_pipeline(self, e, dynamic_recover=False):
self.timestamp("### Pipeline failed at: ")
total_time = datetime.timedelta(seconds=self.time_elapsed(self.starttime))
self.info("Total time: " + str(total_time))
self.info("Failure reason: " + str(e))
self.info("Failure reason: " + str(exc))
self._set_status_flag(FAIL_FLAG)

raise e
if isinstance(exc, str):
exc = RuntimeError(exc)

raise exc

def halt(self, checkpoint=None, finished=False, raise_error=True):
"""
Expand Down

0 comments on commit 956683d

Please sign in to comment.