Go to file
jbirddog 41ce3d1cd8
Add rust lib with Python bindings via pyO3 (#1)
* Added integration tests
* Tested with local wheel in spiff-arena
2023-04-17 12:13:04 -04:00
.github/workflows Add rust lib with Python bindings via pyO3 (#1) 2023-04-17 12:13:04 -04:00
dev Add rust lib with Python bindings via pyO3 (#1) 2023-04-17 12:13:04 -04:00
module Add rust lib with Python bindings via pyO3 (#1) 2023-04-17 12:13:04 -04:00
scripts Add rust lib with Python bindings via pyO3 (#1) 2023-04-17 12:13:04 -04:00
tests Add rust lib with Python bindings via pyO3 (#1) 2023-04-17 12:13:04 -04:00
.gitignore Getting set up 2023-04-12 12:30:45 -04:00
LICENSE Initial commit 2023-04-12 10:51:01 -04:00
Makefile Add rust lib with Python bindings via pyO3 (#1) 2023-04-17 12:13:04 -04:00
README.md Add rust lib with Python bindings via pyO3 (#1) 2023-04-17 12:13:04 -04:00
TODO.md Add rust lib with Python bindings via pyO3 (#1) 2023-04-17 12:13:04 -04:00
docker-compose.yml Add rust lib with Python bindings via pyO3 (#1) 2023-04-17 12:13:04 -04:00

README.md

spiff-element-units

spiff-element-units decomposes workflows into element units that can be executed in isolation. This allows for incrementally executing large workflows.

The library requires callers to provide:

  1. a serialized workflow spec in the form of {"spec":..., "subprocess_specs"...} dumped to a json string
  2. a cache key that is used when refering to the above serialized workflow spec
  3. a directory used to store the element unit cache
  4. process and element ids

The library currently assumes that:

  1. A full workflow is loaded into SpiffWorkflow once to find all the specs. This requirement may change in the future.

The Python API:

Currently extremely simple to get started. Expect the public api to change as it matures.

import spiff_element_units

Caching element units

def cache_element_units_for_workflow(
    cache_dir: str,
    cache_key: str,
    workflow_spec_json: str,
) -> None:
    

Forms element units for the workflow specs provided in json format and associates them with cache_key.

TODO: exceptions raised.

Getting cached element units

def workflow_from_cached_element_unit(
    cache_dir: str,
    cache_key: str,
    element_id: str,
) -> str:

Returns the json representation of a workflow capable of executing the first element unit available for the element_id associated with cache_key. This can be used to start or resume a process from previously cached element units.

TODO: exceptions raised.

Development

make dev-env to set up the development environment.

make compile compiles the code.

make tests tests the code.

make fmt formats the code.

make bindings creates the shared library that can be loaded as a Python module.

make run-integration-tests runs the integration tests with the latest result of make bindings.

make integration-tests does the two steps above.

make wheel makes a wheel for local testing in external applications.