leapp.messaging package
Submodules
leapp.messaging.inprocess module
- class leapp.messaging.inprocess.InProcessMessaging(stored=True, config_model=None, answer_store=None)
Bases:
BaseMessagingThis class implements the direct database access for the messaging.
Module contents
- class leapp.messaging.BaseMessaging(stored=True, config_model=None, answer_store=None)
Bases:
objectBaseMessaging is the Base class for all messaging implementations. It provides the basic interface that is supported within the framework. These are called the produce and consume methods.
- command(command)
Called to send a command to the workflow execution
- Parameters:
command (Instance of
leapp.messaging.commands.WorkflowCommand) – A command to send to the workflow execution.- Returns:
None
- property commands
- Returns:
List of commands that have been sent to the workflow execution.
- consume(actor, *types)
Returns all consumable messages and filters them by types
- Parameters:
types – Variable number of
leapp.models.Modelderived types to filter messages to be consumedactor – Actor that consumes the data
- Returns:
Iterable with messages matching the criteria
- dialogs()
Gets all dialogs actually encountered during workflow run
- Returns:
List of encountered dialogs
- errors()
Gets all produced errors.
- Returns:
List of newly produced errors
- feed(model, actor)
Called to pre-fill sent messages and make them available for other actors.
- Parameters:
model (
leapp.models.Model) – Model to send as message payloadactor (
leapp.actors.Actor) – Actor that sends the message
- Returns:
the updated message dict
- Return type:
dict
- get_answers(dialog)
- load(consumes)
Loads all messages that are requested from the consumes attribute of
leapp.actors.Actor- Parameters:
consumes – Tuple or list of
leapp.models.Modeltypes to preload- Returns:
None
- Raises:
leapp.exceptions.CannotConsumeErrorMessages – When trying to consume ErrorModel
- load_answers(answer_file, workflow)
Loads answers from a given answer file
- Parameters:
answer_file (str) – Path to file to load as answer file
workflow (
leapp.workflows.Workflow) –leapp.workflows.Workflowinstance to load the answers for.
- Returns:
None
- messages()
Gets all newly produced messages.
- Returns:
List of newly processed messages
- produce(model, actor)
Called to send a message available for other actors.
- Parameters:
model (
leapp.models.Model) – Model to send as message payloadactor (
leapp.actors.Actor) – Actor that sends the message
- Returns:
the updated message dict
- Return type:
dict
- register_dialog(dialog, actor)
- report_error(message, severity, actor, details)
Reports an execution error
- Parameters:
message (str) – Message to print the error
severity (leapp.models.error_severity.ErrorSeverity) – Severity of the error
actor (leapp.actors.Actor) – Actor name that produced the message
details (dict) – A dictionary where additional context information can be passed along with the error
- Returns:
None
- report_stacktrace(message, trace, actorname)
- request_answers(dialog)
- request_stop_after_phase()
If called, it will cause the workflow to stop the execution after the current phase ends.
- show_message(message)
Display a message in user interterface currently in use (CLI, GUI).
It uses one of the dialog renderers in
leapp.dialogs.renderer.- Parameters:
message (str) – Message to show
- property stop_after_phase
Returns True if execution stop was requested after the current
- Returns:
True if the executed was requested to be stopped.
- property stored
- Returns:
If the messages are stored immediately, this function returns True, otherwise False.