-
Notifications
You must be signed in to change notification settings - Fork 28
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 maximum simultaneous tasks support to TaskContainer
#464
Add maximum simultaneous tasks support to TaskContainer
#464
Conversation
… possible, and as pybind11::object otherwise (nv-morpheus#455) * Add an optional `unserializable_handler_fn` callback to `mrc::pymrc::cast_from_pyobject` which will be invoked for any unsupported Python object. Allowing for serializing unsupported object. ex: ```cpp pymrc::unserializable_handler_fn_t handler_fn = [](const py::object& source, const std::string& path) { return nlohmann::json(py::cast<float>(source)); }; // decimal.Decimal is not serializable py::object Decimal = py::module_::import("decimal").attr("Decimal"); py::object o = Decimal("1.0"); EXPECT_EQ(pymrc::cast_from_pyobject(o, handler_fn), nlohmann::json(1.0)); ``` * Add `JSONValues` container class which is an immutable container for holding Python values as `nlohmann::json` objects if possible, and as `pybind11::object` otherwise. The container can be copied and moved, but the underlying `nlohmann::json` object is immutable. * Updates `nlohmann_json` from 3.9 to 3.11 for `patch_inplace` method. * Incorporates ideas from @drobison00's PR nv-morpheus#417 with three key differences: 1. Changes to the `cast_from_pyobject` are opt-in when `unserializable_handler_fn` is provided, otherwise there is no behavior change to the method. 2. Unserializable objects are stored in `JSONValues` rather than a global cache. 3. Does not rely on parsing the place-holder values. This PR is related to nv-morpheus/Morpheus#1560 Authors: - David Gardner (https://github.com/dagardner-nv) - Devin Robison (https://github.com/drobison00) Approvers: - Michael Demoret (https://github.com/mdemoret-nv) URL: nv-morpheus#455
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a cleaner solution than I was expecting. Have a couple suggestions on cleaning up the TaskContainer implementation to make it more resilient to race conditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better with the try_start_next_task()
implementation. Just have the one question about m_size
. Approved. Can merge when CI is passing. Just want to understand how it works with one variable.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## branch-24.03 #464 +/- ##
================================================
+ Coverage 73.68% 73.98% +0.30%
================================================
Files 400 402 +2
Lines 14275 14411 +136
Branches 1113 1133 +20
================================================
+ Hits 10518 10662 +144
+ Misses 3757 3749 -8
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
/merge |
d64eaa5
into
nv-morpheus:branch-24.03
Description
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.Checklist