slacm.app module
Created on Sep 18, 2020
@author: esdev
- class slacm.app.App(arg, verbose, arg2)[source]
Bases:
objectClass representing an application. Instantiated by the main(), as a singleton. Constructs and runs the application on the current (‘root’) and on remote (‘peer’) nodes.
- MODE_PEER = 3
- MODE_ROOT = 2
- MODE_SIMPLE = 1
- broadcast_to_peers(msg)[source]
Broadcast a message from the root to all peers. :param msg: Message to broadcast
- build_package()[source]
Build a deployment package from the content of the application folder, where the model file is contained. :return tgz_file: the full path of the package file.
- collect_from_peers(arg=None)[source]
Collect an expected message from all peer nodes on the root node. :param arg: Expected message string
- get_comp_params(actor, component)[source]
Return the parameters specific to a component of an actor of the application.
- join()[source]
On a root node: execute a ‘join’ for all actors. On a peer node: wait for a ‘terminate’ message from the root, and then terminate
- recv_from_root(arg=None)[source]
Expect and receivee message from the root on a peer node. :param arg: Message expected
- send_to_root(msg)[source]
Send a message to the root from a peer node. :param msg: Message to send.
- setup()[source]
Execute the ‘setup’ and ‘finalize’ steps in application initialization. The same code runs on the root and the peer nodes, but execution is synchronized through messages. The expected sequence: (1) peers ready, (2) setup executed, (3) finalize executed.