spade_artifact package

Submodules

spade_artifact.agent module

class spade_artifact.agent.ArtifactComponent(agent)[source]

Bases: object

async focus(artifact_jid, callback)[source]
async ignore(artifact_jid)[source]
on_item_published(jid, node, item, message=None)[source]
class spade_artifact.agent.ArtifactMixin(*args, pubsub_server=None, **kwargs)[source]

Bases: PubSubMixin

spade_artifact.artifact module

class spade_artifact.artifact.AbstractArtifact[source]

Bases: object

class spade_artifact.artifact.Artifact(jid, password, pubsub_server=None, verify_security=False)[source]

Bases: PubSubMixin, AbstractArtifact

get(name)[source]

Recovers a knowledge item from the artifact’s knowledge base.

Args:

name(str): name of the item

Returns:

object: the object retrieved or None

is_alive()[source]

Checks if the artifact is alive.

Returns:

bool: wheter the artifact is alive or not

join(timeout=None)[source]
kill()[source]
mailbox_size() int[source]

Checks if there is a message in the mailbox

Returns:

int: the number of messages in the mailbox

property name

Returns the name of the artifact (the string before the ‘@’)

async publish(payload: str) None[source]
async receive(timeout: Optional[float] = None) Optional[Message][source]

Receives a message for this artifact. If timeout is not None it returns the message or “None” after timeout is done.

Args:

timeout (float): number of seconds until return

Returns:

spade.message.Message: a Message or None

async run()[source]

Main body of the artifact. This coroutine SHOULD be overloaded.

async send(msg: Message)[source]

Sends a message.

Args:

msg (spade.message.Message): the message to be sent.

set(name, value)[source]

Stores a knowledge item in the artifact knowledge base.

Args:

name (str): name of the item value (object): value of the item

set_container(container)[source]

Sets the container to which the artifact is attached

Args:

container (spade.container.Container): the container to be attached to

set_loop(loop)[source]
async setup()[source]

Setup artifact before startup. This coroutine may be overloaded.

start(auto_register=True)[source]

Tells the container to start this agent. It returns a coroutine or a future depending on whether it is called from a coroutine or a synchronous method.

Args:

auto_register (bool): register the agent in the server (Default value = True)

stop()[source]

Stop the artifact

Module contents

Top-level package for spade-artifact.