Name | ewokscore JSON |
Version |
1.1.0
JSON |
| download |
home_page | None |
Summary | API for graphs and tasks in Ewoks |
upload_time | 2025-01-25 11:37:04 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | # MIT License
**Copyright (c) 2021 European Synchrotron Radiation Facility**
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
keywords |
ewoks
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# ewokscore
*ewokscore* provides an API to define workflows and implement tasks in [ewoks](https://ewoks.readthedocs.io/).
## Install
```bash
pip install ewokscore[test]
```
## Test
```bash
pytest --pyargs ewokscore.tests
```
## Getting started
```python
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
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": {"id": "testworkflow"}, "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/
Raw data
{
"_id": null,
"home_page": null,
"name": "ewokscore",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "ewoks",
"author": null,
"author_email": "ESRF <dau-pydev@esrf.fr>",
"download_url": "https://files.pythonhosted.org/packages/18/87/74c91a539324759833b1759e84fa53e67610c32498e05e37adbcf91522cd/ewokscore-1.1.0.tar.gz",
"platform": null,
"description": "# ewokscore\n\n*ewokscore* provides an API to define workflows and implement tasks in [ewoks](https://ewoks.readthedocs.io/).\n\n## Install\n\n```bash\npip install ewokscore[test]\n```\n\n## Test\n\n```bash\npytest --pyargs ewokscore.tests\n```\n\n## Getting started\n\n```python\nfrom ewokscore import Task\nfrom ewokscore import execute_graph\n\n\n# Implement a workflow task\nclass SumTask(\n Task, input_names=[\"a\"], optional_input_names=[\"b\"], output_names=[\"result\"]\n):\n def run(self):\n result = self.inputs.a\n if self.inputs.b:\n result += self.inputs.b\n self.outputs.result = result\n\n\n# Define a workflow with default inputs\nnodes = [\n {\n \"id\": \"task1\",\n \"task_type\": \"class\",\n \"task_identifier\": \"__main__.SumTask\",\n \"default_inputs\": [{\"name\": \"a\", \"value\": 1}],\n },\n {\n \"id\": \"task2\",\n \"task_type\": \"class\",\n \"task_identifier\": \"__main__.SumTask\",\n \"default_inputs\": [{\"name\": \"b\", \"value\": 1}],\n },\n {\n \"id\": \"task3\",\n \"task_type\": \"class\",\n \"task_identifier\": \"__main__.SumTask\",\n \"default_inputs\": [{\"name\": \"b\", \"value\": 1}],\n },\n]\nlinks = [\n {\n \"source\": \"task1\",\n \"target\": \"task2\",\n \"data_mapping\": [{\"source_output\": \"result\", \"target_input\": \"a\"}],\n },\n {\n \"source\": \"task2\",\n \"target\": \"task3\",\n \"data_mapping\": [{\"source_output\": \"result\", \"target_input\": \"a\"}],\n },\n]\nworkflow = {\"graph\": {\"id\": \"testworkflow\"}, \"nodes\": nodes, \"links\": links}\n\n# Define task inputs\ninputs = [{\"id\": \"task1\", \"name\": \"a\", \"value\": 10}]\n\n# Execute a workflow (use a proper Ewoks task scheduler in production)\nvarinfo = {\"root_uri\": \"/tmp/myresults\"} # optionally save all task outputs\nresult = execute_graph(workflow, varinfo=varinfo, inputs=inputs)\nprint(result)\n```\n\n## Documentation\n\nhttps://ewokscore.readthedocs.io/\n",
"bugtrack_url": null,
"license": "# MIT License\n \n **Copyright (c) 2021 European Synchrotron Radiation Facility**\n \n Permission is hereby granted, free of charge, to any person obtaining a copy of\n this software and associated documentation files (the \"Software\"), to deal in\n the Software without restriction, including without limitation the rights to\n use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n the Software, and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n ",
"summary": "API for graphs and tasks in Ewoks",
"version": "1.1.0",
"project_urls": {
"Changelog": "https://gitlab.esrf.fr/workflow/ewoks/ewokscore/-/blob/main/CHANGELOG.md",
"Documentation": "https://ewokscore.readthedocs.io/",
"Homepage": "https://gitlab.esrf.fr/workflow/ewoks/ewokscore",
"Issues": "https://gitlab.esrf.fr/workflow/ewoks/ewokscore/issues/",
"Repository": "https://gitlab.esrf.fr/workflow/ewoks/ewokscore"
},
"split_keywords": [
"ewoks"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "188774c91a539324759833b1759e84fa53e67610c32498e05e37adbcf91522cd",
"md5": "8de73337dc56b5fddeaa1a0ca4edb046",
"sha256": "30b4ba3e9609a85f2d346b61c4ec4ae62c4d846da4f79a6d5c3b0887db6c8db4"
},
"downloads": -1,
"filename": "ewokscore-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "8de73337dc56b5fddeaa1a0ca4edb046",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 77773,
"upload_time": "2025-01-25T11:37:04",
"upload_time_iso_8601": "2025-01-25T11:37:04.021515Z",
"url": "https://files.pythonhosted.org/packages/18/87/74c91a539324759833b1759e84fa53e67610c32498e05e37adbcf91522cd/ewokscore-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-25 11:37:04",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "ewokscore"
}