a engine to process workflows and tasks
Project description
Workflow Engine
introduction
This module is used to implement workflows. Every workflow executes a list of tasks.
Installation
python -m pip install workflow_engine
Implementation
Processor
A Workflow processor is the main instance which will handle a list of entities and passes them to the assigned tasks. The handled entities should inherit from the workflow model type.
Since the workflow processor is an abstract class, the following methods have to be implemented in the inherited class:
- get_default_entries returns a list of unparsed entries
- get_entry parses the raw entries retrieved by the previous method to an
object which inherits from the
WorkflowModel
- filter define some preconditions
- get_tasks returns a list of instances which inherit from the workflow task
- write_entry handle a processed (successfully or unsuccessfully) entry. Write it to the cache or to the disk
- close handle the finale state of the workflow
Model
Basic implementation of an entity. Delivers field and methods to check, wether the task has already been executed, if there is a related error or if the entry should be executed again.
Task
Basic implementation of a task which should be executed for a workflow
Status
The following use cases can be handled:
flow type | Exception | StatusException | OnSuccess |
---|---|---|---|
skip | - | - | x |
interrupt | x | x | - |
repeat | (-) | x | x |
- Exception in case of an Exception which is not an instance of
StatusException
the workflow will be interrupted. An operator has the possibility to set the repeat property - StatusException will interrupt the workflow and set the
Status
object which can contain any repeat property - OnSuccess can return a
Status
can contain any repeat property. To skip the task it is not necessary to implement a dedicated status. Just return aStatus
to exit the task
Exception Handling
In case of unexpected Exceptions the workflow for the handled entry will be
cancelled. The stacktrace will be logged. An unique id is assigned to each
exception. The error id will be persisted into your status file and into the
logs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for workflow_engine-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c78fbc2c355cdb818d6b7dc42205c5e08c62b29b6dc1d3c419353d32a578af5 |
|
MD5 | 55e5a661c892cbade7806f48fada50a3 |
|
BLAKE2b-256 | 9c7b85b148bc73489f4e8fa446069145506f199b96eda0fa8a62dbc4d63d0d9b |