The interface to a cluster created and managed by the node manager. More...
#include <inode_manager.h>
Public Types | |
enum | Cluster_status { CLUSTER_ESTABLISHED = 0 , CLUSTER_SHUTDOWN = 1 , CLUSTER_FAILURE = 2 , CLUSTER_FORCE_32_BIT = 0xffffffffU } |
Possible cluster states. More... | |
Public Types inherited from mi::base::Interface_declare< 0x0a58b727, ... > | |
typedef Interface_declare< id1, ... > | Self |
Own type. More... | |
typedef Uuid_t< id1, ... > | IID |
Declares the interface ID (IID) of this interface. More... | |
Public Types inherited from mi::base::IInterface | |
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> | IID |
Declares the interface ID (IID) of this interface. More... | |
Public Member Functions | |
virtual const ICluster_descriptor * | get_cluster_descriptor () const =0 |
Returns the cluster descriptor for the cluster. More... | |
virtual Cluster_status | get_cluster_status () const =0 |
Returns the status of the cluster. More... | |
virtual void | set_timeout (Float64 timeout)=0 |
Sets the keep-alive timeout for the cluster. More... | |
virtual Sint32 | set_cluster_property (const char *name, const char *value)=0 |
Sets a cluster property. More... | |
virtual Sint32 | remove_cluster_property (const char *name)=0 |
Removes a cluster property. More... | |
virtual Sint32 | start_worker_program (const char *program_name, const char *argument_string, Uint32 child_process_timeout=0)=0 |
Starts a worker program if none has been started when the cluster has been created. More... | |
virtual Sint32 | shutdown_worker_program ()=0 |
Shuts down the program that was started on all worker nodes when the cluster was created. More... | |
virtual Sint32 | restart_worker_program ()=0 |
Restarts the program that is supposed to run on all workers. More... | |
virtual void | shutdown ()=0 |
Initiates the shutdown of the cluster. More... | |
virtual IWorker_node_descriptor * | get_head_node ()=0 |
Returns the head node. More... | |
virtual void | add_worker_property_callback (IWorker_node_property_callback *callback)=0 |
Adds a callback to be called when a property of a worker node changes. More... | |
virtual void | remove_worker_property_callback (IWorker_node_property_callback *callback)=0 |
Removes a previously added callback for property changes of worker nodes. More... | |
virtual void | add_cluster_property_callback (ICluster_property_callback *callback)=0 |
Adds a callback to be called when a cluster property changes. More... | |
virtual void | remove_cluster_property_callback (ICluster_property_callback *callback)=0 |
Removes a previously added callback for cluster property changes. More... | |
virtual void | add_worker_node_callback (IWorker_node_callback *callback)=0 |
Adds a callback to be called when a worker node joins or leaves the cluster. More... | |
virtual void | remove_worker_node_callback (IWorker_node_callback *callback)=0 |
Removes a previously added callback for joined or left worker nodes. More... | |
virtual void | add_client_node_callback (IClient_node_callback *callback)=0 |
Adds a callback to be called when a client joins or leaves the cluster. More... | |
virtual void | remove_client_node_callback (IClient_node_callback *callback)=0 |
Removes a previously added callback for joined or left client nodes. More... | |
virtual void | add_head_node_callback (IHead_node_callback *callback)=0 |
Adds a callback to be called when a new node becomes head node. More... | |
virtual void | remove_head_node_callback (IHead_node_callback *callback)=0 |
Removes a previously added callback for notification about a new head node. More... | |
virtual const IWorker_node_descriptor * | grow ()=0 |
Grows the cluster by one node, if a worker node is available. More... | |
virtual Sint32 | shrink (const IWorker_node_descriptor *remove_node)=0 |
Shrinks the cluster by one node. More... | |
Public Member Functions inherited from mi::base::IInterface | |
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... | |
Additional Inherited Members | |
Static Public Member Functions inherited from mi::base::Interface_declare< 0x0a58b727, ... > | |
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 Public Member Functions inherited from mi::base::IInterface | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface. More... | |
The interface to a cluster created and managed by the node manager.
As long as an application holds this interface, the application will be part of the cluster. Releasing the last handle to this interface gives up cluster membership. When that happens, the node manager will check if there are no more clients. If there are still clients, the cluster will be kept alive. If there are none, then the optional timeout will be started. After the timeout elapsed without another client joining, or immediately if there is no timeout, the cluster will be shut down.
Possible cluster states.
Enumerator | |
---|---|
CLUSTER_ESTABLISHED | The cluster has been successfully established. |
CLUSTER_SHUTDOWN | The cluster has been shutdown. |
CLUSTER_FAILURE | The cluster has failed for unspecified reasons. |
|
pure virtual |
Adds a callback to be called when a client joins or leaves the cluster.
Note that when adding a callback, it will be called automatically for all client nodes already in the cluster.
callback | The callback to be added. |
|
pure virtual |
Adds a callback to be called when a cluster property changes.
When adding a callback it will be called immediately once. The cluster descriptor will contain all cluster properties known at this point.
callback | The callback to be added. |
|
pure virtual |
Adds a callback to be called when a new node becomes head node.
When adding a callback, it will be called immediately once.
callback | The callback to be added. |
|
pure virtual |
Adds a callback to be called when a worker node joins or leaves the cluster.
Note that when adding a callback, it will be called automatically for all worker nodes already in the cluster.
callback | The callback to be added. |
|
pure virtual |
Adds a callback to be called when a property of a worker node changes.
When adding a callback it will be called immediately once for all worker nodes existing at this point. The descriptor contains all properties for the worker node known at this point.
callback | The callback to be added. |
|
pure virtual |
Returns the cluster descriptor for the cluster.
|
pure virtual |
Returns the status of the cluster.
|
pure virtual |
Returns the head node.
The head node is a cluster member flagged by the node manager for applications that need support for a head node. It can be referenced by a placeholder substring in the argument string passed to mi::neuraylib::INode_manager_client::join_or_create_cluster().
NULL
if no head node has been flagged.
|
pure virtual |
Grows the cluster by one node, if a worker node is available.
The new node will be added to the cluster by starting a worker process on that node using the worker_node_filter, program_name, argument_string and child_process_timeout parameters passed to mi::neuraylib;;INode_manager_client::join_or_create_cluster() to create the cluster.
NULL
if no worker node was available.
|
pure virtual |
Removes a previously added callback for joined or left client nodes.
callback | The callback to be removed. |
|
pure virtual |
Removes a cluster property.
This change will be forwarded immediately to all clients.
name | The name of the property to remove. |
NULL
pointer).
|
pure virtual |
Removes a previously added callback for cluster property changes.
callback | The callback to be removed. |
|
pure virtual |
Removes a previously added callback for notification about a new head node.
callback | The callback to be removed. |
|
pure virtual |
Removes a previously added callback for joined or left worker nodes.
callback | The callback to be removed. |
|
pure virtual |
Removes a previously added callback for property changes of worker nodes.
callback | The callback to be removed. |
|
pure virtual |
Restarts the program that is supposed to run on all workers.
The program command line used will be the same that was passed to mi::neuraylib::INode_manager_client::join_or_create_cluster() when the cluster was created.
|
pure virtual |
Sets a cluster property.
This change will be forwarded immediately to all clients.
name | The name of the property to set. |
value | The value string to be set for the property. |
NULL
pointers).
|
pure virtual |
Sets the keep-alive timeout for the cluster.
The keep-alive timeout specifies the amount of time (in seconds) the cluster will remain operational after the last client left the cluster. If no timeout is set, the value defaults to 0, meaning the cluster will be shut down as soon as the last connected client disconnects.
|
pure virtual |
Shrinks the cluster by one node.
remove_node | The descriptor of the node that is supposed to be removed from the cluster. |
NULL
pointer).
|
pure virtual |
Initiates the shutdown of the cluster.
This method shuts down the cluster unconditionally, independent of the keep-alive timeout or the number of client nodes using the cluster.
|
pure virtual |
Shuts down the program that was started on all worker nodes when the cluster was created.
The cluster with all worker nodes is retained. This call will usually be followed by a call to restart_worker_program().
|
pure virtual |
Starts a worker program if none has been started when the cluster has been created.
The method is to be used if program_name
in mi::neuraylib::INode_manager_client::join_or_create_cluster() was NULL
.
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. |