Skip to content

Final Report

ARYAN KHARE edited this page Aug 31, 2025 · 4 revisions

Title and Organization

  • Project: Migrating and updating the existing CWL runners
  • Organization: OSGeo (Open Source Geospatial Foundation), ZOO-Project

Project Description

The project focuses on migrating and updating the existing CWL runners within the ZOO-Project to create a centralized, modular, and AI-ready framework. It will unify multiple runners (WES, Argo, Calrissian) under a single repository, reduce code duplication through reusable components, and introduce an abstract base class for consistency. The work also includes developing standardized service templates, automated CI/CD testing pipelines, and clear documentation, making it easier for developers to add new runners and ensuring reliable execution of geospatial and Earth Observation workflows.

State of the Project Before GSoC

Before your project, the ZOO-Project CWL runners faced several challenges: Scattered Repositories: 
Each runner (WES, Argo, Calrissian) had its own separate GitHub repository. No single entry point to access all runners in one place. Code Duplication: 
Each runner had its way of handling input validation, execution, and logging. Common functionalities were repeated across different runners, making maintenance harder. Difficult to Add New Runners: 
No clear documentation or template for creating a new runner. New developers had to analyze existing code instead of following a structured guide. No Centralized Testing: 
Each runner had separate testing setups, leading to inconsistent quality. No automated way to test all runners in one place.

Benefits to the Community / Additions to the Software

  • Improved Code Quality
    Unit tests serve as living documentation of expected behavior, ensuring each component functions correctly. This directly enhances the overall quality of the codebase.

  • Enhanced Reliability
    Unit tests act as a safety net, quickly detecting regressions after code changes and maintaining the stability and reliability of the software.

  • Faster Development Cycles
    Automated testing enables rapid iterations, allowing developers to confidently make changes without breaking existing functionalities, thereby accelerating the development process.

  • Increased Maintainability
    By validating code changes early, unit tests make it easier to refactor, optimize, and extend the software without introducing regressions, ultimately reducing long-term maintenance costs.

Outcomes of the Project (Exhaustive)

This section enumerates all concrete outcomes delivered in the project: code artifacts, structural refactors, packaging work, CI/CD, tests, documentation, and process improvements. It’s designed so a maintainer can quickly see what exists now, where to find it, and how it improves ZOO-Project sustainability.

1) Architecture & Organization

  • Single Entry Point for All Runners

    • zoo-cwl-runners/main_runner.py provides a unified CLI and programmatic interface to invoke runners (ArgoWF, WES, Calrissian).
    • Lazy import mechanism ensures import main_runner works without runner deps installed (enables fast unit tests and decoupled packaging).
    • Supports CI/locally vendored dependencies via deps/ and optional ZOO_CWL_RUNNERS_DEPS env var.
  • Separation of Concerns Across Repositories

    • Runners remain in their own repos (no monorepo lock-in).
    • Service templates remain in their own repos.
    • Common logic moved to two dedicated, installable packages:
      • zoo-runner-common (runners’ shared utilities)
      • zoo-template-common (service templates’ shared utilities)
  • Repository Interconnection Strategy

    • Central hub: zoo-cwl-runners (entry point, CI).
    • Consumers: runners and templates.
    • Providers: zoo-runner-common, zoo-template-common.

2) Common Libraries (New, Packaged, Reusable)

  • zoo-runner-common

    • BaseRunner: abstract base defining runner lifecycle and expected API.
    • ZooConf, ZooInputs, ZooOutputs: standardized configuration and I/O handling.
    • ZooStub: centralized status/progress stub compatible with ZOO kernel expectations.
    • Outcome: removes duplicated base code across all runners; single source of truth for runner plumbing.
  • zoo-template-common

    • ExecutionHandler: common hooks (pre_execution_hook, post_execution_hook, handle_outputs, get_secrets, get_additional_parameters, get_pod_env_vars, get_pod_node_selector); extensible via **kwargs.
    • CustomStacIO: S3-aware STAC I/O (read/write), configurable endpoint/credentials; usable by any template.
    • Outcome: eliminates per-template copies of handler/STAC logic; enables consistent behavior and easier evolution.
  • Packaging

    • Both commons include pyproject.toml; installable via pip install -e ..
    • Proper package layout (zoo_template_common/…, py-modules for zoo-runner-common).
    • Tags prepared for initial baseline (v0.1.0).

3) Runners Refactor (WES, ArgoWF, Calrissian)

  • Code De-duplication

    • Removed local duplicates of ZooStub, base classes, and handler scaffolding.
    • Runners now import from zoo-runner-common.
  • Compatibility Maintained

    • Public APIs preserved where practical.
    • Runner-specific logic kept isolated; shared logic moved to commons.
  • Dry-Run Friendly

    • Runners can be instantiated with a minimal CWL dict in CI for smoke tests (no cluster needed).
  • Limitations Acknowledged

    • Calrissian CI excluded due to pycalrissian distribution constraints; documented as known limitation without blocking other outcomes.

4) Service Templates Standardization (4 Repos)

  • Templates Updated to Use Commons

    • Import ExecutionHandler & CustomStacIO from zoo-template-common.
    • Import ZooStub from zoo-runner-common.
    • Outcome: consistent template behavior, simplified customization path, and uniform code style.
  • Cookiecutter Layouts Preserved

    • Templates remain separate (no central template repo), as requested.
    • Function-specific overrides supported via **kwargs in handlers.

5) CI/CD (GitHub Actions) — Repeatable & Fast

  • Two-Job Pipeline in zoo-cwl-runners

    • Unit job (fast):
      • Python 3.10 pinned (resolves upstream dependency conflicts).
      • Sanity tests for repo integrity and main_runner import (lazy imports).
    • Integration job (smoke-level):
      • Checks out runner & common repos under deps/.
      • Installs commons and runners via pip install -e deps/....
      • Runs smoke tests (ArgoWF, WES) with minimal CWL dicts.
      • Skips Calrissian (-k "not calrissian") due to upstream packaging constraints.
  • Deterministic & Documented

    • Python pin (3.10) recorded in workflow and docs.
    • Tests segregated with markers (-m integration, tests/unit).
    • Optional env var (ZOO_CWL_RUNNERS_DEPS) for path overrides.
  • Outcome: Continuous verification of structure, imports, and basic instantiation; stable foundation for future full E2E tests.

6) Testing Outcomes

  • Unit Tests

    • tests/unit/test_repo_sanity.py: validates main_runner importability, callable symbols, and repo structure.
    • Import fails are prevented by lazy imports; no runner install required.
  • Integration (Smoke) Tests

    • Instantiate ArgoWF and WES runners with dummy CWL configs.
    • Avoid calls that require real resource evaluation or external services.
    • Outcome: quick, non-flaky checks that catch regressions in constructor paths and light plumbing.
  • Test Infra Hygiene

    • pytest.ini, markers, and selective -k usage formalized.
    • Suite is intentionally lightweight for CI; extensible later for E2E.

7) Documentation & Onboarding

  • READMEs

    • zoo-runner-common/README.md: component inventory, import examples, quick start.
    • zoo-template-common/README.md: handler & STAC I/O usage, override patterns.
    • zoo-cwl-runners README updates: CI overview, Python pin, badge (ready to add).
  • Developer Guide

    • “How to Implement a New CWL Runner for ZOO-Project”:
      • Architecture overview, runner class skeleton, wiring into main_runner.
      • Examples of smoke tests, packaging pointers, and documentation guidance.
  • Outcome: Faster onboarding for new contributors; shared vocabulary and expectations across repos.

8) Dependency & Environment Stabilization

  • Python Standardization

    • Pin to Python 3.10 across CI to avoid incompatibilities (cwl-utils, schema_salad, pycalrissian).
    • Clear documentation of the rationale and mitigation steps.
  • Requirements Hygiene

    • Consistent version pins where needed.
    • Avoid top-level imports of heavy/optional deps (lazy imports pattern).
  • Outcome: Reproducible builds and green CI across all jobs.

9) Developer Experience (DX) Improvements

  • Modular, Extensible APIs

    • ExecutionHandler with well-defined overridable methods and **kwargs safety.
    • BaseRunner offering a predictable lifecycle surface.
    • Shared config/IO helpers reduce boilerplate and cognitive load.
  • Local Dev Friendly

    • Clear workspace strategy (deps/ in CI; sibling repos locally).
    • pip install -e workflows for commons/runners/templates.
  • Outcome: Lower barrier to entry for contributors; predictable patterns across repos.

10) Governance & Maintenance Benefits

  • Single Source of Truth

    • Shared logic consolidated; updates now propagate via commons.
    • Reduced risk of divergence/bit-rot between runners/templates.
  • CI as a Safety Net

    • Even minimal tests now guard against regressions in core pathways.
    • Clear path to intensify tests without redesigning CI.
  • Documented Limitations

    • Transparent note on Calrissian/pycalrissian and next steps; avoids hidden pitfalls.

11) Items Deferred (Transparent Scope Boundary)

  • Calrissian Integration in CI

    • Blocked by upstream packaging; left documented & excluded from CI flow.
  • End-to-End Execution Tests

    • Not in scope for this iteration; would require cluster/WES infra and/or mocks.
  • PyPI Publications

    • Commons are package-ready; publish to PyPI/testPyPI as a follow-up (semantic versioning, release automation).

12) Net Impact

  • Maintainability Up: Shared modules, fewer copies, single entry point, CI.
  • Extensibility Up: Adding a new runner/template is clearer and lighter.
  • Reliability Up: Automated checks catch breakages early; Python pin avoids churn.
  • Community Onboarding Up: Guides and READMEs reduce ramp-up time.
  • Standards Alignment: Cleaner path to OGC API–Processes compliance across backends.

In one line: The project transformed a fragmented, duplicated ecosystem into a modular, tested, and documented platform with a single entry point, shared libraries, and CI — setting up ZOO-Project for easier growth and community contributions.

Potential Future Work

While this project achieved its main objectives — consolidating runners, refactoring service templates, introducing commons, and integrating CI/CD — there remain several areas for future development to further strengthen the ZOO-Project ecosystem.

1. Calrissian Runner Full Integration

  • Current Issue: Integration tests for zoo-calrissian-runner were excluded due to pycalrissian packaging problems on Python 3.10+.
  • Future Work:
    • Collaborate with upstream maintainers to fix pycalrissian packaging for stable Python releases.
    • Re-enable Calrissian smoke tests in CI.
    • Add Kubernetes-based mock tests (using kind or Minikube) to validate stage-in/stage-out logic.

2. End-to-End Workflow Execution Tests

  • Current State: CI validates runner initialization only (smoke tests).
  • Future Work:
    • Deploy lightweight infrastructure for Argo Workflows and WES mock servers during CI runs.
    • Execute real CWL workflows (e.g., water-body detection, S2 composites).
    • Validate STAC catalog outputs, logs, and metrics against golden files.
    • Enable nightly builds for heavier integration scenarios.

3. Packaging & PyPI Distribution

  • Current State: zoo-runner-common and zoo-template-common are installable via pip install -e, but not published.
  • Future Work:
    • Publish both packages to PyPI with semantic versioning.
    • Automate releases via GitHub Actions (publish.yml) triggered on tag.
    • Encourage runners and templates to depend on published commons, reducing reliance on relative imports or deps/.

4. Documentation Expansion

  • Current State: README files and a developer guide exist, but spread across repos.
  • Future Work:
    • Create a unified documentation site (MkDocs + Material or Sphinx).
    • Include:
      • Runner API references.
      • Service template guides.
      • Example deployments.
      • Architecture diagrams.
    • Host under https://zoo-project.github.io.

5. CI/CD Enhancements

  • Current State: Basic unit and smoke tests integrated in GitHub Actions.
  • Future Work:
    • Add coverage reporting (Codecov or Coveralls).
    • Add type checking (mypy) and linting (black, pylint) as CI jobs.
    • Enable matrix testing across Python versions (3.10–3.12).
    • Explore containerized test runners (Docker) for consistent environments.

6. New Runner & Template Development

  • Future Opportunities:
    • Implement additional runners for emerging execution backends (e.g., Nextflow, Snakemake).
    • Provide new service templates for geospatial use cases (wildfire detection, crop monitoring).
    • Extend ExecutionHandler with support for advanced features:
      • GPU scheduling hints.
      • Persistent volumes.
      • Cloud-native storage tiers.

7. Community Adoption & Governance

  • Future Work:
    • Upstream contributions: merge final changes into official ZOO-Project GitHub organization.
    • Present at OSGeo and OGC working groups to drive adoption.
    • Encourage external EOEPCA projects to migrate to standardized runners/templates.

8. Scalability & Performance

  • Future Work:
    • Benchmark different runners (ArgoWF vs WES vs Calrissian) on real workloads.
    • Profile and optimize resource evaluation (eval_resource) logic.
    • Explore parallel execution strategies and caching layers.

What I Have Learned

  • Technical Skills

    • Learned Python packaging (pyproject.toml, setuptools, poetry, hatch) and dependency management.
    • Designed modular and reusable components using abstract classes (BaseRunner, ExecutionHandler).
    • Built CI/CD pipelines with GitHub Actions, integrating both unit and integration tests.
    • Developed lightweight unit and smoke tests for multi-repository ecosystems.
  • Open Source Practices

    • Managed code across distributed repositories with differing structures and branch strategies.
    • Understood the value of documentation and developer guides for contributor onboarding.
    • Reduced duplication by centralizing common logic into shared repositories.
  • Personal Growth

    • Strengthened problem-solving skills when handling dependency conflicts and upstream package issues.
    • Improved communication through weekly reports and mentor collaboration.
    • Gained confidence contributing to large-scale open source projects aligned with OGC standards.

Links

Clone this wiki locally