improv.nexus#

Module Contents#

Classes#

Nexus

Main server class for handling objects in improv

Attributes#

logger

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

loadConfig(file)[source]#

Load configuration file. file: a YAML configuration file name

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

start()[source]#

Start all the processes in Nexus

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:
async remote_input()[source]#
processGuiSignal(flag, name)[source]#

Receive flags from the Front End as user input

processActorSignal(sig, name)[source]#
setup()[source]#
run()[source]#
quit()[source]#
stop()[source]#
revive()[source]#
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:
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

createConnections()[source]#

Assemble links (multi or other) for later assignment

Function to set up Links between actors for data location passing Actor must already be instantiated

#NOTE: Could use this for reassigning links if actors crash?

#TODO: Adjust to use default q_out and q_in vs being specified

startWatcher()[source]#