system

The system layer brings together different process applications within a system definition, and provides various system runners for running a system.

definition

class eventsourcing.system.definition.System(*pipeline_exprs, **kwargs)[source]

Bases: object

A system object has a set of pipeline expressions, which involve process application classes. A system object can be run using a system runner.

__init__(*pipeline_exprs, **kwargs)[source]

Initialises a “process network” system object.

Each pipeline expression of process classes shows directly which process following which other process in the system.

For example, the pipeline expression (A | B | C) shows that B following A, and C following B.

The pipeline expression (A | A) shows that A following A.

The pipeline expression (A | B | A) shows that B following A, and A following B.

The pipeline expressions ((A | B | A), (A | C | A)) are equivalent to (A | B | A | C | A).

Parameters:pipeline_exprs – Pipeline expressions involving process application

classes.

construct_app(process_class: Type[TProcessApplication], infrastructure_class: Optional[Type[eventsourcing.application.simple.ApplicationWithConcreteInfrastructure]] = None, **kwargs) → TProcessApplication[source]

Constructs process application from given process_class.

__enter__() → eventsourcing.system.definition.AbstractSystemRunner[source]

Supports running a system object directly as a context manager.

The system is run with the SingleThreadedRunner.

__exit__(exc_type: Any, exc_val: Any, exc_tb: Any) → None[source]

Supports usage of a system object as a context manager.

bind(infrastructure_class: Type[eventsourcing.application.simple.ApplicationWithConcreteInfrastructure]) → TSystem[source]

Constructs a system object that has an infrastructure class from a system object constructed without infrastructure class.

Raises ProgrammingError if already have an infrastructure class.

Parameters:infrastructure_class
Returns:System object that has an infrastructure class.
Return type:System
class eventsourcing.system.definition.AbstractSystemRunner(system: eventsourcing.system.definition.System, infrastructure_class: Optional[Type[eventsourcing.application.simple.ApplicationWithConcreteInfrastructure]] = None, setup_tables: bool = False, use_direct_query_if_available: bool = False)[source]

Bases: abc.ABC

__init__(system: eventsourcing.system.definition.System, infrastructure_class: Optional[Type[eventsourcing.application.simple.ApplicationWithConcreteInfrastructure]] = None, setup_tables: bool = False, use_direct_query_if_available: bool = False)[source]

Initialize self. See help(type(self)) for accurate signature.

__enter__() → TSystemRunner[source]

Supports usage of a system runner as a context manager.

__exit__(exc_type: Any, exc_val: Any, exc_tb: Any) → None[source]

Supports usage of a system runner as a context manager.

start() → None[source]

Starts running the system.

Abstract method which must be implemented on concrete descendants.

close() → None[source]

Closes a running system.

runner

class eventsourcing.system.runner.InProcessRunner(system: eventsourcing.system.definition.System, infrastructure_class: Optional[Type[eventsourcing.application.simple.ApplicationWithConcreteInfrastructure]] = None, setup_tables: bool = False, use_direct_query_if_available: bool = False)[source]

Bases: eventsourcing.system.definition.AbstractSystemRunner

Runs a system in the current process, either in the current thread, or with one thread for each process in the system.

start() → None[source]

Starts running the system.

Abstract method which must be implemented on concrete descendants.

handle_prompt(prompt: eventsourcing.application.simple.Prompt) → None[source]

Handles publication of a prompt.

Abstract method which must be implemented on concrete descendants.

close() → None[source]

Closes a running system.

class eventsourcing.system.runner.SingleThreadedRunner(system: eventsourcing.system.definition.System, infrastructure_class: Optional[Type[eventsourcing.application.simple.ApplicationWithConcreteInfrastructure]] = None, **kwargs)[source]

Bases: eventsourcing.system.runner.InProcessRunner

Runs a system in the current thread.

__init__(system: eventsourcing.system.definition.System, infrastructure_class: Optional[Type[eventsourcing.application.simple.ApplicationWithConcreteInfrastructure]] = None, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

handle_prompt(prompt: eventsourcing.application.simple.Prompt) → None[source]

Handles publication of a prompt.

Abstract method which must be implemented on concrete descendants.

run_followers(prompt: eventsourcing.application.simple.Prompt) → None[source]

First caller adds a prompt to queue and runs followers until there are no more pending prompts.

Subsequent callers just add a prompt to the queue, avoiding recursion.

class eventsourcing.system.runner.MultiThreadedRunner(system: eventsourcing.system.definition.System, poll_interval: Optional[int] = None, clock_speed: Union[int, float, None] = None, **kwargs)[source]

Bases: eventsourcing.system.runner.InProcessRunner

Runs a system with a thread for each process.

__init__(system: eventsourcing.system.definition.System, poll_interval: Optional[int] = None, clock_speed: Union[int, float, None] = None, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

start() → None[source]

Starts running the system.

Abstract method which must be implemented on concrete descendants.

handle_prompt(prompt: eventsourcing.application.simple.Prompt) → None[source]

Handles publication of a prompt.

Abstract method which must be implemented on concrete descendants.

close() → None[source]

Closes a running system.

class eventsourcing.system.runner.PromptOutbox[source]

Bases: typing.Generic

Has a collection of downstream prompt inboxes.

__init__() → None[source]

Initialize self. See help(type(self)) for accurate signature.

put(prompt: Union[eventsourcing.application.simple.PromptToPull, str]) → None[source]

Puts prompt in each downstream inbox (an actual queue).

class eventsourcing.system.runner.PromptQueuedApplicationThread(*, process: eventsourcing.application.process.ProcessApplication, poll_interval: int = 5, inbox: queue.Queue, outbox: Optional[eventsourcing.system.runner.PromptOutbox], clock_event: Optional[threading.Event] = None)[source]

Bases: threading.Thread

Application thread which uses queues of prompts.

It loops on an “inbox” queue of prompts, and adds its prompts to an “outbox” queue.

__init__(*, process: eventsourcing.application.process.ProcessApplication, poll_interval: int = 5, inbox: queue.Queue, outbox: Optional[eventsourcing.system.runner.PromptOutbox], clock_event: Optional[threading.Event] = None)[source]

Initialises the thread with a process application object, and inbox and outbox.

Parameters:
  • process (ProcessApplication) – Application object.
  • poll_interval (int) – Interval to check for upstream events.
  • inbox (Queue) – For incoming prompts.
  • outbox (PromptOutbox) – For outgoing prompts.
  • clock_event – Event that “clocks” this thread (optional).
run() → None[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

class eventsourcing.system.runner.SteppingRunner(normal_speed: int = 1, scale_factor: int = 1, is_verbose: bool = False, *args, **kwargs)[source]

Bases: eventsourcing.system.runner.InProcessRunner

__init__(normal_speed: int = 1, scale_factor: int = 1, is_verbose: bool = False, *args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

class eventsourcing.system.runner.SteppingSingleThreadedRunner(*args, **kwargs)[source]

Bases: eventsourcing.system.runner.SteppingRunner

__init__(*args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

start() → None[source]

Starts running the system.

Abstract method which must be implemented on concrete descendants.

handle_prompt(prompt: eventsourcing.application.simple.Prompt) → None[source]

Ignores prompts.

close() → None[source]

Closes a running system.

class eventsourcing.system.runner.ClockThread(*args, **kwargs)[source]

Bases: threading.Thread

__init__(*args, **kwargs)[source]

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

class eventsourcing.system.runner.ProcessRunningClockThread(*, normal_speed: int, scale_factor: int, stop_event: threading.Event, is_verbose: bool = False, seen_prompt_events: Dict[str, threading.Event], processes: Dict[str, eventsourcing.application.process.ProcessApplication], use_direct_query_if_available: bool = False)[source]

Bases: eventsourcing.system.runner.ClockThread

__init__(*, normal_speed: int, scale_factor: int, stop_event: threading.Event, is_verbose: bool = False, seen_prompt_events: Dict[str, threading.Event], processes: Dict[str, eventsourcing.application.process.ProcessApplication], use_direct_query_if_available: bool = False)[source]

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

run() → None[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

class eventsourcing.system.runner.SteppingMultiThreadedRunner(*args, **kwargs)[source]

Bases: eventsourcing.system.runner.SteppingRunner

Has a clock thread, and a thread for each application process in the system. The clock thread loops until stopped, waiting for a barrier, after sleeping for remaining tick interval timer. Application threads loop until stopped, waiting for the same barrier. Then, after all threads are waiting at the barrier, the barrier is lifted. The clock thread proceeds by sleeping for the clock tick interval. The application threads proceed by getting new notifications and processing all of them.

There are actually two barriers, so that each application thread waits before getting notifications, and then waits for all processes to complete getting notification before processing the notifications through the application policy. This avoids events created by a process application “bleeding” into the notifications of another process application in the same clock cycle.

Todo: Receive prompts, but set an event for the prompting process, to avoid unnecessary runs.

Allow commands to be scheduled at future clock tick number, and execute when reached.

__init__(*args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

handle_prompt(prompt: eventsourcing.application.simple.Prompt) → None[source]

Handles publication of a prompt.

Abstract method which must be implemented on concrete descendants.

start() → None[source]

Starts running the system.

Abstract method which must be implemented on concrete descendants.

close() → None[source]

Closes a running system.

class eventsourcing.system.runner.BarrierControlledApplicationThread(process: eventsourcing.application.process.ProcessApplication, fetch_barrier: threading.Barrier, execute_barrier: threading.Barrier, stop_event: threading.Event)[source]

Bases: threading.Thread

__init__(process: eventsourcing.application.process.ProcessApplication, fetch_barrier: threading.Barrier, execute_barrier: threading.Barrier, stop_event: threading.Event)[source]

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

run() → None[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

class eventsourcing.system.runner.BarrierControllingClockThread(normal_speed: int, scale_factor: int, tick_interval: Union[int, float, None], fetch_barrier: threading.Barrier, execute_barrier: threading.Barrier, stop_event: threading.Event, is_verbose: bool = False)[source]

Bases: eventsourcing.system.runner.ClockThread

__init__(normal_speed: int, scale_factor: int, tick_interval: Union[int, float, None], fetch_barrier: threading.Barrier, execute_barrier: threading.Barrier, stop_event: threading.Event, is_verbose: bool = False)[source]

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

run() → None[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

multiprocess

class eventsourcing.system.multiprocess.MultiprocessRunner(system: eventsourcing.system.definition.System, pipeline_ids: Sequence[int] = (0, ), poll_interval: Optional[int] = None, setup_tables: bool = False, sleep_for_setup_tables: int = 0, **kwargs)[source]

Bases: eventsourcing.system.definition.AbstractSystemRunner

__init__(system: eventsourcing.system.definition.System, pipeline_ids: Sequence[int] = (0, ), poll_interval: Optional[int] = None, setup_tables: bool = False, sleep_for_setup_tables: int = 0, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

start() → None[source]

Starts running the system.

Abstract method which must be implemented on concrete descendants.

close() → None[source]

Closes a running system.

class eventsourcing.system.multiprocess.OperatingSystemProcess(application_process_class: Type[eventsourcing.application.process.ProcessApplication], infrastructure_class: Type[eventsourcing.application.simple.ApplicationWithConcreteInfrastructure], upstream_names: List[str], inbox: queue.Queue, outbox: Optional[eventsourcing.system.runner.PromptOutbox[typing.Tuple[int, str]][Tuple[int, str]]] = None, pipeline_id: int = 0, poll_interval: int = 5, setup_tables: bool = False, *args, **kwargs)[source]

Bases: multiprocessing.context.Process

__init__(application_process_class: Type[eventsourcing.application.process.ProcessApplication], infrastructure_class: Type[eventsourcing.application.simple.ApplicationWithConcreteInfrastructure], upstream_names: List[str], inbox: queue.Queue, outbox: Optional[eventsourcing.system.runner.PromptOutbox[typing.Tuple[int, str]][Tuple[int, str]]] = None, pipeline_id: int = 0, poll_interval: int = 5, setup_tables: bool = False, *args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

run() → None[source]

Method to be run in sub-process; can be overridden in sub-class

grpc

class eventsourcing.system.grpc.runner.GrpcRunner(*args, pipeline_ids=(0, ), push_prompt_interval=0.25, **kwargs)[source]

Bases: eventsourcing.system.definition.AbstractSystemRunner

System runner that uses gRPC to communicate between process applications.

__init__(*args, pipeline_ids=(0, ), push_prompt_interval=0.25, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

generate_ports(start: int)[source]

Generator that yields a sequence of ports from given start number.

create_address()[source]

Creates a new address for a gRPC server.

start()[source]

Starts running a system of process applications.

start_processor(application_topic, pipeline_id, infrastructure_topic, setup_table, address, upstreams, downstreams)[source]

Starts a gRPC process.

close() → None[source]

Stops all gRPC processes started by the runner.

stop_process(process)[source]

Stops given gRPC process.

kill_process(process)[source]

Kills given gRPC process, if it still running.

listen(name, processor_clients)[source]

Constructs a listener using the given clients.

class eventsourcing.system.grpc.runner.ClientWrapper(client: eventsourcing.system.grpc.processor.ProcessorClient)[source]

Bases: object

Wraps a gRPC client, and returns a MethodWrapper when attributes are accessed.

__init__(client: eventsourcing.system.grpc.processor.ProcessorClient)[source]

Initialize self. See help(type(self)) for accurate signature.

class eventsourcing.system.grpc.runner.MethodWrapper(client: eventsourcing.system.grpc.processor.ProcessorClient, method_name: str)[source]

Bases: object

Wraps a gRPC client, and invokes application method name when called.

__init__(client: eventsourcing.system.grpc.processor.ProcessorClient, method_name: str)[source]

Initialize self. See help(type(self)) for accurate signature.

__call__(*args, **kwargs)[source]

Call self as a function.

class eventsourcing.system.grpc.runner.ProcessorListener(name, address, clients: List[eventsourcing.system.grpc.processor.ProcessorClient])[source]

Bases: eventsourcing.system.grpc.processor_pb2_grpc.ProcessorServicer

Starts server and uses clients to request prompts from connected servers.

__init__(name, address, clients: List[eventsourcing.system.grpc.processor.ProcessorClient])[source]

Initialize self. See help(type(self)) for accurate signature.

serve()[source]

Starts server.

Ping(request, context)[source]

Missing associated documentation comment in .proto file

Prompt(request, context)[source]

Missing associated documentation comment in .proto file

prompt(upstream_name)[source]

Sets prompt events for given upstream process.

class eventsourcing.system.grpc.processor.NotificationLogView(notification_log: eventsourcing.application.notificationlog.LocalNotificationLog, json_encoder: eventsourcing.utils.transcoding.ObjectJSONEncoder)[source]

Bases: object

Presents sections of notification log for gRPC server.

__init__(notification_log: eventsourcing.application.notificationlog.LocalNotificationLog, json_encoder: eventsourcing.utils.transcoding.ObjectJSONEncoder)[source]

Initialize self. See help(type(self)) for accurate signature.

class eventsourcing.system.grpc.processor.StartClient(clients, name, address)[source]

Bases: threading.Thread

Thread that creates a gRPC client and connects to a gRPC server.

__init__(clients, name, address)[source]

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

run()[source]

Creates client and connects to address.

class eventsourcing.system.grpc.processor.PullNotifications(prompt_event: threading.Event, reader: eventsourcing.application.notificationlog.NotificationLogReader, process_application: eventsourcing.application.process.ProcessApplication, event_queue: queue.Queue, upstream_name: str, has_been_stopped: threading.Event)[source]

Bases: threading.Thread

Thread the pulls notifications from upstream process application.

__init__(prompt_event: threading.Event, reader: eventsourcing.application.notificationlog.NotificationLogReader, process_application: eventsourcing.application.process.ProcessApplication, event_queue: queue.Queue, upstream_name: str, has_been_stopped: threading.Event)[source]

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

run() → None[source]

Loops over waiting for prompt event to be set, reads event notifications from reader, gets domain events from notifications, and puts domain events on the queue of unprocessed events.

set_reader_position()[source]

Sets reader position from recorded position.

class eventsourcing.system.grpc.processor.RemoteNotificationLog(client: eventsourcing.system.grpc.processor.ProcessorClient, json_decoder: eventsourcing.utils.transcoding.ObjectJSONDecoder, section_size: int)[source]

Bases: eventsourcing.application.notificationlog.AbstractNotificationLog

Notification log that get notification log sections using gRPC client.

__init__(client: eventsourcing.system.grpc.processor.ProcessorClient, json_decoder: eventsourcing.utils.transcoding.ObjectJSONDecoder, section_size: int)[source]

Initialize self. See help(type(self)) for accurate signature.

section_size

Size of section of notification log.

__getitem__(section_id: str) → eventsourcing.application.notificationlog.Section[source]

Get section of notification log.

Parameters:section_id – ID of a section of the notification log.
class eventsourcing.system.grpc.processor.ProcessorServer(application_topic, pipeline_id, infrastructure_topic, setup_table, address, upstreams, downstreams, push_prompt_interval)[source]

Bases: eventsourcing.system.grpc.processor_pb2_grpc.ProcessorServicer

__init__(application_topic, pipeline_id, infrastructure_topic, setup_table, address, upstreams, downstreams, push_prompt_interval)[source]

Initialize self. See help(type(self)) for accurate signature.

serve()[source]

Starts gRPC server.

wait_for_termination()[source]

Runs until termination of process.

Ping(request, context)[source]

Missing associated documentation comment in .proto file

Lead(request, context)[source]

Missing associated documentation comment in .proto file

lead(downstream_name, downstream_address)[source]

Starts client and registers downstream to receive prompts.

start_client(name, address)[source]

Starts client connected to given address.

Prompt(request, context)[source]

Missing associated documentation comment in .proto file

prompt(upstream_name)[source]

Set prompt event for upstream name.

GetNotifications(request, context)[source]

Missing associated documentation comment in .proto file

get_notification_log_section(section_id)[source]

Returns section for given section ID.

CallApplicationMethod(request, context)[source]

Missing associated documentation comment in .proto file

stop(*args)[source]

Stops the gRPC server.

actors

class eventsourcing.system.thespian.ThespianRunner(system: eventsourcing.system.definition.System, pipeline_ids=(0, ), system_actor_name='system', shutdown_on_close=False, **kwargs)[source]

Bases: eventsourcing.system.definition.AbstractSystemRunner

Uses actor model framework to run a system of process applications.

__init__(system: eventsourcing.system.definition.System, pipeline_ids=(0, ), system_actor_name='system', shutdown_on_close=False, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

start()[source]

Starts all the actors to run a system of process applications.

close()[source]

Stops all the actors running a system of process applications.

class eventsourcing.system.thespian.SystemActor[source]

Bases: thespian.actors.Actor

__init__()[source]

Called to initialize the Actor.

Override this initialization method as needed in defined Actors.

N.B. Currently the Actor is not yet fully realized in the ActorSystem when __init__ is invoked. This means that the Actor __init__ cannot invoke any ActorSystem-related operations (no .send(), .handleDeadLetters(), .notifyOnSystemRegistrationChanges(), etc.)

Also note that there is post-__init__ processing of a created Actor object by the ActorSystem that is necessary for it to become a full Actor. The Actor’s __init__() must not perform Actor-related operations, and the __init__() is not sufficient to fully initialize an Actor object. This ensures that the ActorSystem is involved in the creation of a useable Actor (i.e. the ActorSystem is the Factory for an Actor).

receiveMessage(msg, sender)[source]

Main entry point handling a request received by this Actor. Runs without interruption and may access locals to this Actor (only) without concern that these locals will be modified externally.

class eventsourcing.system.thespian.PipelineActor[source]

Bases: thespian.actors.Actor

__init__()[source]

Called to initialize the Actor.

Override this initialization method as needed in defined Actors.

N.B. Currently the Actor is not yet fully realized in the ActorSystem when __init__ is invoked. This means that the Actor __init__ cannot invoke any ActorSystem-related operations (no .send(), .handleDeadLetters(), .notifyOnSystemRegistrationChanges(), etc.)

Also note that there is post-__init__ processing of a created Actor object by the ActorSystem that is necessary for it to become a full Actor. The Actor’s __init__() must not perform Actor-related operations, and the __init__() is not sufficient to fully initialize an Actor object. This ensures that the ActorSystem is involved in the creation of a useable Actor (i.e. the ActorSystem is the Factory for an Actor).

receiveMessage(msg, sender)[source]

Main entry point handling a request received by this Actor. Runs without interruption and may access locals to this Actor (only) without concern that these locals will be modified externally.

class eventsourcing.system.thespian.ProcessMaster[source]

Bases: thespian.actors.Actor

__init__()[source]

Called to initialize the Actor.

Override this initialization method as needed in defined Actors.

N.B. Currently the Actor is not yet fully realized in the ActorSystem when __init__ is invoked. This means that the Actor __init__ cannot invoke any ActorSystem-related operations (no .send(), .handleDeadLetters(), .notifyOnSystemRegistrationChanges(), etc.)

Also note that there is post-__init__ processing of a created Actor object by the ActorSystem that is necessary for it to become a full Actor. The Actor’s __init__() must not perform Actor-related operations, and the __init__() is not sufficient to fully initialize an Actor object. This ensures that the ActorSystem is involved in the creation of a useable Actor (i.e. the ActorSystem is the Factory for an Actor).

receiveMessage(msg, sender)[source]

Main entry point handling a request received by this Actor. Runs without interruption and may access locals to this Actor (only) without concern that these locals will be modified externally.

class eventsourcing.system.thespian.ProcessSlave[source]

Bases: thespian.actors.Actor

__init__()[source]

Called to initialize the Actor.

Override this initialization method as needed in defined Actors.

N.B. Currently the Actor is not yet fully realized in the ActorSystem when __init__ is invoked. This means that the Actor __init__ cannot invoke any ActorSystem-related operations (no .send(), .handleDeadLetters(), .notifyOnSystemRegistrationChanges(), etc.)

Also note that there is post-__init__ processing of a created Actor object by the ActorSystem that is necessary for it to become a full Actor. The Actor’s __init__() must not perform Actor-related operations, and the __init__() is not sufficient to fully initialize an Actor object. This ensures that the ActorSystem is involved in the creation of a useable Actor (i.e. the ActorSystem is the Factory for an Actor).

receiveMessage(msg, sender)[source]

Main entry point handling a request received by this Actor. Runs without interruption and may access locals to this Actor (only) without concern that these locals will be modified externally.

class eventsourcing.system.ray.RayRunner(system: eventsourcing.system.definition.System, pipeline_ids=(0, ), poll_interval: Optional[int] = None, setup_tables: bool = False, sleep_for_setup_tables: int = 0, db_uri: Optional[str] = None, **kwargs)[source]

Bases: eventsourcing.system.definition.AbstractSystemRunner

Uses actor model framework to run a system of process applications.

__init__(system: eventsourcing.system.definition.System, pipeline_ids=(0, ), poll_interval: Optional[int] = None, setup_tables: bool = False, sleep_for_setup_tables: int = 0, db_uri: Optional[str] = None, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

start()[source]

Starts all the actors to run a system of process applications.

close()[source]

Closes a running system.