improv.nexus
#
Module Contents#
Classes#
Main server class for handling objects in improv |
Attributes#
- improv.nexus.logger#
- class improv.nexus.Nexus(name='Server')[source]#
Main server class for handling objects in improv
- createNexus(file=None, use_hdd=False, use_watcher=None, store_size=10000000, control_port=0, output_port=0)[source]#
Function to initialize class variables based on config file.
Starts a store of class Limbo, and then loads the config file. The config file specifies the specific actors that nexus will be connected to, as well as their links.
- Parameters:
file (string) – Name of the config file.
use_hdd (bool) – Whether to use hdd for the store.
use_watcher (bool) – Whether to use watcher for the store.
store_size (int) – initial store size
control_port (int) – port number for input socket
output_port (int) – port number for output socket
- Returns:
“Shutting down”, to notify start() that pollQueues has completed.
- Return type:
string
- initConfig()[source]#
For each connection: create a Link with a name (purpose), start, and end Start links to one actor’s name, end to the other. Nexus gives start_actor the Link as a q_in, and end_actor the Link as a q_out. Nexus maintains dict of name and associated Link. Nexus also has list of Links that it is itself connected to for communication purposes.
OR For each connection, create 2 Links. Nexus acts as intermediary.
- Parameters:
file (string) – input config filepath
- startNexus()[source]#
Puts all actors in separate processes and begins polling to listen to comm queues
- destroyNexus()[source]#
Method that calls the internal method to kill the process running the store (plasma server)
- async pollQueues()[source]#
Listens to links and processes their signals.
For every communications queue connected to Nexus, a task is created that gets from the queue. Throughout runtime, when these queues output a signal, they are processed by other functions. At the end of runtime (when the gui has been closed), polling is stopped.
- Returns:
“Shutting down”, Notifies start() that pollQueues has completed.
- Return type:
string
- stop_polling_and_quit(signal, queues)[source]#
quit the process and stop polling signals from queues
- Parameters:
() (signal) – Signal for signal handler.
queues (improv.link.AsyncQueue) – Comm queues for links.
- stop_polling(stop_signal, queues)[source]#
Cancels outstanding tasks and fills their last request.
Puts a string into all active queues, then cancels their corresponding tasks. These tasks are not fully cancelled until the next run of the event loop.
- Parameters:
() (stop_signal) – Signal for signal handler.
queues (improv.link.AsyncQueue) – Comm queues for links.
- createStoreInterface(name)[source]#
Creates StoreInterface w/ or w/out LMDB functionality based on {self.use_hdd}.
- createActor(name, actor)[source]#
Function to instantiate actor, add signal and comm Links, and update self.actors dictionary
- Parameters:
name – name of the actor
actor – improv.actor.Actor
- runActor(actor)[source]#
Run the actor continually; used for separate processes #TODO: hook into monitoring here?
- Parameters:
actor –