Skip to content

feat: DAG workflow engine (phases 2-8)#51

Merged
pratyush618 merged 12 commits intomasterfrom
feat/workflow-ecosystem
Apr 16, 2026
Merged

feat: DAG workflow engine (phases 2-8)#51
pratyush618 merged 12 commits intomasterfrom
feat/workflow-ecosystem

Conversation

@pratyush618
Copy link
Copy Markdown
Collaborator

@pratyush618 pratyush618 commented Apr 16, 2026

Summary

  • Phase 1 — Rust taskito-workflows crate with WorkflowDefinition, WorkflowRun, WorkflowNode types, SQLite storage, topology module, and state machine (25 Rust tests)
  • Phase 2 — Linear execution: Workflow builder, depends_on job chains, WorkflowTracker event-driven completion
  • Phase 3 — Fan-out/fan-in: Dynamic child node expansion (fan_out="each"), result aggregation (fan_in="all")
  • Phase 4 — Conditional execution: condition="on_success"/"on_failure"/"always" + callable conditions with WorkflowContext, on_failure="continue" mode, recursive skip propagation
  • Phase 5 — Advanced DAG: Approval gates with timeout/auto-resolve, sub-workflow composition via WorkflowProxy.as_step(), cron-scheduled workflows
  • Phase 6 — Graph analysis: critical_path(), execution_plan(), bottleneck_analysis(), ancestors()/descendants(), topological_levels(), stats()
  • Phase 7 — Incremental caching: Result hashing (SHA-256), CACHE_HIT node status, dirty-set propagation, cache TTL
  • Phase 8 — Visualization: Mermaid and DOT diagram rendering with status colors on Workflow and WorkflowRun

Test plan

  • cargo test --workspace --features workflows — 73 Rust tests
  • uv run python -m pytest tests/python/ -v — 431 Python tests (74 new workflow tests)
  • cargo check --workspace / --features postgres / --features redis — all feature combos compile
  • uv run ruff check py_src/ tests/python/ — clean
  • uv run mypy py_src/taskito/ --no-incremental — 0 errors in 91 files

New taskito-workflows crate with WorkflowDefinition, WorkflowRun,
WorkflowNode types, SQLite storage, topology module, and state machine.

PyO3 bindings: PyWorkflowBuilder, PyWorkflowHandle, PyWorkflowRunStatus,
plus PyQueue methods for submit, mark result, cancel, fan-out expansion,
deferred job creation, approval gates, sub-workflow support, incremental
caching, and visualization DAG retrieval.
- Workflow builder with step(), gate(), fan_out/fan_in, conditions
- WorkflowTracker with conditional orchestration, skip propagation
- Fan-out strategy module (each), fan-in aggregation
- Approval gate support with timeout and auto-resolve
- Sub-workflow composition via WorkflowProxy.as_step()
- WorkflowContext for callable conditions
- Incremental caching with dirty-set computation
- Graph analysis: critical path, execution plan, bottleneck
- Mermaid and DOT visualization renderers
- Cron-scheduled workflow support via bridge task pattern
- Type stubs and event types updated
- test_workflows_linear: 15 tests (Phase 2)
- test_workflows_fan_out: 11 tests (Phase 3)
- test_workflows_conditions: 13 tests (Phase 4)
- test_workflows_gates: 6 tests (Phase 5A)
- test_workflows_subworkflow: 4 tests (Phase 5B)
- test_workflows_cron: 1 test (Phase 5D)
- test_workflows_analysis: 12 tests (Phase 6)
- test_workflows_caching: 7 tests (Phase 7)
- test_workflows_visualization: 5 tests (Phase 8)
Expand guide/core/workflows.md with DAG workflows covering fan-out,
conditions, gates, sub-workflows, cron scheduling, incremental runs,
visualization, and graph analysis. Canvas primitives moved to bottom.

New api/workflows.md with full API reference for Workflow, WorkflowRun,
WorkflowProxy, queue methods, and all type definitions.
The local path ../dagron/crates/dagron-core doesn't exist in CI.
Switch to a git dependency pointing at the ByteVeda/dagron repo.
New docs/workflows/ section with 9 pages:
- Overview with system architecture diagram
- Building Workflows (step config, decorator, node state machine)
- Fan-Out & Fan-In (sequence diagram, empty/failure handling)
- Conditions & Error Handling (fail_fast vs continue diagrams)
- Approval Gates (timeout, events)
- Sub-Workflows & Scheduling (composition diagram, cron)
- Incremental Runs (dirty-set propagation diagrams)
- Analysis & Visualization (critical path, bottleneck, Mermaid/DOT)
- Canvas Primitives (comparison table vs DAG workflows)

Also fixes mypy CI failures:
- Widen Workflow.step() task param to Any (accepts duck-typed objects)
- Fix test type annotations for sorted(), tuple hints, bool returns
Define a runtime-checkable Protocol instead of using Any for the
task parameter. Accepts TaskWrapper, SubWorkflowRef, or any object
with a _task_name attribute — type-safe without being overly rigid.
Break architecture.md into 8 pages: overview, job lifecycle, worker
pool, storage (with ER diagram), scheduler, resource system, failure
model, and serialization. Replace raw SQL schema with Mermaid erDiagram.

Add docs/examples/workflows.md with 6 patterns: ML pipeline with
approval gate, map-reduce fan-out, continue mode, multi-region
sub-workflows, incremental runs, and pre-execution analysis.

Fix workflow index diagram (flowchart TD without subgraph overlap).
CI and publish workflows passed --features explicitly, which replaces
pyproject's default set. This dropped 'workflows' from the compiled
extension, causing PyWorkflowBuilder ImportError in tests and breaking
workflow support in released wheels.

- ci.yml: add extension-module,postgres,redis,workflows
- publish.yml: add native-async,workflows (4 platforms)
- Swatinem/rust-cache v2.8.2 -> v2.9.1 (Node.js 20 deprecation)
- actions/setup-node v4 -> v6 (Node.js 20 deprecation)
- cache-dependency-glob uv.lock -> pyproject.toml (uv.lock is gitignored)
- jobs.tsx: drop unused statsError, refetchStats destructure
@pratyush618 pratyush618 self-assigned this Apr 16, 2026
New feature release for the DAG workflow ecosystem. See changelog
for full feature list.
@pratyush618 pratyush618 merged commit 431b80a into master Apr 16, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant