Skip to main content

Simple workflows for Python

Project description

Simple worfklows for Python
-------------------------------------

Wofklow engine is a Finite State Machine with memory
It is used to execute set of methods in a specified order.

Here is a simple example of a configuration:

[
check_token_is_wanted, # (run always)
[ # (run conditionally)
check_token_numeric,
translate_numeric,
next_token # (stop processing, continue with next token)
],
[ # (run conditionally)
check_token_proper_name,
translate_proper_name,
next_token # (stop processing, continue with next token)
],
normalize_token, # (only for "normal" tokens)
translate_token,
]

You can probably guess what the processing pipeline does with tokens - the
whole task is made of four steps and the whole configuration is just stored
as a Python list. Every task is implemeted as a function that takes two objects:

* currently processed object
* workflow engine instance

Example:

def next_token(obj, eng):
eng.ContinueNextToken()

There are NO explicit states, conditions, transitions - the job of the engine is
simply to run the tasks one after another. It is the responsibility of the task
to tell the engine what is going to happen next; whether to continue, stop,
jump back, jump forward and few other options.

This is actually a *feature*, I knew that there will be a lot of possible
exceptions and transition states to implement for NLP processing and I also
wanted to make the workflow engine simple and fast -- but it has disadvantages,
you can make more errors and workflow engine will not warn you.

The workflow module comes with many patterns that can be directly used in the
definition of the pipeline, such as IF, IF_NOT, PARALLEL_SPLIT and others.

This version requires Python 2 and many of the workflow patterns (such as IF,
XOR, WHILE) are implemented using lambdas, therefore not suitable for Python 3.

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

workflow-1.0.tar.gz (37.3 kB view details)

Uploaded Source

Built Distribution

workflow-1.0-py2.6.egg (70.4 kB view details)

Uploaded Source

File details

Details for the file workflow-1.0.tar.gz.

File metadata

  • Download URL: workflow-1.0.tar.gz
  • Upload date:
  • Size: 37.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for workflow-1.0.tar.gz
Algorithm Hash digest
SHA256 01e218d74d6fb19fc7739947651052579624d9a025775f040fb237b59a9d5cc7
MD5 84aceeaa8ff860b2c508af11c29c7aaa
BLAKE2b-256 ff96a455fef104ad3c67286320f345264028ad0e9d88c089679dfa15fa2965c8

See more details on using hashes here.

Provenance

File details

Details for the file workflow-1.0-py2.6.egg.

File metadata

  • Download URL: workflow-1.0-py2.6.egg
  • Upload date:
  • Size: 70.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for workflow-1.0-py2.6.egg
Algorithm Hash digest
SHA256 e02e7b7881b4df4d30d62c1f14bb0287572d28af73d2c5f518edbe63cb88c6a1
MD5 a0625556c1dbf01c4919df247801304c
BLAKE2b-256 afbbc8716ef7b9e933190f93d331162ccc511f560c9d37f9446a055f46afa51a

See more details on using hashes here.

Provenance

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