Skip to content

Commit

Permalink
0.2.10 (#119)
Browse files Browse the repository at this point in the history
* ✨ Add hook `on_proc_input_computed`

* 🩹 Default new process docstring to "Undescribed process."

* 🔖 0.2.10
  • Loading branch information
pwwang authored Dec 6, 2021
1 parent 33e1d13 commit 3f7c633
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.2.10

- ✨ Add hook `on_proc_input_computed`
- 🩹 Default new process docstring to "Undescribed process."

## 0.2.9

- ✨ Allow `requires` to be set by `__setattr__()`
Expand Down
4 changes: 4 additions & 0 deletions docs/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ See [`simplug`][1] for more details.
Called before proc get instantiated.
Enables plugins to modify the default attributes of processes

- `on_proc_input_computed(proc)` (sync)

Called after process input data is computed.

- `on_proc_start(proc)` (async)

When process object initialization completes, including the `xqute` and job initialization. The `output_data` is also accessible here. The process is ready to run.
Expand Down
9 changes: 9 additions & 0 deletions pipen/pluginmgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ def on_proc_init(proc: "Proc"):
"""


@plugin.spec
def on_proc_input_computed(proc: "Proc"):
"""Called after process input data is computed.
Args:
proc: The Proc object
"""


@plugin.spec
async def on_proc_start(proc: "Proc"):
"""When a process is starting
Expand Down
7 changes: 6 additions & 1 deletion pipen/proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,11 @@ def __init_subclass__(cls) -> None:
if cls.name is None or cls.name == cls.__bases__[0].name:
cls.name = cls.__name__
if cls.__doc__ is None:
cls.__doc__ = cls.__bases__[0].__doc__
cls.__doc__ = (
cls.__bases__[0].__doc__
if cls.__bases__[0] is not Proc
else "Undescribed process."
)

def __init__(self, pipeline: "Pipen" = None) -> None:
"""Constructor
Expand Down Expand Up @@ -333,6 +337,7 @@ def __init__(self, pipeline: "Pipen" = None) -> None:

# input
self.input = self._compute_input() # type: ignore
plugin.hooks.on_proc_input_computed(self)
# output
self.output = self._compute_output()
# scheduler
Expand Down
2 changes: 1 addition & 1 deletion pipen/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Provide version of pipen"""

__version__ = "0.2.9"
__version__ = "0.2.10"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"

[tool.poetry]
name = "pipen"
version = "0.2.9"
version = "0.2.10"
description = "A pipeline framework for python"
authors = [ "pwwang <[email protected]>",]
license = "MIT"
Expand Down

0 comments on commit 3f7c633

Please sign in to comment.