Skip to content

Commit

Permalink
Revert unintentional change
Browse files Browse the repository at this point in the history
  • Loading branch information
dagardner-nv committed Oct 11, 2023
1 parent a32ac8f commit 20afe30
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/source/developer_guide/guides/3_simple_cpp_stage.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,13 @@ PYBIND11_MODULE(morpheus_example, m)
### Python Changes
We need to make a few minor adjustments to our Python implementation of the `PassThruStage`.
We need to make a few minor adjustments to our Python implementation of the `PassThruStage`. First, we import the new `morpheus_example` Python module we created in the previous section.
As mentioned in the previous section, we will need to change the return value of the `supports_cpp_node` method to indicate that our stage now supports a C++ implementation. Our `_build_single` method needs to be updated to build a C++ node when `morpheus.config.CppConfig.get_should_use_cpp()` is `True` using the `self._build_cpp_node()` method. The `_build_cpp_node()` method compares both `morpheus.config.CppConfig.get_should_use_cpp()` and `supports_cpp_node()` and returns `True` only when both methods return `True`.
```python
from _lib import morpheus_example as morpheus_example_cpp
```

We lazily import the new `morpheus_example` Python module we created in the previous section only when we need to build a C++ node since importing a compiled extension module comes at a performance cost.
As mentioned in the previous section, we will need to change the return value of the `supports_cpp_node` method to indicate that our stage now supports a C++ implementation. Our `_build_single` method needs to be updated to build a C++ node when `morpheus.config.CppConfig.get_should_use_cpp()` is `True` using the `self._build_cpp_node()` method. The `_build_cpp_node()` method compares both `morpheus.config.CppConfig.get_should_use_cpp()` and `supports_cpp_node()` and returns `True` only when both methods return `True`.

```python
def supports_cpp_node(self):
Expand All @@ -349,7 +351,6 @@ def supports_cpp_node(self):
```python
def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair:
if self._build_cpp_node():
from _lib import morpheus_example as morpheus_example_cpp
node = morpheus_example_cpp.PassThruStage(builder, self.unique_name)
else:
node = builder.make_node(self.unique_name, ops.map(self.on_data))
Expand Down

0 comments on commit 20afe30

Please sign in to comment.