Skip to content

External orchestration for Microsoft Fabric (DIRECT 2.2.0) - #51

Merged
RoelantVos merged 9 commits into
mainfrom
feature/fabric-orchestration
Oct 26, 2026
Merged

RoelantVos merged 9 commits into
mainfrom
feature/fabric-orchestration

Conversation

@RoelantVos

@RoelantVos RoelantVos commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds support for running DIRECT Batches and Modules from an orchestrator outside the repository database, with Microsoft Fabric as the first target: the repository is a SQL database in Fabric, the data and the Module executables live in a Fabric Warehouse, and Data Factory pipelines drive the runs. A Batch run is three activity runs regardless of the number of Modules and child Batches.

Repository (dacpac)

  • New procedure omd.CreateBatchModuleInstances: creates and evaluates a Batch Instance and the Module Instances of all active Modules in the Batch, in sequence, and returns one row per Module (Module Instance Id, executable, previous load window end value, Internal Processing Status Code, rollback statement, optional consistency timestamp). Nothing is executed. @ReturnResultSet = 'N' returns the rows as JSON in @ResultJson instead of a result set. @IncludeChildBatches = 'Y' also opens the active child Batches, recursively and in sequence after the Modules of the Batch itself (the order of omd.RunBatch), and lists the Batch Instances in @BatchInstancesJson. A Batch that cannot be fully opened fails what it did open.
  • New procedure omd.EndBatchModuleInstances: closes the Module Instances from a JSON array of results (event, load window, row counts, failure detail), fails Module Instances left without a result, and closes the Batch Instance. With @IncludeChildBatches = 'Y' it closes the child Batch Instances from the deepest level up; a failed Module or child Batch Instance fails its Batch Instance, an aborted child does not (@FailedBatchCount).
  • New view omd_processing.vw_BATCH_HIERARCHY.
  • omd.ModuleEvaluation: new parameter @ExecuteRollbackIndicator and output @RollbackStatement, so the rollback can run on the engine that holds the data.
  • omd.GetConsistencyTimestamp: new parameter @SourceDataLookupIndicator to work from repository information only.
  • Three pre-existing fixes found by the first pipeline runs: omd.BatchEvaluation built an invalid IN ((1,2)) list in the partial rollback branch; the post-deployment seed of omd.MODULE_INSTANCE merged on BATCH_INSTANCE_ID and overwrote every standalone Module Instance on each publish; omd.ModuleEvaluation quoted an already quoted target in the rollback statement.
  • Version bumped to 2.2.0 (Directory.Build.props, .direct-version, Releases.Direct_Framework/next/version.json, FRAMEWORK_METADATA). No table changes, so no migration script.
  • Release notes and a new documentation section on external orchestration.
  • Integration tests for the two procedures and the view (OmdBatchModuleInstancesTests, 14 tests).

fabric folder

  • Standard pipelines DIRECT Run Batch (a Batch with all its child Batches, any depth, in three activity runs) and DIRECT Run Module in the Fabric Git item layout, bound by name to a Variable Library DIRECT (workspace, repository and Warehouse items, connections, load window conventions).
  • Activity T-SQL in fabric/sql, templates in fabric/templates, and Build-PipelineDefinitions.ps1 to regenerate the item definitions.
  • Deploy-DirectFabric.ps1 (connections, Variable Library, pipelines through the REST API), Invoke-DirectPipeline.ps1 (run on demand) and Set-DirectSchedule.ps1 (trickle feed schedule).
  • README with the executable contract (@ModuleInstanceId, @StartValue, @EndValue, @ConsistencyDateTime).

Testing

  • Debug and Release builds succeed with 0 errors; the only warning is the Microsoft.Build.Sql 2.3.0 availability notice.
  • Integration tests (Testcontainers): 23 of 23 pass.
  • The dacpac was published into a DIRECT repository in a SQL database in Fabric, and the pipelines were deployed to a test workspace with Deploy-DirectFabric.ps1.
  • DIRECT Run Batch was run end to end on a four Module Batch (landing, persistent staging, hub, satellite on a Warehouse): 54 s and 47 s, load windows carried over to the next run, zero rows loaded on the rerun.
  • A three level hierarchy (main Batch, layer Batch, leaf Batch with the Modules) was run twice through DIRECT Run Batch (60 s and 48 s, three Batch Instances linked by PARENT_BATCH_INSTANCE_ID, Modules run under the leaf, outcomes travel up), followed by a direct run of the leaf Batch (43 s).

