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

Add documentation to LinearBoundary stages #418

Merged
5 commits merged into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions morpheus/pipeline/linear_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,35 @@ def add_stage(self, stage: _pipeline.SinglePortStage):
self._linear_stages.append(stage)

def add_segment_boundary(self, data_type=None, as_shared_pointer=False):
"""
Parameters
----------
data_type : `data_type`
data type that will be passed across the segment boundary, defaults to a general python object
if 'data_type' has no registered edge adapters.

as_shared_pointer : `boolean`
Whether the data type will be wrapped in a shared pointer.

Example
-------
# Create a config and pipeline \n
config = Config()
pipe = LinearPipeline(config)

# Add a source in Segment #1 \n
pipe.set_source(FileSourceStage(config, filename=val_file_name, iterative=False))

# Add a segment boundary \n
# [Current Segment] - [Egress Boundary] ---- [Ingress Boundary] - [Next Segment]

pipe.add_segment_boundary(MessageMeta)

# Add a sink in Segment #2\n
pipe.add_stage(WriteToFileStage(config, filename=out_file, overwrite=False))

pipe.run()
mdemoret-nv marked this conversation as resolved.
Show resolved Hide resolved
"""
if (len(self._linear_stages) == 0):
raise RuntimeError("Cannot create a segment boundary, current segment is empty.")

Expand Down
2 changes: 1 addition & 1 deletion morpheus/stages/boundary/linear_boundary_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LinearBoundaryEgressStage(SinglePortStage):
boundary_port_id : `str`
String indicating the name of the egress port associated with the LinearBoundaryEgressStage; allowing it to be
paired with the corresponding ingress port.
data_type : `python data type instance`
data_type : `typing.Type`
Data type that this Stage will accept and then output to its egress port.

Example
Expand Down