Skip to main content

API for graphs and tasks in Ewoks

Project description

ewokscore

Pipeline Code style: black License Coverage Docs PyPI

ewokscore provides an API to define workflows and implement tasks in ewoks.

Install

pip install ewokscore[test]

Test

pytest --pyargs ewokscore.tests

Getting started

from ewokscore.task import Task
from ewokscore import execute_graph


# Implement a workflow task
class SumTask(
    Task, input_names=["a"], optional_input_names=["b"], output_names=["result"]
):
    def run(self):
        result = self.inputs.a
        if self.inputs.b:
            result += self.inputs.b
        self.outputs.result = result


# Define a workflow with default inputs
graph = {"id": "testworkflow", "schema_version": "1.1"}
nodes = [
    {
        "id": "task1",
        "task_type": "class",
        "task_identifier": "__main__.SumTask",
        "default_inputs": [{"name": "a", "value": 1}],
    },
    {
        "id": "task2",
        "task_type": "class",
        "task_identifier": "__main__.SumTask",
        "default_inputs": [{"name": "b", "value": 1}],
    },
    {
        "id": "task3",
        "task_type": "class",
        "task_identifier": "__main__.SumTask",
        "default_inputs": [{"name": "b", "value": 1}],
    },
]
links = [
    {
        "source": "task1",
        "target": "task2",
        "data_mapping": [{"source_output": "result", "target_input": "a"}],
    },
    {
        "source": "task2",
        "target": "task3",
        "data_mapping": [{"source_output": "result", "target_input": "a"}],
    },
]
workflow = {"graph": graph, "nodes": nodes, "links": links}

# Define task inputs
inputs = [{"id": "task1", "name": "a", "value": 10}]

# Execute a workflow (use a proper Ewoks task scheduler in production)
varinfo = {"root_uri": "/tmp/myresults"}  # optionally save all task outputs
result = execute_graph(workflow, varinfo=varinfo, inputs=inputs)
print(result)

Documentation

https://ewokscore.readthedocs.io/

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

ewokscore-5.0.0rc1.tar.gz (87.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ewokscore-5.0.0rc1-py3-none-any.whl (120.1 kB view details)

Uploaded Python 3

File details

Details for the file ewokscore-5.0.0rc1.tar.gz.

File metadata

  • Download URL: ewokscore-5.0.0rc1.tar.gz
  • Upload date:
  • Size: 87.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ewokscore-5.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 cb0c0940f5dc7719e7e7982b13bffb60742e4d2f7cfa46f6d4e82849e0f488af
MD5 af351e938741b30e283e33caa984b1e1
BLAKE2b-256 adf9dc1e15b27d5d5b030f17c6976245e0314334260665ac254eb29d4a9a79e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ewokscore-5.0.0rc1.tar.gz:

Publisher: release.yml on ewoks-kit/ewokscore

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ewokscore-5.0.0rc1-py3-none-any.whl.

File metadata

  • Download URL: ewokscore-5.0.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 120.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ewokscore-5.0.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d601e0da92e64ce1e51bf0dc85ced3dfd3bd239d9fd11617c24d1f2a92c86fe
MD5 14a36d111e24a9111ab1732376d8e2bc
BLAKE2b-256 1d86cb475049f5ba056f70a5412b3d8c59ede581b1255dd5074dd865896bce81

See more details on using hashes here.

Provenance

The following attestation bundles were made for ewokscore-5.0.0rc1-py3-none-any.whl:

Publisher: release.yml on ewoks-kit/ewokscore

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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