🤖 Generated with Claude Code

https://claude.ai/code/session_01P8xKsmMZRuuoGUZqqpAmVK

Roelant Vos and others added 9 commits October 26, 2026 09:17
New procedures omd.CreateBatchModuleInstances and omd.EndBatchModuleInstances
open and close all instances of a Batch in one call each, so that an
orchestrator outside the repository database can run the Module executables
on another engine such as a Fabric Warehouse. omd.ModuleEvaluation can hand
the rollback statement back to the caller (@ExecuteRollbackIndicator) and
omd.GetConsistencyTimestamp can work from repository information only
(@SourceDataLookupIndicator). New view omd_processing.vw_BATCH_HIERARCHY.

The fabric folder holds the standard pipelines DIRECT Run Project, DIRECT
Run Batch and DIRECT Run Module (Fabric Git item layout), a Variable Library
definition, the activity scripts, and PowerShell scripts to build the
definitions, deploy, run and schedule them. Release notes, documentation
and integration tests are included; the version is bumped to 2.2.0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8xKsmMZRuuoGUZqqpAmVK
Resolves the SR0013 and SR0014 static analysis warnings reported by the
dacpac build for the new and changed procedures.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8xKsmMZRuuoGUZqqpAmVK
The safety net already adds brackets when the target has none; quoting
the result again produced invalid names for schema-qualified targets
such as [lnd].[LND_CUSTOMER] (found while testing the Fabric hand-off).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8xKsmMZRuuoGUZqqpAmVK
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8xKsmMZRuuoGUZqqpAmVK
… in the first pipeline run

omd.CreateBatchModuleInstances gets @ReturnResultSet and the output parameter @ResultJson so the
Open Batch Script activity no longer needs INSERT ... EXEC, which wrapped the call in a transaction
that a failed evaluation dooms. A Batch evaluation that returns neither Proceed nor Abort or Cancel
now fails the procedure instead of creating Module Instances.

Fixed pre-existing issues: omd.BatchEvaluation built an invalid IN ((1,2)) list in the partial
rollback branch; the post-deployment seed of omd.MODULE_INSTANCE merged on BATCH_INSTANCE_ID and
overwrote every standalone Module Instance; omd.ModuleEvaluation doubled the parentheses around the
Module Instance id list in the returned rollback statement.

Two integration tests cover the JSON output and the run after two failed Batch Instances. The
pipeline definitions are regenerated from the templates.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8xKsmMZRuuoGUZqqpAmVK
…ets as deleted rows

Run Modules used the current time as load window end when the source held no rows, so the recorded
end value ran ahead of the data. An empty source now keeps the end at the start value; the current
time remains the fallback for a source without the load window attribute.

The row counts from the target counts before and after now report a target with fewer rows than
before (a truncate-and-load table) as deleted and reloaded instead of a negative insert count.
Close Module passes RowCountDeleted along.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8xKsmMZRuuoGUZqqpAmVK
omd.CreateBatchModuleInstances gets @IncludeChildBatches: after the Modules of the Batch it opens the
active child Batches recursively and in sequence, each with its parent Batch Instance, in the order
omd.RunBatch uses. The new output parameter @BatchInstancesJson lists the Batch Instances that were
created. A Batch that cannot be fully opened now fails the Module and Batch Instances it did open.

omd.EndBatchModuleInstances gets the same option and the output parameter @FailedBatchCount: Module
Instances of child Batch Instances are accepted, unreported ones are failed, and the child Batch
Instances are closed from the deepest level up before the Batch Instance itself. A failed Module or
child Batch Instance fails its Batch Instance; a child that aborted in its evaluation does not.

DIRECT Run Batch uses both options, so a main Batch that calls a Batch per layer, which call their
own Batches, runs as one pipeline run with three activity runs and a Batch Instance per level. Run
Modules keeps the array order of the rows and reports the Batch per Module. DIRECT Run Project is
removed; any Batch in the hierarchy runs with DIRECT Run Batch.

Four integration tests cover the run order, closing on success, failure travelling up and a skipped
aborted child Batch.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8xKsmMZRuuoGUZqqpAmVK
…wo analysis warnings

The child Batch of the test arrangement now carries a Module, so the view test expects one row from
the child instead of none. The failure path of omd.CreateBatchModuleInstances joins its table
variables instead of using IN on nullable columns, and the child Batch Instance selection in
omd.EndBatchModuleInstances guards the nullable status column.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8xKsmMZRuuoGUZqqpAmVK
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