-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add source & stage decorators (#1364)
* Adds two new decorators `source` and `stage` allowing stages to be created from python functions. * Accept & return types are inferred by inspecting the type annotations of the decorated function. * This removes the need for several lines of boilerplate code needed for simple Python-only stages. * Includes unrelated docstring fix to `morpheus/pipeline/stage_base.py` example: ```py from morpheus.pipeline.stage_decorator import source from morpheus.pipeline.stage_decorator import stage @source def source_gen(dataframes: list[cudf.DataFrame]) -> collections.abc.Iterator[MessageMeta]: for df in dataframes: yield MessageMeta(df) @stage def on_data(message: MessageMeta) -> MessageMeta: with message.mutable_dataframe() as df: print(df) return message ``` Closes #1253 ## By Submitting this PR I confirm: - I am familiar with the [Contributing Guidelines](https://github.com/nv-morpheus/Morpheus/blob/main/docs/source/developer_guide/contributing.md). - When the PR is ready for review, new or existing tests cover these changes. - When the PR is ready for review, the documentation is up to date with these changes. Authors: - David Gardner (https://github.com/dagardner-nv) Approvers: - Devin Robison (https://github.com/drobison00) - Michael Demoret (https://github.com/mdemoret-nv) URL: #1364
- Loading branch information
1 parent
ea188a1
commit ba28cff
Showing
17 changed files
with
1,441 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.