Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conditional Step Execution (Skip/Prune) #10

@incorvia

Description

@incorvia

Introduce conditional logic to the Yantra::Workflow#run DSL to allow steps or entire downstream branches, which are defined and persisted initially, to be either skipped or pruned (deleted) based on runtime conditions evaluated after prerequisite steps complete. This could be implemented via new options like run_if: ->(outputs) { condition } or if_condition: ->(outputs) { condition }, condition_mode: :skip | :prune. The primary motivation is to avoid executing unnecessary steps in patterns like "try batch, fallback to individual", and optionally remove their persisted records (prune mode) to keep the database clean. Implementation requires storing the condition, evaluating it when prerequisites finish (using parent outputs or workflow globals), and triggering new orchestration logic to either update the state of descendant steps to skipped or initiate a bulk deletion (pruning) of the descendant step records and their dependencies. This feature needs careful consideration regarding how skipped/pruned steps affect downstream dependencies, especially finalizer steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions