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.0rc2.tar.gz (100.6 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.0rc2-py3-none-any.whl (142.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ewokscore-5.0.0rc2.tar.gz
  • Upload date:
  • Size: 100.6 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.0rc2.tar.gz
Algorithm Hash digest
SHA256 2df353679ad94acb2f593ffb7db3fa1f8ac8d693b986c98f016c7be7fc853b9a
MD5 d8e477e9300f7436ba901b286cfb29ff
BLAKE2b-256 668c6d769e7ea202b331ef173d04d4fda8c7b08310e3f029f8ec7451e26b6262

See more details on using hashes here.

Provenance

The following attestation bundles were made for ewokscore-5.0.0rc2.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.0rc2-py3-none-any.whl.

File metadata

  • Download URL: ewokscore-5.0.0rc2-py3-none-any.whl
  • Upload date:
  • Size: 142.7 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.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 e89977d250a08e1337bd489131430d77ce5db97ac2302cf4ab6efe470e94db23
MD5 8180d505569f3c6f5471a6cc2177b324
BLAKE2b-256 c198cb3d5342b7b54e9bd817b83a9ff58644f1cbb65a5d392cfa401bc0cb3ba5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ewokscore-5.0.0rc2-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