Specialized Python implementation of a ucxx::Notifier
.
More...
#include <notifier.h>
Public Member Functions | |
Notifier (const Notifier &)=delete | |
Notifier & | operator= (Notifier const &)=delete |
Notifier (Notifier &&o)=delete | |
Notifier & | operator= (Notifier &&o)=delete |
virtual | ~Notifier () |
Virtual destructor. More... | |
void | scheduleFutureNotify (std::shared_ptr<::ucxx::Future > future, ucs_status_t status) override |
Schedule event loop notification of completed Python future. More... | |
RequestNotifierWaitState | waitRequestNotifier (uint64_t period) override |
Wait for a new event with a timeout in nanoseconds. More... | |
void | runRequestNotifier () override |
Notify event loop of all pending completed Python futures. More... | |
void | stopRequestNotifierThread () override |
Make known to the notifier thread that it should stop. More... | |
bool | isRunning () const override |
Returns whether the thread is running. More... | |
![]() | |
Notifier (const Notifier &)=delete | |
Notifier & | operator= (Notifier const &)=delete |
Notifier (Notifier &&o)=delete | |
Notifier & | operator= (Notifier &&o)=delete |
virtual void | scheduleFutureNotify (std::shared_ptr< Future > future, ucs_status_t status)=0 |
Schedule notification of completed future. More... | |
Friends | |
std::shared_ptr<::ucxx::Notifier > | createNotifier () |
Constructor of shared_ptr<ucxx::python::Notifier> . More... | |
Specialized Python implementation of a ucxx::Notifier
.
Specialized Python implementation of a ucxx::Notifier
, providing support for notifying Python futures.
|
virtual |
Virtual destructor.
Virtual destructor with empty implementation.
Reimplemented from ucxx::Notifier.
|
overridevirtual |
Returns whether the thread is running.
Implements ucxx::Notifier.
|
overridevirtual |
Notify event loop of all pending completed Python futures.
This method will notify the Python asyncio event loop of all pending completed futures. Notifying the event loop requires taking the Python GIL, thus it cannot run indefinitely but must instead run periodically. Futures that completed must first be scheduled with scheduleFutureNotify()
.
Implements ucxx::Notifier.
|
override |
Schedule event loop notification of completed Python future.
Schedule the notification of the event loop of a completed Python future, but does not notify the event loop yet, which is later done by runRequestNotifier()
. Because this call does not notify the Python asyncio event loop, it does not require the GIL to execute.
This is meant to be called from ucxx::python::Future::notify()
.
[in] | future | Python future to notify. |
[in] | status | the request completion status. |
|
overridevirtual |
Make known to the notifier thread that it should stop.
Often called when the application is shutting down, make known to the notifier thread that it should stop and exit.
Implements ucxx::Notifier.
|
overridevirtual |
Wait for a new event with a timeout in nanoseconds.
Block while waiting for an event (new future to be notified or stop signal) with added timeout in nanoseconds to unblock after a that period if no event has occurred. A period of zero means this call will never unblock until an event occurs.
WARNING: Be cautious using a period of zero, if no event ever occurs it will be impossible to continue the thread.
[in] | period | the time in nanoseconds to wait for an event before unblocking. |
Implements ucxx::Notifier.
|
friend |
Constructor of shared_ptr<ucxx::python::Notifier>
.
The constructor for a shared_ptr<ucxx::python::Notifier>
object. The default constructor is made private to ensure all UCXX objects are shared pointers for correct lifetime management.
The notifier should run on its own Python thread, but need to have the same asyncio event loop set as the application thread. By running a notifier on its own thread the application thread can be decoupled from the overhead of allowing the UCX worker to progress on the same thread as the application to be able to notify each future, as removing the requirement for the GIL at any time by the UCX backend.
shared_ptr<ucxx::python::Notifier>
object