Skip to content

Resolve pipeline stages per dataset #883

Description

@ddeboer

Problem

PipelineOptions.stages is a fixed Stage[]: every selected dataset runs the same stages. The LODA pipeline (netwerk-digitaal-erfgoed/loda-pipeline#17) transforms six schema.org datasets to EDM in one run. All six share a generic stage set. denbosch also needs a compensator stage that lifts its source to schema.org first.

Today LODA runs one Pipeline per dataset: one process each, with no writer run or reporter shared between them.

Proposal

Accept a function of the dataset, as Stage.sourceFor already does for the distribution:

stages: Stage<Out>[] | ((dataset: Dataset) => Stage<Out>[] | Promise<Stage<Out>[]>);

A plain array keeps its current meaning, so this is not a breaking change.

Open questions

Activity

  1. added theissue type on Oct 6, 2026
  2. daanjo3 commented on Oct 7, 2026

    @daanjo3

    Interesting proposal. I think it would be good to point out that this change would make the pipeline definition dynamic rather than static.

    On one hand this is nice as it add flexibility and allows the implementer to use the same pipeline for datasets with different structures. Though it does also make it more difficult to reason and predict what steps the pipeline will be taking at any particular time.

    Another (admittedly not ideal) approach could be to add a skip mechanic on a Stage level instead (skipping a stage based on some contextual value);

    skip: (dataset: Dataset) => boolean

    However this would be inefficient if there are many datasets bringing their own optional compensator step. And it would mean that the parent of a skipped substage should use the original dataset as input rather than the substage output. Which would be a bit of a weird quirk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions