Shared utilities for ZOO-Project CWL runners
Project description
zoo-runner-common
A shared utility library for ZOO-Project CWL runners – centralizing reusable components across runners like Calrissian, Argo Workflows, and WES.
Overview
The zoo-runner-common repository provides core shared components used across multiple ZOO CWL runners. It eliminates code duplication by hosting:
- Common base class (
BaseRunner) with 8+ shared methods - Zoo-specific configuration handlers (
ZooConf,ZooInputs,ZooOutputs) - CWL workflow parsing and resource evaluation (
CWLWorkflow) - Execution handler interface (
ExecutionHandler) for hooks - Service stubs (
ZooStub) to communicate with ZOO kernel
Key Benefits
- ✅ ~437 lines of code duplication eliminated across 3 runners
- ✅ Single source of truth for common functionality
- ✅ Easier maintenance - fix once, benefit everywhere
- ✅ Consistent behavior across all runners
Directory Structure
zoo-runner-common/
├── base_runner.py # Abstract BaseRunner with common methods
├── zoo_conf.py # ZooConf, ZooInputs, ZooOutputs, CWLWorkflow
├── handlers.py # ExecutionHandler abstract base class
├── zoostub.py # ZooStub for ZOO kernel communication
└── __init__.py # Package initialization
Installation
As a dependency (recommended)
Add to your runner's pyproject.toml:
[project]
dependencies = [
"zoo-runner-common @ git+https://github.com/ZOO-Project/zoo-runner-common.git@main",
]
Local development
export PYTHONPATH="$PYTHONPATH:/path/to/zoo-runner-common"
Or use relative imports:
import sys
sys.path.insert(0, os.path.abspath('../zoo-runner-common'))
from base_runner import BaseRunner
from zoo_conf import ZooConf, ZooInputs, ZooOutputs, CWLWorkflow
from handlers import ExecutionHandler
Components
BaseRunner (base_runner.py)
Abstract base class providing common functionality for all CWL runners:
Methods provided:
get_workflow_id()- Get workflow identifierget_workflow_inputs(mandatory=False)- Get workflow input parametersget_max_cores()- Get maximum CPU cores from CWLget_max_ram()- Get maximum RAM from CWLget_volume_size(unit='Gi')- Calculate volume size (supports Mi/Gi)assert_parameters(mandatory=True)- Validate required inputsget_processing_parameters()- Get execution parametersget_namespace_name()- Generate unique namespace nameupdate_status(progress, message)- Update execution statusprepare()- Pre-execution preparation with hooksfinalize(log, output, usage_report, tool_logs)- Post-execution finalization
Abstract methods (to implement):
wrap()- Wrap CWL with stage-in/stage-outexecute()- Execute the workflow
Zoo Configuration Classes (zoo_conf.py)
| Class | Description |
|---|---|
ZooConf |
Wraps ZOO configuration dictionary |
ZooInputs |
Handles input parameter conversion and validation |
ZooOutputs |
Manages output parameters |
CWLWorkflow |
Parses CWL, evaluates resources, handles scatter |
ResourceRequirement |
CWL resource hints dataclass |
Key Features:
- Advanced type conversion (int, float, bool, arrays)
- File handling with format metadata
- OGC bounding box support
- NULL value handling
- Array inputs with
isArray
ExecutionHandler (handlers.py)
Abstract base class for execution customization:
class ExecutionHandler(ABC):
@abstractmethod
def pre_execution_hook(self): pass
@abstractmethod
def post_execution_hook(self, log, output, usage_report, tool_logs): pass
@abstractmethod
def get_secrets(self): pass
@abstractmethod
def get_pod_env_vars(self): pass
@abstractmethod
def get_pod_node_selector(self): pass
@abstractmethod
def handle_outputs(self, log, output, usage_report, tool_logs): pass
@abstractmethod
def get_additional_parameters(self): pass
Usage Example
from zoo_runner_common.base_runner import BaseRunner
from zoo_runner_common.handlers import ExecutionHandler
class MyCustomRunner(BaseRunner):
def wrap(self):
# Implement CWL wrapping logic
return wrapped_cwl
def execute(self):
# Prepare execution
cwljob = self.prepare()
# Execute workflow (custom logic)
result = my_executor.run(cwljob.cwl, cwljob.params)
# Finalize
self.finalize(log, output, usage_report, tool_logs)
return result
Runners Using zoo-runner-common
| Runner | Backend | Repository |
|---|---|---|
| zoo-calrissian-runner | Calrissian/Kubernetes | EOEPCA/zoo-calrissian-runner |
| zoo-argowf-runner | Argo Workflows | ZOO-Project/zoo-argowf-runner |
| zoo-wes-runner | WES/TOIL | ZOO-Project/zoo-wes-runner |
Module Reference
| Module | Description |
|---|---|
| BaseRunner | Abstract runner blueprint all runners must extend |
| ZooConf | Parses conf.json, manages job ID, state |
| ZooInputs | Parses inputs.json, formats CWL-style parameters |
| ZooOutputs | Handles writing and setting output results |
| CWLWorkflow | Loads, parses, and analyzes CWL workflows |
| ResourceRequirement | Parses and evaluates CWL resource hints/requirements |
| wrapper_utils | Provides helper to build wrapped CWL pipeline |
| ZooStub | Interacts with ZOO's lenv for progress updates |
Used By
- zoo-wes-runner
- zoo-argowf-runner
- zoo-calrissian-runner
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zoo_runner_common-0.1.0.tar.gz.
File metadata
- Download URL: zoo_runner_common-0.1.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6473ccbc0c143a53dc3313f6d679d8e6c8084b3b8a38060575b44ba7fb76f1af
|
|
| MD5 |
7461c39f7793a9d489cc933aa5ffd212
|
|
| BLAKE2b-256 |
b4ae40506419c143042fb562c7d66a4c825be63f5a7177b78e89c990a8e77cba
|
Provenance
The following attestation bundles were made for zoo_runner_common-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on ZOO-Project/zoo-runner-common
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zoo_runner_common-0.1.0.tar.gz -
Subject digest:
6473ccbc0c143a53dc3313f6d679d8e6c8084b3b8a38060575b44ba7fb76f1af - Sigstore transparency entry: 833790443
- Sigstore integration time:
-
Permalink:
ZOO-Project/zoo-runner-common@eb87ad3e441e73d6ebc75a4e74d75e10069247e1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ZOO-Project
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@eb87ad3e441e73d6ebc75a4e74d75e10069247e1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file zoo_runner_common-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zoo_runner_common-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
075e5914d65397f244f16335cd451958265fe098ece5d9f98b7cc54181220089
|
|
| MD5 |
e69b6cae3953a112a264752ebb51fa10
|
|
| BLAKE2b-256 |
010ffec66f6150df2f9b03dd7489a97c4c4ed9f7615a4fe97583a6c64af2c2fe
|
Provenance
The following attestation bundles were made for zoo_runner_common-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on ZOO-Project/zoo-runner-common
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zoo_runner_common-0.1.0-py3-none-any.whl -
Subject digest:
075e5914d65397f244f16335cd451958265fe098ece5d9f98b7cc54181220089 - Sigstore transparency entry: 833790445
- Sigstore integration time:
-
Permalink:
ZOO-Project/zoo-runner-common@eb87ad3e441e73d6ebc75a4e74d75e10069247e1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ZOO-Project
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@eb87ad3e441e73d6ebc75a4e74d75e10069247e1 -
Trigger Event:
release
-
Statement type: