Welcome to carrera’s documentation!

Here are some documentation

Actors

Base

class carrera.actors.base.Actor(*_args, **_kwargs)

Actor base class.

New implementation of actors should be child of this class.

cleanup(*args, **kwargs)

Cleanup method.

Util for cleanup information when actor exits.

By default does nothing, this could be implemented on child actors.

loop()

Loop method

For reading incoming messages. This should be implemented in child actors.

property name

Get actor name.

result(*args, **kwargs)

Result method.

Method for waiting result about executed task. This should be implemented in child actors.

send(msg: object, target_id: str = None, sender_id: str = None)

Send msg to actor.

Params:
  • msg (object): Message data to be sent to an actor. It should be serializable

  • target_id(str): if provided send message to specified actor instance

  • sender_id(str): if provided specify message sender to target agent

setup()

Setup method.

Util for define configurations and associate objects to the actor at startup.

By default does nothing, this could be implemented on child actors.

ThreadActor

class carrera.actors.thread.ThreadActor(*_args, **_kwargs)

Thread actor.

cleanup(force=False)

Cleanup actor.

loop()

Read messages from thread queue.

result(message: carrera.message.Message, exit: bool = False, timeout: int = None)

Get result of executed task.

Params:
  • msg (carrera.messages.Message): sender Message instance.

  • exit(bool): if provided, this actor exists when failed result retrival.

  • timeout(str): if provided specify message sender to target agent

ProcessActor

class carrera.actors.process.ProcessActor(*args, **kwargs)

Process actor.

cleanup(force=False)

Cleanup actor.

loop()

Read messages from process queue.

result(message, exit=False, timeout=None)

Get result of executed task.

Params:
  • msg (carrera.messages.Message): sender Message instance.

  • exit(bool): if provided, this actor exists when failed result retrival.

  • timeout(str): if provided specify message sender to target agent

Dispatcher

class carrera.dispatcher.Dispatcher(_id=None)
broadcast(actor_name, msg, **kwargs)

Broadcast an message to all actors of name actor_name.

connect_to_server(host, port)

Setup tcp connection.

On new connection: * fetch node info and actors

dispatch(message_data, target_name, target_id=None, sender_id=None, msgid=None, broadcast=False)

Dispatch message to dispatcher unit.

join()

Join client to master.

post_job_to_node(node, message)

Post job to actor in another node.

remove_node(node)

Remove node actors from memmory.

response(response, msgid, message, target_name, target_id=None, sender_id=None, **kwargs)

Dispatch actor’s response to actor’s requester.

result(message, timeout=None)

Get actor’s message result.

send(actor, msg, **kwargs)

Send task to actor.

setup(verbose=True, debug=False, config: configparser.ConfigParser = <configparser.ConfigParser object>)

Setup dispatcher.

setup_server(host, port)

Setup tcp server.

On new connection: * fetch node info and actors

static uuid()

Get unique identifier.

Indices and tables