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 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

4.0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ewokscore-4.0.2.tar.gz (85.9 kB view details)

Uploaded Source

Built Distribution

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

ewokscore-4.0.2-py3-none-any.whl (117.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ewokscore-4.0.2.tar.gz
  • Upload date:
  • Size: 85.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ewokscore-4.0.2.tar.gz
Algorithm Hash digest
SHA256 776e7306cbfd73fd6a5b287310ca61beca7877326e0a0629b998cefd09a69fa2
MD5 644276afcb76aa7f54f9b7f5c7ba890e
BLAKE2b-256 de7f4b80807861641ccd7c2aeead3f61ccd51a782235112028df278d732a2c74

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for ewokscore-4.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 610acda07f799987a329a3683186072d9bc96c1597848090f64eaafc5f769ad5
MD5 f72eb3f8d1767cc9138d818620e16f0f
BLAKE2b-256 06040efe339b14b339c10802a99723a693750bd9961e0e6166e8e4d3143140bd

See more details on using hashes here.

Provenance

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