improv.actor#

Module Contents#

Classes#

AbstractActor

Base class for an actor that Nexus

ManagedActor

Base class for an actor that Nexus

AsyncActor

Base class for an actor that Nexus

RunManager

AsyncRunManager

Asynchronous run manager. Communicates with nexus core using q_sig and q_comm.

Signal

Class containing definition of signals Nexus uses

Attributes#

logger

Actor

improv.actor.logger#
class improv.actor.AbstractActor(name, store_loc, method='fork')[source]#

Base class for an actor that Nexus controls and interacts with. Needs to have a store and links for communication Also needs to be responsive to sent Signals (e.g. run, setup, etc)

setStoreInterface(client)[source]#

Sets the client interface to the store

Parameters:

client (improv.store.StoreInterface) – Set client interface to the store

General full dict set for links

Parameters:

links (dict) – The dict to store all the links

Set explicit communication links to/from Nexus (q_comm, q_sig)

Parameters:
  • q_comm (improv.nexus.Link) – for messages from this actor to Nexus

  • q_sig (improv.nexus.Link) – signals from Nexus and must be checked first

setLinkIn(q_in)[source]#

Set the dedicated input queue

Parameters:

q_in (improv.nexus.Link) – for input signals to this actor

setLinkOut(q_out)[source]#

Set the dedicated output queue

Parameters:

q_out (improv.nexus.Link) – for output signals from this actor

setLinkWatch(q_watch)[source]#

Set the dedicated watchout queue

Parameters:

q_watch (improv.nexus.Link) – watchout queue

Function provided to add additional data links by name using same form as q_in or q_out Must be done during registration and not during run

Parameters:
  • name (string) – customized link name

  • link (improv.nexus.Link) – customized data link

Returns dictionary of links for the current actor

Returns:

dictionary of links

Return type:

dict

put(idnames, q_out=None, save=None)[source]#

TODO: This is deprecated? Prefer using Links explicitly

setup()[source]#

Essenitally the registration process Can also be an initialization for the actor options is a list of options, can be empty

abstract run()[source]#

Must run in continuous mode Also must check q_sig either at top of a run-loop or as async with the primary function

Suggested implementation for synchronous running: see RunManager class below

stop()[source]#

Specify method for momentarily stopping the run and saving data. Not used by default

changePriority()[source]#

Try to lower this process’ priority Only changes priority if lower_priority is set TODO: Only works on unix machines. Add Windows functionality

class improv.actor.ManagedActor(*args, **kwargs)[source]#

Bases: AbstractActor

Base class for an actor that Nexus controls and interacts with. Needs to have a store and links for communication Also needs to be responsive to sent Signals (e.g. run, setup, etc)

run()[source]#

Must run in continuous mode Also must check q_sig either at top of a run-loop or as async with the primary function

Suggested implementation for synchronous running: see RunManager class below

abstract runStep()[source]#
class improv.actor.AsyncActor(*args, **kwargs)[source]#

Bases: AbstractActor

Base class for an actor that Nexus controls and interacts with. Needs to have a store and links for communication Also needs to be responsive to sent Signals (e.g. run, setup, etc)

run()[source]#

Run the actor in an async loop

async setup()[source]#

Essenitally the registration process Can also be an initialization for the actor options is a list of options, can be empty

abstract async runStep()[source]#
async stop()[source]#
improv.actor.Actor#
class improv.actor.RunManager(name, actions, links, runStoreInterface=None, timeout=1e-06)[source]#
class improv.actor.AsyncRunManager(name, actions, links, runStore=None, timeout=1e-06)[source]#

Asynchronous run manager. Communicates with nexus core using q_sig and q_comm. To be used with [async with] Afterwards, the run manager listens for signals without blocking.

async run_actor()[source]#
class improv.actor.Signal[source]#

Class containing definition of signals Nexus uses to communicate with its actors TODO: doc each of these with expected handling behavior

static run()[source]#
static quit()[source]#
static pause()[source]#
static resume()[source]#
static reset()[source]#
static load()[source]#
static setup()[source]#
static ready()[source]#
static kill()[source]#
static revive()[source]#
static stop()[source]#
static stop_success()[source]#