UCD.js Docs

Pipeline Executor

Architecture notes for @ucdjs/pipeline-executor

@ucdjs/pipeline-executor is the runtime that executes pipeline definitions against source files.

Role

  • Orders pipelines and routes, resolves versions, and executes matched files.
  • Applies caching, tracing, logging, and output materialization.
  • Turns pure pipeline definitions into concrete execution results.

Mental Model

The executor has two layers:

  • createPipelineExecutor() orders multiple pipelines and wraps execution in runtime logging
  • run() executes one pipeline version-by-version and route-by-route

The critical runtime responsibilities are:

  • source listing
  • route matching
  • parse/transform/resolve execution
  • cache lookup and writeback
  • output materialization and summary creation

Method Flows

createPipelineExecutor().run()

PipelineExecutionRuntimerun()orderPipelinesByPublishedOutputDependencies()createPipelineExecutor()PipelineExecutionRuntimerun()orderPipelinesByPublishedOutputDependencies()createPipelineExecutor()loop[each ordered pipeline]CallercreatePipelineExecutor({ runtime, cacheStore, onLog })executor.run(pipelines, options)runWithLogHandler(onLog)topologically order pipelines by pipeline-output depsrun single pipelinePipelineExecutionResultresult[]Caller

Single pipeline execution

processing queueSourceAdaptercreateRunCtx()run()processing queueSourceAdaptercreateRunCtx()run()loop[each route layer]loop[each version]Executorrun({ pipeline, runOptions, cacheStore, runtime })resolve versions, routesByLayer, outputs, source adapterlistFiles(version)FileContext[]apply global include filterenqueue matched files up to concurrencyexecuteMatchedFile()execute unmatched-file fallback or strict failureoutputs, errors, summary, statusExecutor

Matched file execution

materializeOutputs()executeParseResolve()cache storeexecuteMatchedFile()materializeOutputs()executeParseResolve()cache storeexecuteMatchedFile()opt[cache enabled]opt[cache enabled]alt[cached result hit][cache miss]Runtimeroute matched filetryLoadCachedResult(cacheKey)cached outputsreuse cached dataparse -> transforms -> resolverroute outputsmaterialize output definitionsstoreCacheEntry()new outputs + manifest entriesRuntime

Design Notes

  • Pipeline ordering happens before execution so pipeline-output dependencies can cross pipeline boundaries.
  • Route ordering happens inside a pipeline through the DAG layers from pipeline-core.
  • The runtime abstraction owns spans, logging, and output capture so execution remains portable.
  • Errors are accumulated into execution results instead of crashing the whole batch whenever possible.

Testing Use

  • pipeline ordering and circular dependency failures
  • route-layer execution and concurrency behavior
  • cache hit/miss behavior
  • fallback and strict unmatched-file handling
  • summary accounting, tracing, and failure accumulation

On this page