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

Adding Combination Operators Zip, CombineLatest, WithLatestFrom #330

Open
wants to merge 83 commits into
base: branch-23.07
Choose a base branch
from

Conversation

mdemoret-nv
Copy link
Contributor

Description

This adds a few new operators for combining multiple streams into one. For example, the code below illustrates using the Zip operator

auto source1 = std::make_shared<node::TestSource<int>>();
auto source2 = std::make_shared<node::TestSource<float>>();

auto zip = std::make_shared<node::Zip<int, float>>();

auto sink = std::make_shared<node::TestSink<std::tuple<int, float>>>();

mrc::make_edge(*source1, *zip->get_sink<0>());
mrc::make_edge(*source2, *zip->get_sink<1>());
mrc::make_edge(*zip, *sink);

source1->run();
source2->run();

sink->run();

EXPECT_EQ(sink->get_values(),
            (std::vector<std::tuple<int, float>>{
                std::tuple<int, float>{0, 0},
                std::tuple<int, float>{1, 1},
                std::tuple<int, float>{2, 2},
            }));

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@mdemoret-nv mdemoret-nv added non-breaking Non-breaking change feature request New feature or request labels Jun 3, 2023
@mdemoret-nv mdemoret-nv requested review from a team as code owners June 3, 2023 00:12
mdemoret-nv and others added 19 commits June 21, 2023 12:07
This PR contains the changes from running the `ci/release/update-version.sh` script for a new release

