Skip to content

Commit

Permalink
add default_return_code
Browse files Browse the repository at this point in the history
might be used to discriminate between runs that did not execute any commands and runs that did
  • Loading branch information
stolarczyk committed Jul 28, 2021
1 parent ca3f515 commit ee8cba5
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 @@ -802,6 +802,7 @@ def run(
clean=False,
follow=None,
container=None,
default_return_code=0,
):
"""
The primary workhorse function of PipelineManager, this runs a command.
Expand Down Expand Up @@ -832,6 +833,8 @@ def run(
to an auto cleanup list. Optional.
:param callable follow: Function to call after executing (each) command.
:param str container: Name for Docker container in which to run commands.
:param Any default_return_code: Return code to use, might be used to discriminate
between runs that did not execute any commands and runs that did.
:return int: Return code of process. If a list of commands is passed,
this is the maximum of all return codes for all commands.
"""
Expand All @@ -845,7 +848,7 @@ def run(
len(cmds), "\n".join(cmds_text)
)
)
return 0
return default_return_code

# Short-circuit if the checkpoint file exists and the manager's not
# been configured to overwrite such files.
Expand All @@ -859,7 +862,7 @@ def run(
self.curr_checkpoint, check_fpath, self.__class__.__name__, cmd
)
)
return 0
return default_return_code

# TODO: consider making the logic such that locking isn't implied, or
# TODO (cont.): that we can make it otherwise such that it's not
Expand Down Expand Up @@ -891,7 +894,7 @@ def run(
lock_name = lock_name or make_lock_name(target, self.outfolder)
lock_files = [self._make_lock_path(ln) for ln in lock_name]

process_return_code = 0
process_return_code = default_return_code
local_maxmem = 0

# Decide how to do follow-up.
Expand Down

0 comments on commit ee8cba5

Please sign in to comment.