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

This version

5.0.0

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ewokscore-5.0.0.tar.gz
  • Upload date:
  • Size: 101.0 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.0.tar.gz
Algorithm Hash digest
SHA256 c4d4413bb7a71427fd9cb5faea0ea50f4d292315051a390719052c04d371fb8d
MD5 b2217bc7c9eecc2c693621f6ada1a643
BLAKE2b-256 bd6e07082668e27bc8ffc31e745976329ff6fad1e44d7d646a24c3d0eeb4a6fb

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ewokscore-5.0.0-py3-none-any.whl
  • Upload date:
  • Size: 143.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 723765a9377893040d6a445f32cf601ce4ca7c033cc55193e54b7d4c521eac1d
MD5 87f896237c4d777ead79b051ce6fc576
BLAKE2b-256 ef4db464fe0bcd91c7f00cbc2c613f4e53a775a225295cd02964bf0198175ec2

See more details on using hashes here.

Provenance

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