Skip to main content

Workflow Engine for Python

Project description

WfEpy (Workflow Engine for Python) is Python library for creating workflows and automating various processes. It is designed to be as simple as possible so developers can focus on tasks logic, not how to execute workflow, store state, etc.

Individual steps in workflow are simply functions with decorator and transitions between tasks are also defined by decorators. Everything what developer needs to do is add few decorators to functions that implements tasks logic. This library is then used to build graph from tasks and transitions and execute tasks in workflow by traversing graph and calling task functions. Context passed to each function is arbitrary user object that can be used to store data, connect to other services or APIs, …

@wfepy.task()
@wfepy.start_point()
@wfepy.followed_by('make_coffee')
def start(context):
    ...

@wfepy.task()
@wfepy.followed_by('drink_coffee')
def make_coffee(context):
    ...

@wfepy.task()
@wfepy.followed_by('end')
def drink_coffee(context):
    ...

@wfepy.task()
@wfepy.end_point()
def end(context):
    ...

WfEpy does not provide any server scheduler or something like that. It was designed to be used in scripts, that are for example periodically executed by cron. If workflow have task that cannot be finished in single run library provides way how to store current state of runner including user data and restore it on next run.

import coffee_workflow

wf = wfepy.Workflow()
wf.load_tasks(coffee_workflow)

runner = wf.create_runner()
if restore_state:
    runner.load('state-file')

runner.run()

runner.dump('state-file')

This simple design provides many options how to execute your workflow and customize it. This was also reason why this library was created, we don’t want to manage new service/server that executes few simple workflows. We would like to use service we already have, for example Jenkins, cron, …

Installation

Install it using pip

pip3 install wfepy

or clone repository

git clone https://github.com/redhat-aqe/wfepy.git
cd wfepy

and install Python package including dependencies

python3 setup.py install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wfepy-0.1.1.tar.gz (7.4 kB view details)

Uploaded Source

File details

Details for the file wfepy-0.1.1.tar.gz.

File metadata

  • Download URL: wfepy-0.1.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.5.6

File hashes

Hashes for wfepy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4c9f47cabf99a1efa0287149637eeeb869b324e8e2bc0d7487db28d9ada6e7c6
MD5 913f3405a3d0c541b777be6d597fdb62
BLAKE2b-256 396857d35e988aa961c42a5371eb91469456dd6f912671ac1ee8caaf9bdce55f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page