Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.14.2 release #223

Merged
merged 9 commits into from
May 7, 2024
35 changes: 18 additions & 17 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@ on:

jobs:
deploy:
name: upload release to PyPI
runs-on: ubuntu-latest

permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
run: |
python setup.py sdist bdist_wheel
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.14.2] -- 2024-05-07
### Changed
- Addresses [#218](https://github.com/databio/pypiper/issues/218)

## [0.14.1] -- 2024-04-19
### Changed
- remove pipestat_project_name from PipelineManager parameters
Expand Down
2 changes: 1 addition & 1 deletion pypiper/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.14.1"
__version__ = "0.14.2"
4 changes: 1 addition & 3 deletions pypiper/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1290,8 +1290,6 @@ def proc_wrapup(i):
sleeptime = min((sleeptime + 0.25) * 3, 60 / len(processes))

# All jobs are done, print a final closing and job info
stop_time = time.time()
proc_message = "Command completed. {info}"
info = (
"Elapsed time: "
+ str(datetime.timedelta(seconds=self.time_elapsed(start_time)))
Expand All @@ -1308,7 +1306,7 @@ def proc_wrapup(i):

info += "\n" # finish out the
self.info("</pre>")
self.info(proc_message.format(info=info))
self.info("Command completed. {info}".format(info=info))

for rc in returncodes:
if rc != 0:
Expand Down
8 changes: 6 additions & 2 deletions pypiper/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,13 @@ def run(self, start_point=None, stop_before=None, stop_after=None):

print(f"Running stage: {getattr(stage, 'name', str(stage))}")

stage.run()
try:
stage.run()
except Exception as e:
self.manager._triage_error(e, nofail=stage.nofail)
else:
self.checkpoint(stage)
self.executed.append(stage)
self.checkpoint(stage)

# Add any unused stages to the collection of skips.
self.skipped.extend(self._stages[stop_index:])
Expand Down
14 changes: 13 additions & 1 deletion pypiper/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ class Stage(object):
collection of commands that is checkpointed.
"""

def __init__(self, func, f_args=None, f_kwargs=None, name=None, checkpoint=True):
def __init__(
self,
func,
f_args=None,
f_kwargs=None,
name=None,
checkpoint=True,
*,
nofail=False
):
"""
A function, perhaps with arguments, defines the stage.

Expand All @@ -26,6 +35,8 @@ def __init__(self, func, f_args=None, f_kwargs=None, name=None, checkpoint=True)
:param dict f_kwargs: Keyword arguments for func
:param str name: name for the phase/stage
:param callable func: Object that defines how the stage will execute.
:param bool nofail: Allow a failure of this stage to not fail the pipeline
in which it's running
"""
if isinstance(func, Stage):
raise TypeError("Cannot create Stage from Stage")
Expand All @@ -35,6 +46,7 @@ def __init__(self, func, f_args=None, f_kwargs=None, name=None, checkpoint=True)
self.f_kwargs = f_kwargs or dict()
self.name = name or func.__name__
self.checkpoint = checkpoint
self.nofail = nofail

@property
def checkpoint_name(self):
Expand Down
1 change: 1 addition & 0 deletions requirements/requirements-dev-extra.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
black
Loading