Authors:
  - Michael Demoret (https://github.com/mdemoret-nv)

Approvers:
  - David Gardner (https://github.com/dagardner-nv)

URL: nv-morpheus#357
Forward-merge branch-23.07 to branch-23.11
* Adopt patched pybind11
* Update versions of boost & libhwloc to work-around clang CI issue
* A test for this bug exists in Morpheus, but is difficult to reproduce in MRC. A MRC based test coming soon.

fixes nv-morpheus#262

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#364
This PR replaces the `copy_prs` functionality from the `ops-bot` with the new dedicated `copy-pr-bot` GitHub application.

Thorough documentation for the new `copy-pr-bot` application can be viewed below.

- https://docs.gha-runners.nvidia.com/apps/copy-pr-bot/

**Important**: `copy-pr-bot` enforces signed commits. If an organization member opens a PR that contains unsigned commits, it will be deemed untrusted and therefore require an `/ok to test` comment. See the GitHub docs [here](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) for information on how to set up commit signing.

Any time a PR is deemed untrusted, it will receive a comment that looks like this: rapidsai/ci-imgs#63 (comment).

Every subsequent commit on an untrusted PR will require an additional `/ok to test` comment.

Any existing PRs that have unsigned commits after this change is merged will require an `/ok to test` comment for each subsequent commit _or_ the PR can be rebased to include signed commits as mentioned in the docs below:
https://docs.gha-runners.nvidia.com/cpr/contributors.

This information is all included on the documentation page linked above.

_I've skipped CI on this PR since it's not a change that is tested._

[skip ci]
…-morpheus#377)

Cherry picks some changes from nv-morpheus#361 to allow other PRs to run CI since that PR is marked as `DO_NOT_MERGE`

Authors:
  - Michael Demoret (https://github.com/mdemoret-nv)

Approvers:
  - David Gardner (https://github.com/dagardner-nv)
  - Christopher Harris (https://github.com/cwharris)

URL: nv-morpheus#377
…ironment (nv-morpheus#375)

Adds a new `dependencies.yaml` which is used in RAPIDS devcontainer utils to generate conda env yamls, `project.toml`'s, and `setup.py`s on-the-fly using https://github.com/rapidsai/dependency-file-generator. Eventually we can generate/verify our existing environment files this way, but for now this gets us up and running in a RAPIDS devcontainer.

Also changes `prometheus-cpp::core` to a `PRIVATE`ly linked library, as it's not longer necessary to be `PUBLIC`, and otherwise breaks a combined MRC/Morpheus build.

Also adds a `MRC_PYTHON_INPLACE_BUILD` cmake option, which enables pybind11 modules to be copied back to the source tree.

MRC/Morpheus unified build environment is a WIP, but available here: https://github.com/cwharris/cyber-dev.

Contributes to nv-morpheus/Morpheus#704

Authors:
  - Christopher Harris (https://github.com/cwharris)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#375
Replace usage of deprecated `make_node_full` with `make_node` in the Quick Start Guide. Also fix a typo.

Contributes to nv-morpheus/Morpheus#782.

Authors:
  - Christopher Harris (https://github.com/cwharris)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#376
…-cap-add=sys_nice (nv-morpheus#383)

REME.md update

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Christopher Harris (https://github.com/cwharris)
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#383
PR updates `rapidsai/ci` references to `rapidsai/ci-conda`.

Authors:
  - Jake Awe (https://github.com/AyodeAwe)

Approvers:
  - David Gardner (https://github.com/dagardner-nv)

URL: nv-morpheus#396
* Based on fixes from @mdemoret-nv : https://github.com/mdemoret-nv/MRC/tree/mdd_control-plane-promises & nv-morpheus#381
* Adopts updated versions of boost, clang & IWYU
* Only run IWYU on files changed in PR
* Use clang for checks stage
* Allocate progress engine promises on the heap

fixes nv-morpheus#379

Authors:
  - David Gardner (https://github.com/dagardner-nv)
  - Michael Demoret (https://github.com/mdemoret-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)
  - Christopher Harris (https://github.com/cwharris)

URL: nv-morpheus#391
…orpheus#387)

Adds support for unlimited pipe arguments.

Authors:
  - Christopher Harris (https://github.com/cwharris)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#387
* Docker image uses `rapidsai/ci-conda` as the base per rapidsai/ops#2806
* Adds the ability to CI locally via `./ci/scripts/run_ci_local.sh build` & `./ci/scripts/run_ci_local.sh test`
* Fix type-o in benchmark stage causing benchmarks to be executed twice & preventing results from being published.
* Add `.tmp` and `.clangd` to `.gitignore`
* Document need to set `DOCKER_BUILDKIT=1` for docker builds.


fixes nv-morpheus#393
fixes nv-morpheus#397

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Christopher Harris (https://github.com/cwharris)

URL: nv-morpheus#394
* PR replicates issue nv-morpheus#362, and will trigger a pybind11 internal error using an un-patched version of pybind11
* Only run IWYU on files changed in PR

Note:
* This bug requires the code in question to be run in a thread created by C++.

fixes nv-morpheus#362

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#365
Copy link
Contributor

@cwharris cwharris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but I'm not familiar enough with most of the MRC aspects yet to give a thorough review.

@@ -824,6 +1012,182 @@ TEST_F(TestEdges, CombineLatest)
source2->run();

sink->run();

EXPECT_EQ(sink->get_values(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test doesn't account for all 5 pairs/values that could be yielded in a real scenario where the elements are interleaved, it only accounts for the scenario where source1 is run entirely before source2, meaning we don't get anything except the 2's for source1. Is it worth testing more thoroughly than this?

source1->run();

// Should throw when pushing last value
EXPECT_THROW(source2->run(), exceptions::MrcRuntimeError);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is this going to cause us to throw when we try to shutdown the pipeline? Is that something we want?


sink->run();

EXPECT_EQ(sink->get_values(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: This differs from the previous test where we throw an exception. Why is that? Is it because we treat sink 0 and sink 1 differently in terms of the number of elements they are allowed to accept?

Comment on lines +1112 to +1136
// Push 2 from each
source2->push(2);
source1->push(2);
source3->push(2);

// Push 2 from each
source2->push(2);
source1->push(2);
source3->push(2);

// Push the rest
source3->run();
source1->run();
source2->run();

sink->run();

EXPECT_EQ(sink->get_values(),
(std::vector<std::tuple<int, float, std::string>>{
std::tuple<int, float, std::string>{0, 1, "a"},
std::tuple<int, float, std::string>{1, 1, "a"},
std::tuple<int, float, std::string>{2, 3, "b"},
std::tuple<int, float, std::string>{3, 3, "b"},
std::tuple<int, float, std::string>{4, 3, "e"},
}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remark: the only thing I'm fuzzy on is whether 0, 1, a should be in the output, since 0 _ _ was emitted before we had both _ 1 _ and _ _ a.
question: are we suppose to remember and emit for all values of the source observable, or just the ones that occur after we've received at least one from the others?

template <size_t N>
channel::Status set_upstream_value(NthTypeOf<N, TypesT...> value)
{
std::unique_lock<decltype(m_mutex)> lock(m_mutex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::unique_lock<decltype(m_mutex)> lock(m_mutex);
auto lock = std::unique_lock(m_mutex);


void edge_complete()
{
std::unique_lock<decltype(m_mutex)> lock(m_mutex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::unique_lock<decltype(m_mutex)> lock(m_mutex);
auto lock = std::unique_lock(m_mutex);

…rpheus#402)

* Prevents `check_active_connection` from mistakenly returning true for a holder where `init_owned_edge` has been called but neither the `init_connected_edge method` or the `add_connector` method have not been called.

Relates to issue nv-morpheus#360

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#402
dagardner-nv and others added 13 commits April 5, 2024 09:40
…s#464)

Adds maximum simultaneous tasks support to `TaskContainer` by only starting new tasks if the number of currently executing tasks is less than the maximum number of simultaneous tasks and starting new tasks as older tasks shut down. this eliminates the need for external semaphores or ticketing systems.

Authors:
  - Christopher Harris (https://github.com/cwharris)
  - David Gardner (https://github.com/dagardner-nv)
  - Michael Demoret (https://github.com/mdemoret-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#464
Morpheus documentation won't build with doxygen 1.10.0, but we need MRC and Morpheus doxygen versions to match so cross-repository environments can be solved correctly. This PR downgrades doxygen to the version used by Morpheus.

Authors:
  - Christopher Harris (https://github.com/cwharris)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#469
…path methods (nv-morpheus#465)

* All three methods performed nearly identical operations, but were defined in anonymous namespaces and not exposed in a header preventing sharing.
* Consolidate all three into a new `split_string_to_vector` in `string_utils.hpp`

closes nv-morpheus#454

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#465
…ge-24.03

Forward-merge branch-24.03 into branch-24.06
* Adds `AutoRegSinkAdapter` and `AutoRegEgressPort` to `AsyncSink`
* Adds `AutoRegSourceAdapter` and `AutoRegIngressPort` to `AsyncSource`
* Giving `AsyncSink`, `AsyncSource` and `AsyncioRunnable` the same implicit converter functionality that `PythonNode` has
* Fixes unrelated CI issue for IWYU, since IWYU can only run on compilation units, we can't execute it when a change only includes header files.

Closes nv-morpheus/Morpheus#1626

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#473
Forward-merge branch-24.03 into branch-24.06
@mdemoret-nv mdemoret-nv requested a review from a team as a code owner May 1, 2024 00:02
Copy link

codecov bot commented May 1, 2024

Codecov Report

Attention: Patch coverage is 86.56716% with 18 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (branch-23.07@5f62b46). Click here to learn what that means.
Report is 7 commits behind head on branch-23.07.

❗ Current head 7cbfe8e differs from pull request most recent head 5c52d5c. Consider uploading reports for the commit 5c52d5c to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff               @@
##             branch-23.07     #330   +/-   ##
===============================================
  Coverage                ?   73.26%           
===============================================
  Files                   ?      386           
  Lines                   ?    13533           
  Branches                ?     1024           
===============================================
  Hits                    ?     9915           
  Misses                  ?     3618           
  Partials                ?        0           
Flag Coverage Δ
cpp 69.25% <86.56%> (?)
py 42.06% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
cpp/mrc/include/mrc/edge/edge_channel.hpp 85.00% <100.00%> (ø)
.../mrc/include/mrc/node/operators/combine_latest.hpp 100.00% <100.00%> (ø)
cpp/mrc/include/mrc/node/sink_channel_owner.hpp 100.00% <100.00%> (ø)
cpp/mrc/include/mrc/node/source_channel_owner.hpp 90.90% <100.00%> (ø)
cpp/mrc/include/mrc/utils/tuple_utils.hpp 100.00% <100.00%> (ø)
cpp/mrc/include/mrc/node/operators/zip.hpp 98.21% <98.21%> (ø)
...rc/include/mrc/node/operators/with_latest_from.hpp 95.65% <95.65%> (ø)
cpp/mrc/include/mrc/channel/status.hpp 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f62b46...5c52d5c. Read the comment docs.

jameslamb and others added 12 commits June 17, 2024 16:16
Contributes to rapidsai/dependency-file-generator#89.

`--file_key` has been deprecated in `rapids-dependency-file-generator` for a few months, and I'm looking to fully remove it.

This PR proposes:

* switching this project's uses from `--file_key` to `--file-key`
* updating the version of `rapids-dependency-file-generator` used in `pre-commit` to its latest release
* switching from `mamba env create --force` to `mamba env create --yes`

Authors:
  - James Lamb (https://github.com/jameslamb)

Approvers:
  - Christopher Harris (https://github.com/cwharris)

URL: nv-morpheus#482
Forward-merge branch-24.06 into branch-24.10
…morpheus#485)

* Invoke `morpheus_utils_initialize_install_prefix` function after calling `project`
* Related to nv-morpheus/Morpheus#1776

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#485
…morpheus#493)

* When a Python generator source yields a value, and the subscriber is no longer subscribed, stop the source.
* Fix out of date docstring comment.

This is a partial fix for nv-morpheus/Morpheus#1838

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Anuradha Karuppiah (https://github.com/AnuradhaKaruppiah)

URL: nv-morpheus#493
…-morpheus#496)

* Allows a Python generator source to check if the subscriber is still subscribed.
* Define a class `SubscriberFuncWrapper`  for Python sources rather than just a lambda. The reason is that python objects captured by the lambda need to be destroyed while the gil is held, which causes a problem if the lambda is destroyed unexpectedly.
* Update `conftest.py` to set the loglevel to `DEBUG` if the `GLOG_v` environment variable is defined.

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#496
…heus#497)

* Since CPU-only mode will become a supported feature we want to avoid unnecessary warnings.

Relates to nv-morpheus/Morpheus#1851

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#497
…iber` (nv-morpheus#499)

* Remove the `make_source_subscriber` method in favor of inspecting the Python function signature.
* Since the `make_source_subscriber` method was never part of a release I think this can still be considered a non-breaking change.

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: nv-morpheus#499
Copy link

copy-pr-bot bot commented Oct 6, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request non-breaking Non-breaking change
Projects
Status: Review - Approved
Development

Successfully merging this pull request may close these issues.

8 participants