Skip to main content

A workflow engine based on Kopf

Project description

Fastflow

Code style: black

Deploy to Kubernetes with helm chart

kubectl create ns fastflow
helm -n fastflow upgrade --install fastflow chart

To install in more namespasces, create the namespace and run the helm command again, this time with the --skip-crds flag.

kubectl create ns fastflow-dev
helm -n fastflow-dev upgrade --install fastflow chart --skip-crds

Run examples

Apply examples

kubectl -n fastflow create -f examples/01-helloworld/workflow.yaml
kubectl -n fastflow create -f examples/02-digraph/workflow.yaml

Inspect results

kubectl -n fastflow get workflows
kubectl -n fastflow get tasks -l workflow=helloworld

Developer setup

For developing the fastflow project

Generate CRDS

python3 generate_crds.py

Create CRDS

Can also be installed by applying the helm chart

kubectl create -f chart/crds/kopfpeering-crd.yaml
find chart/crds/generated -name *.yaml -exec kubectl create -f '{}' \;

Delete CRDS

find chart/crds/generated -name *.yaml -exec kubectl delete -f '{}' \;

Virtual environment

python3 -m venv ~/venvs/fastflow
. ~/venvs/fastflow/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -e .

Run from outside cluster

Will use kubectl config for cluster access. Greate for development, and can run with debugger attached.

Prepare namespace

kubectl create ns fastflow-dev
kubectl -n fastflow-dev apply -f - << EOYML
apiVersion: kopf.dev/v1
kind: KopfPeering
metadata:
  name: default
EOYML

Run as module (useful for debugger)

python3 -m fastflow \
--namespace fastflow-dev \
--dev

Run from cli

fastflow --namespace fastflow-dev --dev

Run Tests

Install test-requirements

python3 -m pip install -e . -r test-requirements.txt

Prepare namespace

kubectl create ns fastflow-test
kubectl -n fastflow-test apply -f test/kopf-test-peering.yaml

Run the tests as module

python3 -m pytest --color=yes

Run the tests from cli

pytest --color=yes

Building whl package and Docker image

Cleanup old packages

rm -Rf dist

Build package

python3 -m pip install build
python3 -m build

Build Docker image using minikube

eval $(minikube -p minikube docker-env)
DOCKER_BUILDKIT=1 docker build -t fastflow .

Use helm to run the image in Kubernetes, by specifying the image tag we just created

helm -n fastflow-dev upgrade --install --set imageOverride=fastflow fastflow chart

Example using custom Task implementations

The Operator needs to be able to load the custom code. Here is an example using the examples/03-farmlife example workflow. This workflow uses custom tasks implemented in examples/03-farmlife/tasks-impl/farmlife.py.

Run the operator locally

Run the operator so it can load the custom code

fastflow --dev --namespace fastflow-dev examples/03-farmlife/tasks-impl/farmlife.py

Apply the example workflow

kubectl -n fastflow-dev create -f examples/03-farmlife/workflow.yaml

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

python_fastflow-0.7.0.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

python_fastflow-0.7.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file python_fastflow-0.7.0.tar.gz.

File metadata

  • Download URL: python_fastflow-0.7.0.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for python_fastflow-0.7.0.tar.gz
Algorithm Hash digest
SHA256 bcba56d373d37debcefb7c5b973b31f32bdb0bd343d582600452394ff9495bb6
MD5 4b086fbfeb18ebad9d1eebf1f319a60c
BLAKE2b-256 033b16801ab3adc75007b70efb4540eebfc8cbbaa98f0979575417750bd4e8e4

See more details on using hashes here.

File details

Details for the file python_fastflow-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for python_fastflow-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a65fc43d69b10e1fa9b369ada36496be2a30afbcd4c9fefe90c7391516a23d89
MD5 bfc5395eb1c30521a790cb52d1c0913e
BLAKE2b-256 d2b9f06eb0bb223d9f9e65aadf621260028df819c3a7594e5a21e4ad66265033

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