spade_artifact package
Submodules
spade_artifact.agent module
spade_artifact.artifact module
- 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
- 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 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 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
Module contents
Top-level package for spade-artifact.