The node manager client allows to start or join DiCE clusters built from worker nodes.
More...
|
virtual Sint32 | start (const char *listen_address, bool tcp=false, const char *discovery_address=0, const char *cluster_interface=0)=0 |
| Starts the operation of the node manager. More...
|
|
virtual Sint32 | shutdown ()=0 |
| Shuts down the operation of the node manager. More...
|
|
virtual const IString * | get_listen_address () const =0 |
| Returns the listen address used by the node manager. More...
|
|
virtual Sint32 | set_multicast_base_address (const char *base_address)=0 |
| Sets the multicast base address. More...
|
|
virtual const IString * | get_multicast_base_address () const =0 |
| Returns the multicast base address. More...
|
|
virtual Size | get_number_of_worker_nodes () const =0 |
| Returns the number of worker nodes currently known to the node manager. More...
|
|
virtual const IWorker_node_descriptor * | get_worker_node (Size index) const =0 |
| Returns a descriptor for a worker node currently known to the node manager. More...
|
|
virtual void | add_shutdown_node_managers_callback (IShutdown_node_managers_callback *callback)=0 |
| Adds a callback to be called when a request to shutdown all clients and workers is received. More...
|
|
virtual void | remove_shutdown_node_managers_callback (IShutdown_node_managers_callback *callback)=0 |
| Removes a previously added callback to be called when a request to shutdown all clients and workers is received. More...
|
|
virtual void | add_shutdown_cluster_callback (IShutdown_cluster_callback *callback)=0 |
| Adds a callback to be called when a request to shutdown a cluster is received. More...
|
|
virtual void | remove_shutdown_cluster_callback (IShutdown_cluster_callback *callback)=0 |
| Removes a previously added callback to be called when a request to shutdown a cluster is received. More...
|
|
virtual void | add_worker_process_started_callback (IWorker_process_started_callback *callback)=0 |
| Adds a callback to be called when a worker process has been fully started. More...
|
|
virtual void | remove_worker_process_started_callback (IWorker_process_started_callback *callback)=0 |
| Removed a callback to be called when a worker process has been fully started. More...
|
|
virtual Sint32 | shutdown_cluster (const ICluster_descriptor *cluster_descriptor)=0 |
| Unconditionally shut down the cluster that cluster_descriptor refers to and release reserved worker nodes. More...
|
|
virtual INode_manager_cluster * | join_or_create_cluster (Size min_number_of_requested_worker_nodes, Size max_number_of_requested_worker_nodes, ICluster_filter *cluster_filter, IWorker_node_filter *worker_node_filter, const char *program_name, const char *argument_string, bool reusable=false, Uint32 child_process_timeout=0)=0 |
| Joins an existing cluster or creates a new one. More...
|
|
virtual Size | get_number_of_clusters () const =0 |
| Returns the number of existing clusters. More...
|
|
virtual const ICluster_descriptor * | get_cluster (Size index) const =0 |
| Returns a descriptor for a cluster. More...
|
|
virtual void | shutdown_node_managers ()=0 |
| Shuts down all node manager clients and workers which are currently joined. More...
|
|
virtual void | set_head_node_interface (const char *address)=0 |
| Set the head node address and subnet qualifier. More...
|
|
virtual const IString * | get_head_node_interface ()=0 |
| Get the head node address and subnet qualifier. More...
|
|
virtual Uint32 | retain () const =0 |
| Increments the reference count. More...
|
|
virtual Uint32 | release () const =0 |
| Decrements the reference count. More...
|
|
virtual const IInterface * | get_interface (const Uuid &interface_id) const =0 |
| Acquires a const interface from another. More...
|
|
template<class T> |
const T * | get_interface () const |
| Acquires a const interface from another. More...
|
|
virtual IInterface * | get_interface (const Uuid &interface_id)=0 |
| Acquires a mutable interface from another. More...
|
|
template<class T> |
T * | get_interface () |
| Acquires a mutable interface from another. More...
|
|
virtual Uuid | get_iid () const =0 |
| Returns the interface ID of the most derived interface. More...
|
|
|
typedef Interface_declare< id1, ... > | Self |
| Own type. More...
|
|
typedef Uuid_t< id1, ... > | IID |
| Declares the interface ID (IID) of this interface. More...
|
|
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> | IID |
| Declares the interface ID (IID) of this interface. More...
|
|
static bool | compare_iid (const Uuid &iid) |
| Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
|
|
static bool | compare_iid (const Uuid &iid) |
| Compares the interface ID iid against the interface ID of this interface. More...
|
|
The node manager client allows to start or join DiCE clusters built from worker nodes.
It should be used in a process running on a client node.
virtual INode_manager_cluster * mi::neuraylib::INode_manager_client::join_or_create_cluster |
( |
Size |
min_number_of_requested_worker_nodes, |
|
|
Size |
max_number_of_requested_worker_nodes, |
|
|
ICluster_filter * |
cluster_filter, |
|
|
IWorker_node_filter * |
worker_node_filter, |
|
|
const char * |
program_name, |
|
|
const char * |
argument_string, |
|
|
bool |
reusable = false , |
|
|
Uint32 |
child_process_timeout = 0 |
|
) |
| |
|
pure virtual |
Joins an existing cluster or creates a new one.
This function will do the following:
- For all existing clusters:
- Check if the cluster size matches the minimum and maximum number of requested worker nodes.
- Check if the program name and argument string of the cluster nodes match the values given in
program_name
and argument_string
.
- Check if calling the
cluster_filter
callback returns true
.
- If all above conditions are met, the calling node joins the existing cluster as a new client node. An interface describing the existing cluster is returned. The function terminates.
- If no matching cluster was found, then for all existing worker nodes:
- Check if
worker_node_filter
returns true
, if yes reserve the worker node. Leave the loop if the number of reserved worker nodes meets the maximum number of requested nodes.
- If at least the minimum number of requested worker nodes have been reserved, create the cluster, and an interface describing the newly created cluster is returned.
- Otherwise, the reservation of worker nodes is released, and
NULL
is returned.
If the flag child_process_watchdog
is set to true
, the child process started on worker nodes will be under closer scrutiny by the node manager. The node manager will substitute any occurrence of the placeholder w in the command line used to start the child process with the string identifier of the named pipe the child process is supposed to write to. The child process may open the pipe for writing and may write PDUs from the watchdog protocol to it. The watchdog is activated, once the first PDU has been written to the pipe. The child process needs to keep writing PDUs in intervals of n seconds from that moment on or the node manager will give up on the child process and will terminate it.
- Parameters
-
min_number_of_requested_worker_nodes | The minimum number of worker nodes expected in the cluster. |
max_number_of_requested_worker_nodes | The maximum number of worker nodes expected in the cluster. |
cluster_filter | A filter specifying required cluster properties. If NULL , no existing cluster will be joined. |
worker_node_filter | A filter specifying required worker node properties. If NULL , no cluster will be created. The filter will be used again when calling mi::neuraylib::INode_manager_cluster::grow() to add nodes to the cluster later on. |
program_name | The name of the program to run on the worker nodes. If NULL , a cluster is created without child processes being forked by the worker nodes. |
argument_string | Arguments to program_name . The string may include the substring %m which will be replaced by the multicast address of the cluster (use %% to escape percent signs). It may also contain the substring %h which will be expanded into the head node, a node marked within the cluster for applications that need support for it. The %H substring will be expanded to 1 on the head node, to 0 on all other hosts. The %n substring will be expanded to the number of nodes in the cluster. If the child_process_timeout parameter is defined, the command line also needs to contain the substrings %w, which will be substituted with the name of the named pipe and %t which will be replaced with the timeout value. If a substring of the format %p:property is included, it will be expanded to the value for the property set by the worker. Please note that adding %p placeholders dismisses nodes during recruitment that do not have the assigned property set. |
child_process_timeout | A parameter indicating whether there should be a watchdog controlling the child process on worker nodes. The value specifies the timeout in seconds after which the node manager assumes the child process is hanging. It needs to be >= 5 seconds. This parameter only has an effect when creating new clusters. If it is defined, the argument_string parameter needs to contain the substrings %w and %t. |
reusable | A flag indicating whether it should be allowed to start a different child process application after having shut down the application that was run in the cluster first. Clusters flagged 'reusable' can't be joined by more than one client. This flag is only useful if new child processes are supposed to be started using mi::neuraylib::INode_manager_cluster::start_worker_program(). |
- Returns
- An interface to the joined or created cluster, or
NULL
in case of failure.