@decaf-ts/as-graph 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +160 -2
- package/dist/as-graph.cjs +1 -1
- package/dist/as-graph.cjs.map +1 -1
- package/dist/as-graph.js +1 -1
- package/dist/as-graph.js.map +1 -1
- package/lib/cjs/dagster/DagsterGraphEventBridge.cjs +344 -0
- package/lib/cjs/dagster/DagsterGraphEventBridge.cjs.map +1 -0
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs +789 -0
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/dagster/DagsterResultMapper.cjs +56 -0
- package/lib/cjs/dagster/DagsterResultMapper.cjs.map +1 -0
- package/lib/cjs/dagster/DagsterTypes.cjs +4 -0
- package/lib/cjs/dagster/DagsterTypes.cjs.map +1 -0
- package/lib/cjs/dagster/capabilities.cjs +102 -0
- package/lib/cjs/dagster/capabilities.cjs.map +1 -0
- package/lib/cjs/dagster/constants.cjs +92 -0
- package/lib/cjs/dagster/constants.cjs.map +1 -0
- package/lib/cjs/dagster/index.cjs +32 -0
- package/lib/cjs/dagster/index.cjs.map +1 -0
- package/lib/cjs/engine/constants.cjs +6 -1
- package/lib/cjs/engine/constants.cjs.map +1 -1
- package/lib/cjs/engine/execution/GraphCodeMode.cjs +137 -0
- package/lib/cjs/engine/execution/GraphCodeMode.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionBackend.cjs +89 -0
- package/lib/cjs/engine/execution/GraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionBackendRegistry.cjs +107 -0
- package/lib/cjs/engine/execution/GraphExecutionBackendRegistry.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs +250 -733
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs.map +1 -1
- package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs +804 -0
- package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/engine/execution/index.cjs +4 -0
- package/lib/cjs/engine/execution/index.cjs.map +1 -1
- package/lib/cjs/engine/index.cjs +5 -0
- package/lib/cjs/engine/index.cjs.map +1 -1
- package/lib/cjs/engine/loops/ConditionEvaluator.cjs +116 -0
- package/lib/cjs/engine/loops/ConditionEvaluator.cjs.map +1 -0
- package/lib/cjs/engine/loops/GraphConditionEvaluator.cjs +25 -2
- package/lib/cjs/engine/loops/GraphConditionEvaluator.cjs.map +1 -1
- package/lib/cjs/engine/loops/index.cjs +1 -0
- package/lib/cjs/engine/loops/index.cjs.map +1 -1
- package/lib/cjs/engine/runs/GraphRunService.cjs +121 -3
- package/lib/cjs/engine/runs/GraphRunService.cjs.map +1 -1
- package/lib/cjs/engine/runs/InMemoryGraphRunStore.cjs +33 -0
- package/lib/cjs/engine/runs/InMemoryGraphRunStore.cjs.map +1 -1
- package/lib/cjs/engine/runs/ownership.cjs +100 -11
- package/lib/cjs/engine/runs/ownership.cjs.map +1 -1
- package/lib/cjs/engine/services/GraphRunModelService.cjs +16 -0
- package/lib/cjs/engine/services/GraphRunModelService.cjs.map +1 -1
- package/lib/cjs/engine/services/GraphWorkflowService.cjs +153 -16
- package/lib/cjs/engine/services/GraphWorkflowService.cjs.map +1 -1
- package/lib/cjs/mastra/MastraCapabilities.cjs +171 -0
- package/lib/cjs/mastra/MastraCapabilities.cjs.map +1 -0
- package/lib/cjs/mastra/MastraConditionBridge.cjs +39 -0
- package/lib/cjs/mastra/MastraConditionBridge.cjs.map +1 -0
- package/lib/cjs/mastra/MastraEventBridge.cjs +486 -0
- package/lib/cjs/mastra/MastraEventBridge.cjs.map +1 -0
- package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs +351 -0
- package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/mastra/MastraResumeGuard.cjs +127 -0
- package/lib/cjs/mastra/MastraResumeGuard.cjs.map +1 -0
- package/lib/cjs/mastra/MastraSchemaConverter.cjs +124 -0
- package/lib/cjs/mastra/MastraSchemaConverter.cjs.map +1 -0
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs +461 -0
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs.map +1 -0
- package/lib/cjs/mastra/MastraWorkflowManager.cjs +401 -0
- package/lib/cjs/mastra/MastraWorkflowManager.cjs.map +1 -0
- package/lib/cjs/mastra/index.cjs +35 -0
- package/lib/cjs/mastra/index.cjs.map +1 -0
- package/lib/cjs/mastra/types.cjs +34 -0
- package/lib/cjs/mastra/types.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityManifest.cjs +136 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityManifest.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityService.cjs +140 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityService.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphEngineController.cjs +227 -0
- package/lib/cjs/nest/graph/GraphEngineController.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs +30 -2
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphRunController.cjs +208 -28
- package/lib/cjs/nest/graph/GraphRunController.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs +97 -14
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs.map +1 -1
- package/lib/cjs/nest/graph/index.cjs +3 -0
- package/lib/cjs/nest/graph/index.cjs.map +1 -1
- package/lib/cjs/nest/graph/main.cjs +54 -0
- package/lib/cjs/nest/graph/main.cjs.map +1 -0
- package/lib/cjs/nest/graph/servingDates.cjs +53 -0
- package/lib/cjs/nest/graph/servingDates.cjs.map +1 -0
- package/lib/cjs/nest/graph/servingErrors.cjs +68 -0
- package/lib/cjs/nest/graph/servingErrors.cjs.map +1 -0
- package/lib/cjs/node/flow/if/node.cjs +27 -9
- package/lib/cjs/node/flow/if/node.cjs.map +1 -1
- package/lib/cjs/node/flow/loop/until/node.cjs +5 -2
- package/lib/cjs/node/flow/loop/until/node.cjs.map +1 -1
- package/lib/cjs/node/flow/loop/while/node.cjs +8 -2
- package/lib/cjs/node/flow/loop/while/node.cjs.map +1 -1
- package/lib/cjs/node/flow/switch/node.cjs +2 -37
- package/lib/cjs/node/flow/switch/node.cjs.map +1 -1
- package/lib/cjs/node/utility/code/node.cjs +11 -3
- package/lib/cjs/node/utility/code/node.cjs.map +1 -1
- package/lib/cjs/ram/GraphRunStore.cjs +14 -0
- package/lib/cjs/ram/GraphRunStore.cjs.map +1 -1
- package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs +2 -3
- package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs.map +1 -1
- package/lib/cjs/shared/graph/constants.cjs +8 -0
- package/lib/cjs/shared/graph/constants.cjs.map +1 -1
- package/lib/cjs/shared/graph/index.cjs +2 -1
- package/lib/cjs/shared/graph/index.cjs.map +1 -1
- package/lib/cjs/shared/graph/layout/GraphWorkflowLayout.cjs +146 -0
- package/lib/cjs/shared/graph/layout/GraphWorkflowLayout.cjs.map +1 -0
- package/lib/cjs/shared/graph/layout/index.cjs +23 -0
- package/lib/cjs/shared/graph/layout/index.cjs.map +1 -0
- package/lib/cjs/shared/graph/layout/layout-options.cjs +93 -0
- package/lib/cjs/shared/graph/layout/layout-options.cjs.map +1 -0
- package/lib/cjs/shared/ui/index.cjs +8 -10
- package/lib/cjs/shared/ui/index.cjs.map +1 -1
- package/lib/esm/dagster/DagsterGraphEventBridge.js +339 -0
- package/lib/esm/dagster/DagsterGraphEventBridge.js.map +1 -0
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js +781 -0
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js.map +1 -0
- package/lib/esm/dagster/DagsterResultMapper.js +51 -0
- package/lib/esm/dagster/DagsterResultMapper.js.map +1 -0
- package/lib/esm/dagster/DagsterTypes.js +2 -0
- package/lib/esm/dagster/DagsterTypes.js.map +1 -0
- package/lib/esm/dagster/capabilities.js +97 -0
- package/lib/esm/dagster/capabilities.js.map +1 -0
- package/lib/esm/dagster/constants.js +88 -0
- package/lib/esm/dagster/constants.js.map +1 -0
- package/lib/esm/dagster/index.js +15 -0
- package/lib/esm/dagster/index.js.map +1 -0
- package/lib/esm/engine/constants.js +5 -0
- package/lib/esm/engine/constants.js.map +1 -1
- package/lib/esm/engine/execution/GraphCodeMode.js +132 -0
- package/lib/esm/engine/execution/GraphCodeMode.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionBackend.js +83 -0
- package/lib/esm/engine/execution/GraphExecutionBackend.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionBackendRegistry.js +102 -0
- package/lib/esm/engine/execution/GraphExecutionBackendRegistry.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionEngine.js +232 -716
- package/lib/esm/engine/execution/GraphExecutionEngine.js.map +1 -1
- package/lib/esm/engine/execution/LocalGraphExecutionBackend.js +799 -0
- package/lib/esm/engine/execution/LocalGraphExecutionBackend.js.map +1 -0
- package/lib/esm/engine/execution/index.js +4 -0
- package/lib/esm/engine/execution/index.js.map +1 -1
- package/lib/esm/engine/index.js +5 -0
- package/lib/esm/engine/index.js.map +1 -1
- package/lib/esm/engine/loops/ConditionEvaluator.js +108 -0
- package/lib/esm/engine/loops/ConditionEvaluator.js.map +1 -0
- package/lib/esm/engine/loops/GraphConditionEvaluator.js +25 -2
- package/lib/esm/engine/loops/GraphConditionEvaluator.js.map +1 -1
- package/lib/esm/engine/loops/index.js +1 -0
- package/lib/esm/engine/loops/index.js.map +1 -1
- package/lib/esm/engine/runs/GraphRunService.js +123 -5
- package/lib/esm/engine/runs/GraphRunService.js.map +1 -1
- package/lib/esm/engine/runs/InMemoryGraphRunStore.js +33 -0
- package/lib/esm/engine/runs/InMemoryGraphRunStore.js.map +1 -1
- package/lib/esm/engine/runs/ownership.js +97 -11
- package/lib/esm/engine/runs/ownership.js.map +1 -1
- package/lib/esm/engine/services/GraphRunModelService.js +16 -0
- package/lib/esm/engine/services/GraphRunModelService.js.map +1 -1
- package/lib/esm/engine/services/GraphWorkflowService.js +155 -18
- package/lib/esm/engine/services/GraphWorkflowService.js.map +1 -1
- package/lib/esm/mastra/MastraCapabilities.js +164 -0
- package/lib/esm/mastra/MastraCapabilities.js.map +1 -0
- package/lib/esm/mastra/MastraConditionBridge.js +34 -0
- package/lib/esm/mastra/MastraConditionBridge.js.map +1 -0
- package/lib/esm/mastra/MastraEventBridge.js +481 -0
- package/lib/esm/mastra/MastraEventBridge.js.map +1 -0
- package/lib/esm/mastra/MastraGraphExecutionBackend.js +346 -0
- package/lib/esm/mastra/MastraGraphExecutionBackend.js.map +1 -0
- package/lib/esm/mastra/MastraResumeGuard.js +123 -0
- package/lib/esm/mastra/MastraResumeGuard.js.map +1 -0
- package/lib/esm/mastra/MastraSchemaConverter.js +119 -0
- package/lib/esm/mastra/MastraSchemaConverter.js.map +1 -0
- package/lib/esm/mastra/MastraWorkflowCompiler.js +456 -0
- package/lib/esm/mastra/MastraWorkflowCompiler.js.map +1 -0
- package/lib/esm/mastra/MastraWorkflowManager.js +396 -0
- package/lib/esm/mastra/MastraWorkflowManager.js.map +1 -0
- package/lib/esm/mastra/index.js +18 -0
- package/lib/esm/mastra/index.js.map +1 -0
- package/lib/esm/mastra/types.js +30 -0
- package/lib/esm/mastra/types.js.map +1 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityManifest.js +129 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityManifest.js.map +1 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityService.js +131 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityService.js.map +1 -0
- package/lib/esm/nest/graph/GraphEngineController.js +218 -0
- package/lib/esm/nest/graph/GraphEngineController.js.map +1 -0
- package/lib/esm/nest/graph/GraphExecutionModule.js +30 -2
- package/lib/esm/nest/graph/GraphExecutionModule.js.map +1 -1
- package/lib/esm/nest/graph/GraphRunController.js +209 -29
- package/lib/esm/nest/graph/GraphRunController.js.map +1 -1
- package/lib/esm/nest/graph/GraphWorkflowController.js +98 -15
- package/lib/esm/nest/graph/GraphWorkflowController.js.map +1 -1
- package/lib/esm/nest/graph/index.js +3 -0
- package/lib/esm/nest/graph/index.js.map +1 -1
- package/lib/esm/nest/graph/main.js +51 -0
- package/lib/esm/nest/graph/main.js.map +1 -0
- package/lib/esm/nest/graph/servingDates.js +49 -0
- package/lib/esm/nest/graph/servingDates.js.map +1 -0
- package/lib/esm/nest/graph/servingErrors.js +63 -0
- package/lib/esm/nest/graph/servingErrors.js.map +1 -0
- package/lib/esm/node/flow/if/node.js +27 -9
- package/lib/esm/node/flow/if/node.js.map +1 -1
- package/lib/esm/node/flow/loop/until/node.js +5 -2
- package/lib/esm/node/flow/loop/until/node.js.map +1 -1
- package/lib/esm/node/flow/loop/while/node.js +8 -2
- package/lib/esm/node/flow/loop/while/node.js.map +1 -1
- package/lib/esm/node/flow/switch/node.js +2 -37
- package/lib/esm/node/flow/switch/node.js.map +1 -1
- package/lib/esm/node/utility/code/node.js +11 -3
- package/lib/esm/node/utility/code/node.js.map +1 -1
- package/lib/esm/ram/GraphRunStore.js +14 -0
- package/lib/esm/ram/GraphRunStore.js.map +1 -1
- package/lib/esm/shared/graph/GraphExecutionStateMapper.js.map +1 -1
- package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js +2 -3
- package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js.map +1 -1
- package/lib/esm/shared/graph/constants.js +8 -0
- package/lib/esm/shared/graph/constants.js.map +1 -1
- package/lib/esm/shared/graph/document/GraphFlowBuilder.js.map +1 -1
- package/lib/esm/shared/graph/index.js +2 -1
- package/lib/esm/shared/graph/index.js.map +1 -1
- package/lib/esm/shared/graph/layout/GraphWorkflowLayout.js +107 -0
- package/lib/esm/shared/graph/layout/GraphWorkflowLayout.js.map +1 -0
- package/lib/esm/shared/graph/layout/index.js +6 -0
- package/lib/esm/shared/graph/layout/index.js.map +1 -0
- package/lib/esm/shared/graph/layout/layout-options.js +96 -0
- package/lib/esm/shared/graph/layout/layout-options.js.map +1 -0
- package/lib/esm/shared/ui/index.js +8 -10
- package/lib/esm/shared/ui/index.js.map +1 -1
- package/lib/types/dagster/DagsterGraphEventBridge.d.cts +142 -0
- package/lib/types/dagster/DagsterGraphEventBridge.d.mts +142 -0
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.cts +323 -0
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.mts +323 -0
- package/lib/types/dagster/DagsterResultMapper.d.cts +50 -0
- package/lib/types/dagster/DagsterResultMapper.d.mts +50 -0
- package/lib/types/dagster/DagsterTypes.d.cts +355 -0
- package/lib/types/dagster/DagsterTypes.d.mts +355 -0
- package/lib/types/dagster/capabilities.d.cts +34 -0
- package/lib/types/dagster/capabilities.d.mts +34 -0
- package/lib/types/dagster/constants.d.cts +87 -0
- package/lib/types/dagster/constants.d.mts +87 -0
- package/lib/types/dagster/index.d.cts +14 -0
- package/lib/types/dagster/index.d.mts +14 -0
- package/lib/types/engine/constants.d.cts +5 -0
- package/lib/types/engine/constants.d.mts +5 -0
- package/lib/types/engine/execution/GraphCodeMode.d.cts +52 -0
- package/lib/types/engine/execution/GraphCodeMode.d.mts +52 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.cts +306 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.mts +306 -0
- package/lib/types/engine/execution/GraphExecutionBackendRegistry.d.cts +59 -0
- package/lib/types/engine/execution/GraphExecutionBackendRegistry.d.mts +59 -0
- package/lib/types/engine/execution/GraphExecutionEngine.d.cts +116 -135
- package/lib/types/engine/execution/GraphExecutionEngine.d.mts +116 -135
- package/lib/types/engine/execution/LocalGraphExecutionBackend.d.cts +232 -0
- package/lib/types/engine/execution/LocalGraphExecutionBackend.d.mts +232 -0
- package/lib/types/engine/execution/index.d.cts +4 -0
- package/lib/types/engine/execution/index.d.mts +4 -0
- package/lib/types/engine/index.d.cts +5 -0
- package/lib/types/engine/index.d.mts +5 -0
- package/lib/types/engine/loops/ConditionEvaluator.d.cts +87 -0
- package/lib/types/engine/loops/ConditionEvaluator.d.mts +87 -0
- package/lib/types/engine/loops/GraphConditionEvaluator.d.cts +27 -7
- package/lib/types/engine/loops/GraphConditionEvaluator.d.mts +27 -7
- package/lib/types/engine/loops/index.d.cts +1 -0
- package/lib/types/engine/loops/index.d.mts +1 -0
- package/lib/types/engine/runs/GraphRunService.d.cts +60 -1
- package/lib/types/engine/runs/GraphRunService.d.mts +60 -1
- package/lib/types/engine/runs/InMemoryGraphRunStore.d.cts +29 -0
- package/lib/types/engine/runs/InMemoryGraphRunStore.d.mts +29 -0
- package/lib/types/engine/runs/ownership.d.cts +89 -4
- package/lib/types/engine/runs/ownership.d.mts +89 -4
- package/lib/types/engine/runs/types.d.cts +12 -1
- package/lib/types/engine/runs/types.d.mts +12 -1
- package/lib/types/engine/services/GraphRunModelService.d.cts +13 -0
- package/lib/types/engine/services/GraphRunModelService.d.mts +13 -0
- package/lib/types/engine/services/GraphWorkflowService.d.cts +74 -2
- package/lib/types/engine/services/GraphWorkflowService.d.mts +74 -2
- package/lib/types/engine/types.d.cts +11 -4
- package/lib/types/engine/types.d.mts +11 -4
- package/lib/types/mastra/MastraCapabilities.d.cts +91 -0
- package/lib/types/mastra/MastraCapabilities.d.mts +91 -0
- package/lib/types/mastra/MastraConditionBridge.d.cts +38 -0
- package/lib/types/mastra/MastraConditionBridge.d.mts +38 -0
- package/lib/types/mastra/MastraEventBridge.d.cts +189 -0
- package/lib/types/mastra/MastraEventBridge.d.mts +189 -0
- package/lib/types/mastra/MastraGraphExecutionBackend.d.cts +119 -0
- package/lib/types/mastra/MastraGraphExecutionBackend.d.mts +119 -0
- package/lib/types/mastra/MastraResumeGuard.d.cts +58 -0
- package/lib/types/mastra/MastraResumeGuard.d.mts +58 -0
- package/lib/types/mastra/MastraSchemaConverter.d.cts +39 -0
- package/lib/types/mastra/MastraSchemaConverter.d.mts +39 -0
- package/lib/types/mastra/MastraWorkflowCompiler.d.cts +218 -0
- package/lib/types/mastra/MastraWorkflowCompiler.d.mts +218 -0
- package/lib/types/mastra/MastraWorkflowManager.d.cts +220 -0
- package/lib/types/mastra/MastraWorkflowManager.d.mts +220 -0
- package/lib/types/mastra/index.d.cts +17 -0
- package/lib/types/mastra/index.d.mts +17 -0
- package/lib/types/mastra/types.d.cts +222 -0
- package/lib/types/mastra/types.d.mts +222 -0
- package/lib/types/nest/graph/GraphEngineCapabilityManifest.d.cts +87 -0
- package/lib/types/nest/graph/GraphEngineCapabilityManifest.d.mts +87 -0
- package/lib/types/nest/graph/GraphEngineCapabilityService.d.cts +98 -0
- package/lib/types/nest/graph/GraphEngineCapabilityService.d.mts +98 -0
- package/lib/types/nest/graph/GraphEngineController.d.cts +74 -0
- package/lib/types/nest/graph/GraphEngineController.d.mts +74 -0
- package/lib/types/nest/graph/GraphExecutionModule.d.cts +14 -1
- package/lib/types/nest/graph/GraphExecutionModule.d.mts +14 -1
- package/lib/types/nest/graph/GraphRunController.d.cts +69 -14
- package/lib/types/nest/graph/GraphRunController.d.mts +69 -14
- package/lib/types/nest/graph/GraphWorkflowController.d.cts +50 -17
- package/lib/types/nest/graph/GraphWorkflowController.d.mts +50 -17
- package/lib/types/nest/graph/index.d.cts +3 -0
- package/lib/types/nest/graph/index.d.mts +3 -0
- package/lib/types/nest/graph/main.d.cts +1 -0
- package/lib/types/nest/graph/main.d.mts +1 -0
- package/lib/types/nest/graph/servingDates.d.cts +35 -0
- package/lib/types/nest/graph/servingDates.d.mts +35 -0
- package/lib/types/nest/graph/servingErrors.d.cts +44 -0
- package/lib/types/nest/graph/servingErrors.d.mts +44 -0
- package/lib/types/node/flow/if/node.d.cts +20 -8
- package/lib/types/node/flow/if/node.d.mts +20 -8
- package/lib/types/node/flow/loop/until/node.d.cts +4 -1
- package/lib/types/node/flow/loop/until/node.d.mts +4 -1
- package/lib/types/node/flow/loop/while/node.d.cts +4 -1
- package/lib/types/node/flow/loop/while/node.d.mts +4 -1
- package/lib/types/node/utility/code/node.d.cts +1 -1
- package/lib/types/node/utility/code/node.d.mts +1 -1
- package/lib/types/ram/GraphRunStore.d.cts +12 -0
- package/lib/types/ram/GraphRunStore.d.mts +12 -0
- package/lib/types/shared/graph/GraphExecutionStateMapper.d.cts +5 -5
- package/lib/types/shared/graph/GraphExecutionStateMapper.d.mts +5 -5
- package/lib/types/shared/graph/constants.d.cts +8 -0
- package/lib/types/shared/graph/constants.d.mts +8 -0
- package/lib/types/shared/graph/document/GraphFlowBuilder.d.cts +5 -5
- package/lib/types/shared/graph/document/GraphFlowBuilder.d.mts +5 -5
- package/lib/types/shared/graph/index.d.cts +2 -1
- package/lib/types/shared/graph/index.d.mts +2 -1
- package/lib/types/shared/graph/layout/GraphWorkflowLayout.d.cts +49 -0
- package/lib/types/shared/graph/layout/GraphWorkflowLayout.d.mts +49 -0
- package/lib/types/shared/graph/layout/index.d.cts +5 -0
- package/lib/types/shared/graph/layout/index.d.mts +5 -0
- package/lib/types/shared/graph/layout/layout-options.d.cts +46 -0
- package/lib/types/shared/graph/layout/layout-options.d.mts +46 -0
- package/lib/types/shared/graph/types.d.cts +12 -4
- package/lib/types/shared/graph/types.d.mts +12 -4
- package/lib/types/shared/ui/index.d.cts +8 -10
- package/lib/types/shared/ui/index.d.mts +8 -10
- package/package.json +49 -6
- package/lib/cjs/shared/ui/GraphNodeView.cjs +0 -114
- package/lib/cjs/shared/ui/GraphNodeView.cjs.map +0 -1
- package/lib/cjs/shared/ui/GraphRunView.cjs +0 -96
- package/lib/cjs/shared/ui/GraphRunView.cjs.map +0 -1
- package/lib/cjs/shared/ui/GraphWorkflowView.cjs +0 -78
- package/lib/cjs/shared/ui/GraphWorkflowView.cjs.map +0 -1
- package/lib/cjs/shared/ui/types.cjs +0 -4
- package/lib/cjs/shared/ui/types.cjs.map +0 -1
- package/lib/esm/shared/ui/GraphNodeView.js +0 -107
- package/lib/esm/shared/ui/GraphNodeView.js.map +0 -1
- package/lib/esm/shared/ui/GraphRunView.js +0 -90
- package/lib/esm/shared/ui/GraphRunView.js.map +0 -1
- package/lib/esm/shared/ui/GraphWorkflowView.js +0 -72
- package/lib/esm/shared/ui/GraphWorkflowView.js.map +0 -1
- package/lib/esm/shared/ui/types.js +0 -2
- package/lib/esm/shared/ui/types.js.map +0 -1
- package/lib/types/shared/ui/GraphNodeView.d.cts +0 -48
- package/lib/types/shared/ui/GraphNodeView.d.mts +0 -48
- package/lib/types/shared/ui/GraphRunView.d.cts +0 -88
- package/lib/types/shared/ui/GraphRunView.d.mts +0 -88
- package/lib/types/shared/ui/GraphWorkflowView.d.cts +0 -18
- package/lib/types/shared/ui/GraphWorkflowView.d.mts +0 -18
- package/lib/types/shared/ui/types.d.cts +0 -200
- package/lib/types/shared/ui/types.d.mts +0 -200
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DagsterGraphExecutionBackend = void 0;
|
|
4
|
+
exports.dagsterNodeIdsByOpName = dagsterNodeIdsByOpName;
|
|
5
|
+
exports.dagsterNodeIdsByOpNameFromDocument = dagsterNodeIdsByOpNameFromDocument;
|
|
6
|
+
exports.dagsterJobDocument = dagsterJobDocument;
|
|
7
|
+
const index_js_1 = require("./../engine/errors/index.cjs");
|
|
8
|
+
const GraphExecutionBackendRegistry_js_1 = require("./../engine/execution/GraphExecutionBackendRegistry.cjs");
|
|
9
|
+
const constants_js_1 = require("./constants.cjs");
|
|
10
|
+
const capabilities_js_1 = require("./capabilities.cjs");
|
|
11
|
+
const DagsterGraphEventBridge_js_1 = require("./DagsterGraphEventBridge.cjs");
|
|
12
|
+
const DagsterResultMapper_js_1 = require("./DagsterResultMapper.cjs");
|
|
13
|
+
/**
|
|
14
|
+
* Default maximum time (ms) `execute`/`replayRun` await a launched/re-executed run
|
|
15
|
+
* to reach a terminal state before failing the operation closed. Matches the event
|
|
16
|
+
* bridge's default terminal timeout.
|
|
17
|
+
*/
|
|
18
|
+
const DEFAULT_EXECUTION_TERMINAL_TIMEOUT_MS = 5 * 60 * 1000;
|
|
19
|
+
/**
|
|
20
|
+
* Default interval (ms) between `getRun` polls while awaiting a launched run's
|
|
21
|
+
* terminal state. The driver waits through the read-only `getRun` surface and then
|
|
22
|
+
* observes the completed run through the event bridge.
|
|
23
|
+
*/
|
|
24
|
+
const DEFAULT_EXECUTION_POLL_INTERVAL_MS = 500;
|
|
25
|
+
/**
|
|
26
|
+
* The Dagster run statuses that are terminal. Only these end the terminal wait;
|
|
27
|
+
* every other status (including the real pending `QUEUED`/`STARTING`) is polled
|
|
28
|
+
* toward terminal, caller abort, or timeout (C5 fail-closed).
|
|
29
|
+
*/
|
|
30
|
+
const DAGSTER_TERMINAL_RUN_STATUSES = new Set([
|
|
31
|
+
"success",
|
|
32
|
+
"failure",
|
|
33
|
+
"canceled",
|
|
34
|
+
]);
|
|
35
|
+
/**
|
|
36
|
+
* Maximum accepted nesting depth of the allowlisted raw run config. Bounds the shape
|
|
37
|
+
* check so a deeply nested object cannot be forwarded as a transport bomb.
|
|
38
|
+
*/
|
|
39
|
+
const DAGSTER_RUN_CONFIG_MAX_DEPTH = 16;
|
|
40
|
+
/**
|
|
41
|
+
* Resolves the canonical node id of an inspected op. The deployment's own node id
|
|
42
|
+
* is used when exposed; otherwise the op name is the identity.
|
|
43
|
+
*
|
|
44
|
+
* @param op - The inspected Dagster op.
|
|
45
|
+
* @returns The canonical node id.
|
|
46
|
+
*/
|
|
47
|
+
function dagsterNodeIdOf(op) {
|
|
48
|
+
return op.nodeId ?? op.name;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Builds the inspected job's op-name → canonical node-id map. The event bridge
|
|
52
|
+
* uses it to resolve Dagster step keys onto canonical node ids for an existing run.
|
|
53
|
+
*
|
|
54
|
+
* @param job - The inspected Dagster job record.
|
|
55
|
+
* @returns The op-name → node-id map.
|
|
56
|
+
*/
|
|
57
|
+
function dagsterNodeIdsByOpName(job) {
|
|
58
|
+
const map = {};
|
|
59
|
+
for (const op of job.ops ?? []) {
|
|
60
|
+
map[op.name] = dagsterNodeIdOf(op);
|
|
61
|
+
}
|
|
62
|
+
return map;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Builds the op-name → canonical node-id map from an already-mapped canonical
|
|
66
|
+
* document. The event bridge uses it to resolve Dagster step keys onto canonical
|
|
67
|
+
* node ids for a run the driver launched from that document, without re-reading
|
|
68
|
+
* the job.
|
|
69
|
+
*
|
|
70
|
+
* @param document - The canonical document of the launched job.
|
|
71
|
+
* @returns The op-name → node-id map.
|
|
72
|
+
*/
|
|
73
|
+
function dagsterNodeIdsByOpNameFromDocument(document) {
|
|
74
|
+
const map = {};
|
|
75
|
+
for (const node of document.nodes ?? []) {
|
|
76
|
+
const opName = node.metadata?.["dagsterOpName"];
|
|
77
|
+
if (typeof opName === "string")
|
|
78
|
+
map[opName] = node.id;
|
|
79
|
+
}
|
|
80
|
+
return map;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Resolves the canonical workflow id a document describes from the document's own
|
|
84
|
+
* identity — never from its metadata. The document id wins; the document name is the
|
|
85
|
+
* fallback. Untrusted metadata can never steer which deployed job is selected (C2).
|
|
86
|
+
*
|
|
87
|
+
* @param document - The canonical workflow document.
|
|
88
|
+
* @returns The canonical workflow id.
|
|
89
|
+
*/
|
|
90
|
+
function dagsterCanonicalWorkflowIdOf(document) {
|
|
91
|
+
return document.id || document.name || "";
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Deep-clones a caller-supplied raw Dagster run config through a JSON-safe
|
|
95
|
+
* allowlist: only finite numbers, strings, booleans, `null`, arrays, and plain
|
|
96
|
+
* objects survive. Functions, symbols, `undefined`, class instances, dates, maps,
|
|
97
|
+
* and cyclic/over-deep structures are rejected with
|
|
98
|
+
* `GRAPH_DAGSTER_RUN_CONFIG_INVALID` (C4).
|
|
99
|
+
*
|
|
100
|
+
* @param value - The raw run config value to allowlist.
|
|
101
|
+
* @param depth - The current nesting depth.
|
|
102
|
+
* @returns The allowlisted clone.
|
|
103
|
+
* @throws {GraphExecutionError} `GRAPH_DAGSTER_RUN_CONFIG_INVALID` when the value
|
|
104
|
+
* is not JSON-safe.
|
|
105
|
+
*/
|
|
106
|
+
function dagsterAllowlistedRunConfig(value, depth) {
|
|
107
|
+
if (depth > DAGSTER_RUN_CONFIG_MAX_DEPTH) {
|
|
108
|
+
throw new index_js_1.GraphExecutionError(`Dagster run config exceeds the maximum nesting depth of ${DAGSTER_RUN_CONFIG_MAX_DEPTH}`, constants_js_1.DAGSTER_ERROR.RUN_CONFIG_INVALID);
|
|
109
|
+
}
|
|
110
|
+
const result = {};
|
|
111
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
112
|
+
result[key] = dagsterAllowlistedRunConfigValue(entry, depth + 1);
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Allowlists a single raw run config value, recursively. See
|
|
118
|
+
* {@link dagsterAllowlistedRunConfig}.
|
|
119
|
+
*
|
|
120
|
+
* @param value - The value to allowlist.
|
|
121
|
+
* @param depth - The current nesting depth.
|
|
122
|
+
* @returns The allowlisted clone.
|
|
123
|
+
* @throws {GraphExecutionError} `GRAPH_DAGSTER_RUN_CONFIG_INVALID` when the value
|
|
124
|
+
* is not JSON-safe.
|
|
125
|
+
*/
|
|
126
|
+
function dagsterAllowlistedRunConfigValue(value, depth) {
|
|
127
|
+
if (depth > DAGSTER_RUN_CONFIG_MAX_DEPTH) {
|
|
128
|
+
throw new index_js_1.GraphExecutionError(`Dagster run config exceeds the maximum nesting depth of ${DAGSTER_RUN_CONFIG_MAX_DEPTH}`, constants_js_1.DAGSTER_ERROR.RUN_CONFIG_INVALID);
|
|
129
|
+
}
|
|
130
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") {
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
if (typeof value === "number") {
|
|
134
|
+
if (!Number.isFinite(value)) {
|
|
135
|
+
throw new index_js_1.GraphExecutionError("Dagster run config contains a non-finite number", constants_js_1.DAGSTER_ERROR.RUN_CONFIG_INVALID);
|
|
136
|
+
}
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
if (Array.isArray(value)) {
|
|
140
|
+
return value.map((entry) => dagsterAllowlistedRunConfigValue(entry, depth + 1));
|
|
141
|
+
}
|
|
142
|
+
if (typeof value === "object") {
|
|
143
|
+
const prototype = Object.getPrototypeOf(value);
|
|
144
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
145
|
+
throw new index_js_1.GraphExecutionError("Dagster run config contains a non-plain object", constants_js_1.DAGSTER_ERROR.RUN_CONFIG_INVALID);
|
|
146
|
+
}
|
|
147
|
+
return dagsterAllowlistedRunConfig(value, depth);
|
|
148
|
+
}
|
|
149
|
+
throw new index_js_1.GraphExecutionError("Dagster run config contains a non-JSON-safe value", constants_js_1.DAGSTER_ERROR.RUN_CONFIG_INVALID);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Maps one inspected Dagster op onto a canonical node instance. Port names and
|
|
153
|
+
* asset keys travel as node metadata; no op body or Python source is carried.
|
|
154
|
+
*
|
|
155
|
+
* @param op - The inspected Dagster op.
|
|
156
|
+
* @returns The canonical node instance.
|
|
157
|
+
*/
|
|
158
|
+
function dagsterNodeOf(op) {
|
|
159
|
+
const metadata = { dagsterOpName: op.name };
|
|
160
|
+
if (op.inputs)
|
|
161
|
+
metadata["inputPorts"] = [...op.inputs];
|
|
162
|
+
if (op.outputs)
|
|
163
|
+
metadata["outputPorts"] = [...op.outputs];
|
|
164
|
+
if (op.assetKeys)
|
|
165
|
+
metadata["assetKeys"] = [...op.assetKeys];
|
|
166
|
+
return {
|
|
167
|
+
id: dagsterNodeIdOf(op),
|
|
168
|
+
kind: op.kind ?? constants_js_1.DAGSTER_DEFAULT_NODE_KIND,
|
|
169
|
+
label: op.name,
|
|
170
|
+
parameters: {},
|
|
171
|
+
metadata: metadata,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Maps the inspected job's op dependencies onto canonical edges. Each dependency
|
|
176
|
+
* connects the upstream op's first declared output to the downstream op's first
|
|
177
|
+
* declared input, falling back to stable default port names.
|
|
178
|
+
*
|
|
179
|
+
* @param job - The inspected Dagster job record.
|
|
180
|
+
* @returns The canonical edge instances.
|
|
181
|
+
*/
|
|
182
|
+
function dagsterEdgesOf(job) {
|
|
183
|
+
const byName = new Map();
|
|
184
|
+
for (const op of job.ops ?? [])
|
|
185
|
+
byName.set(op.name, op);
|
|
186
|
+
const edges = [];
|
|
187
|
+
(job.dependencies ?? []).forEach((dependency, index) => {
|
|
188
|
+
const from = byName.get(dependency.from);
|
|
189
|
+
const to = byName.get(dependency.to);
|
|
190
|
+
if (!from || !to)
|
|
191
|
+
return;
|
|
192
|
+
edges.push({
|
|
193
|
+
id: `dagster_dep_${index}`,
|
|
194
|
+
type: "data",
|
|
195
|
+
source: {
|
|
196
|
+
scope: "node",
|
|
197
|
+
nodeId: dagsterNodeIdOf(from),
|
|
198
|
+
port: from.outputs?.[0] ?? "result",
|
|
199
|
+
},
|
|
200
|
+
target: {
|
|
201
|
+
scope: "node",
|
|
202
|
+
nodeId: dagsterNodeIdOf(to),
|
|
203
|
+
port: to.inputs?.[0] ?? "value",
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
return edges;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Maps an inspected Dagster job record onto the canonical workflow document
|
|
211
|
+
* shape. The deployment structure (job name, ops, dependencies, asset keys,
|
|
212
|
+
* schedules/sensors) is carried as document metadata for read-only inspection;
|
|
213
|
+
* nothing is authored.
|
|
214
|
+
*
|
|
215
|
+
* @param job - The inspected Dagster job record.
|
|
216
|
+
* @returns The canonical workflow document.
|
|
217
|
+
*/
|
|
218
|
+
function dagsterJobDocument(job) {
|
|
219
|
+
const metadata = { dagsterJobName: job.name };
|
|
220
|
+
if (job.description !== undefined) {
|
|
221
|
+
metadata["description"] = job.description;
|
|
222
|
+
}
|
|
223
|
+
if (job.assetKeys !== undefined) {
|
|
224
|
+
metadata["assetKeys"] = [...job.assetKeys];
|
|
225
|
+
}
|
|
226
|
+
if (job.schedules !== undefined) {
|
|
227
|
+
metadata["schedules"] = job.schedules.map((schedule) => ({
|
|
228
|
+
name: schedule.name,
|
|
229
|
+
...(schedule.cron !== undefined ? { cron: schedule.cron } : {}),
|
|
230
|
+
...(schedule.timezone !== undefined
|
|
231
|
+
? { timezone: schedule.timezone }
|
|
232
|
+
: {}),
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
235
|
+
if (job.sensors !== undefined) {
|
|
236
|
+
metadata["sensors"] = job.sensors.map((sensor) => ({
|
|
237
|
+
name: sensor.name,
|
|
238
|
+
...(sensor.kind !== undefined ? { kind: sensor.kind } : {}),
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
id: job.name,
|
|
243
|
+
name: job.name,
|
|
244
|
+
inputs: [],
|
|
245
|
+
outputs: [],
|
|
246
|
+
nodes: (job.ops ?? []).map(dagsterNodeOf),
|
|
247
|
+
edges: dagsterEdgesOf(job),
|
|
248
|
+
metadata: metadata,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Non-local Dagster backend. Read-only by default; launches/replays EXISTING
|
|
253
|
+
* workflows only behind the explicit `executionEnabled` gate. Registers itself
|
|
254
|
+
* under {@link DAGSTER_BACKEND_FLAVOUR} on construction.
|
|
255
|
+
*/
|
|
256
|
+
class DagsterGraphExecutionBackend {
|
|
257
|
+
constructor() {
|
|
258
|
+
/** This backend reads a remote Dagster deployment, not an in-process engine. */
|
|
259
|
+
this.local = false;
|
|
260
|
+
/**
|
|
261
|
+
* Dagster never authors code-mode surfaces; the facade rejects them before
|
|
262
|
+
* delegating.
|
|
263
|
+
*/
|
|
264
|
+
this.codeMode = "unsupported";
|
|
265
|
+
this.mapper = new DagsterResultMapper_js_1.DagsterResultMapper();
|
|
266
|
+
this.bridges = new Map();
|
|
267
|
+
this.defaultTags = {};
|
|
268
|
+
this.executionEnabled = false;
|
|
269
|
+
GraphExecutionBackendRegistry_js_1.GraphExecutionBackendRegistry.register(constants_js_1.DAGSTER_BACKEND_FLAVOUR, this);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Resolves the host-injected client port and the explicit execution gate. The
|
|
273
|
+
* backend never reads a code sandbox evaluator.
|
|
274
|
+
*
|
|
275
|
+
* @param config - The backend configuration.
|
|
276
|
+
*/
|
|
277
|
+
async initialize(config) {
|
|
278
|
+
this.client = config.client;
|
|
279
|
+
this.defaultTags = config.tags ?? {};
|
|
280
|
+
this.executionEnabled = config.executionEnabled === true;
|
|
281
|
+
this._config = { ...config };
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* The backend configuration most recently resolved by {@link initialize}. The
|
|
285
|
+
* facade reads this during `GraphExecutionEngine.initialize` and merges its own
|
|
286
|
+
* facade-owned keys over it, so a host that configured the backend directly
|
|
287
|
+
* (including `executionEnabled`) before booting the engine does not lose that
|
|
288
|
+
* wiring.
|
|
289
|
+
*/
|
|
290
|
+
get config() {
|
|
291
|
+
return this._config;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Effective capability metadata: code-mode is `unsupported`; workflow
|
|
295
|
+
* listing/lookup is supported exactly when the client port exposes it.
|
|
296
|
+
*/
|
|
297
|
+
get capabilities() {
|
|
298
|
+
return (0, capabilities_js_1.dagsterBackendCapabilities)(this.client);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Lists the deployment's Dagster jobs through the client port.
|
|
302
|
+
*
|
|
303
|
+
* @returns Real workflow summaries.
|
|
304
|
+
* @throws {GraphExecutionError} when the client port exposes no job listing.
|
|
305
|
+
*/
|
|
306
|
+
async listWorkflows() {
|
|
307
|
+
const client = this.requireClient();
|
|
308
|
+
if (typeof client.listJobs !== "function") {
|
|
309
|
+
throw new index_js_1.GraphExecutionError("Dagster client port exposes no job listing; workflow listing is not supported", constants_js_1.DAGSTER_ERROR.WORKFLOWS_NOT_SUPPORTED);
|
|
310
|
+
}
|
|
311
|
+
const jobs = await client.listJobs();
|
|
312
|
+
return jobs.map((job) => ({
|
|
313
|
+
id: job.name,
|
|
314
|
+
name: job.name,
|
|
315
|
+
...(job.updatedAt !== undefined ? { updatedAt: job.updatedAt } : {}),
|
|
316
|
+
}));
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Reads a single already-deployed Dagster job through the client port and maps
|
|
320
|
+
* its ACTUAL deployment structure (graph/op structure, asset keys,
|
|
321
|
+
* schedules/sensors) into the canonical document shape.
|
|
322
|
+
*
|
|
323
|
+
* @param workflowId - The canonical workflow id (the Dagster job name).
|
|
324
|
+
* @returns A canonical document describing the existing job.
|
|
325
|
+
* @throws {GraphExecutionError} when the client port exposes no job lookup.
|
|
326
|
+
*/
|
|
327
|
+
async getWorkflow(workflowId) {
|
|
328
|
+
const client = this.requireClient();
|
|
329
|
+
if (typeof client.getJob !== "function") {
|
|
330
|
+
throw new index_js_1.GraphExecutionError("Dagster client port exposes no job lookup; workflow lookup is not supported", constants_js_1.DAGSTER_ERROR.WORKFLOWS_NOT_SUPPORTED);
|
|
331
|
+
}
|
|
332
|
+
const job = await client.getJob(workflowId);
|
|
333
|
+
return dagsterJobDocument(job);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Reads an EXISTING Dagster run's terminal record through the client port.
|
|
337
|
+
*
|
|
338
|
+
* @param runId - The Dagster run id.
|
|
339
|
+
* @returns The terminal run record.
|
|
340
|
+
*/
|
|
341
|
+
async getRun(runId) {
|
|
342
|
+
return await this.requireClient().getRun(runId);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Observes an EXISTING Dagster run: subscribes to its event stream, maps every
|
|
346
|
+
* event onto the canonical sink, and returns the canonical result of the terminal
|
|
347
|
+
* record. The driver never launches the run; the caller supplies the id of a run
|
|
348
|
+
* that already exists in the deployment.
|
|
349
|
+
*
|
|
350
|
+
* The request's bounds (`signal`, `maxEvents`, `maxPages`, `terminalTimeoutMs`)
|
|
351
|
+
* are forwarded to the event bridge so the observation always terminates: the
|
|
352
|
+
* event cap fails closed with `GRAPH_DAGSTER_EVENT_LIMIT_EXCEEDED`, the terminal
|
|
353
|
+
* wait with `GRAPH_DAGSTER_OBSERVE_TIMEOUT`, and an abort with
|
|
354
|
+
* `GRAPH_DAGSTER_OBSERVE_ABORTED`.
|
|
355
|
+
*
|
|
356
|
+
* @param request - The observe request (existing run id, workflow id, sink, and
|
|
357
|
+
* optional observation bounds).
|
|
358
|
+
* @returns The canonical execution result of the observed run.
|
|
359
|
+
* @throws {GraphExecutionError} when the run cannot be read or subscribed to,
|
|
360
|
+
* or when an observation bound is hit (see above).
|
|
361
|
+
*/
|
|
362
|
+
async observeRun(request) {
|
|
363
|
+
const client = this.requireClient();
|
|
364
|
+
const job = await client.getJob(request.workflowId);
|
|
365
|
+
const document = dagsterJobDocument(job);
|
|
366
|
+
const graphRunId = request.graphRunId ?? request.dagsterRunId;
|
|
367
|
+
return await this.observeRunEvents({
|
|
368
|
+
dagsterRunId: request.dagsterRunId,
|
|
369
|
+
graphRunId,
|
|
370
|
+
workflowId: request.workflowId,
|
|
371
|
+
document,
|
|
372
|
+
nodeIdsByOpName: dagsterNodeIdsByOpName(job),
|
|
373
|
+
events: request.events,
|
|
374
|
+
...(request.inputs !== undefined ? { inputs: request.inputs } : {}),
|
|
375
|
+
...(request.metadata !== undefined ? { metadata: request.metadata } : {}),
|
|
376
|
+
...(request.signal ? { signal: request.signal } : {}),
|
|
377
|
+
...(request.maxEvents !== undefined
|
|
378
|
+
? { maxEvents: request.maxEvents }
|
|
379
|
+
: {}),
|
|
380
|
+
...(request.maxPages !== undefined ? { maxPages: request.maxPages } : {}),
|
|
381
|
+
...(request.terminalTimeoutMs !== undefined
|
|
382
|
+
? { terminalTimeoutMs: request.terminalTimeoutMs }
|
|
383
|
+
: {}),
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Executes an ALREADY-DEPLOYED Dagster job: launches a run of the job the
|
|
388
|
+
* supplied document describes through the client port's `launchRun`, then
|
|
389
|
+
* observes it through the existing event bridge to a canonical result.
|
|
390
|
+
*
|
|
391
|
+
* The operation is gated: when `executionEnabled` is off it fails closed with
|
|
392
|
+
* `GRAPH_DAGSTER_EXECUTION_NOT_ENABLED` BEFORE any network call, and when the
|
|
393
|
+
* client port exposes no `launchRun` it fails closed with
|
|
394
|
+
* `GRAPH_DAGSTER_EXECUTION_NOT_SUPPORTED`. The driver never translates a
|
|
395
|
+
* document into Python; it launches a job the deployment already defines.
|
|
396
|
+
*
|
|
397
|
+
* The job is bound from the document's canonical workflow id and confirmed
|
|
398
|
+
* through the read-only `getJob` surface, never from the document's untrusted
|
|
399
|
+
* `metadata.dagsterJobName` (C2): a document whose metadata names a different
|
|
400
|
+
* job is rejected before any launch.
|
|
401
|
+
*
|
|
402
|
+
* @param request - The execution request (document, plan, inputs, options, sink).
|
|
403
|
+
* @returns The canonical execution result of the launched run.
|
|
404
|
+
* @throws {GraphExecutionError} `GRAPH_DAGSTER_EXECUTION_NOT_ENABLED` when the
|
|
405
|
+
* gate is off, `GRAPH_DAGSTER_EXECUTION_NOT_SUPPORTED` when the port exposes no
|
|
406
|
+
* launch, `GRAPH_DAGSTER_RUN_WORKFLOW_MISMATCH` when the document metadata
|
|
407
|
+
* names a different job, or `GRAPH_DAGSTER_RUN_LAUNCH_FAILED` when the launch
|
|
408
|
+
* fails.
|
|
409
|
+
*/
|
|
410
|
+
async execute(request) {
|
|
411
|
+
this.assertExecutionEnabled();
|
|
412
|
+
const client = this.requireClient();
|
|
413
|
+
if (typeof client.launchRun !== "function") {
|
|
414
|
+
throw new index_js_1.GraphExecutionError("Dagster client port exposes no launchRun; executing an existing workflow is not supported", constants_js_1.DAGSTER_ERROR.EXECUTION_NOT_SUPPORTED);
|
|
415
|
+
}
|
|
416
|
+
const document = request.document;
|
|
417
|
+
const workflowId = dagsterCanonicalWorkflowIdOf(document);
|
|
418
|
+
const jobName = await this.resolveCanonicalJobName(client, workflowId, document);
|
|
419
|
+
const graphRunId = request.options.runId ?? `dagster-${workflowId}-${Date.now()}`;
|
|
420
|
+
const runConfig = this.dagsterRunConfigOf(request.options.metadata);
|
|
421
|
+
const launched = await this.launchThroughPort(client, {
|
|
422
|
+
jobName,
|
|
423
|
+
graphRunId,
|
|
424
|
+
workflowId,
|
|
425
|
+
...(runConfig ? { runConfig } : {}),
|
|
426
|
+
});
|
|
427
|
+
await this.awaitRunTerminal(client, launched.runId, {
|
|
428
|
+
...(request.options.abortSignal
|
|
429
|
+
? { signal: request.options.abortSignal }
|
|
430
|
+
: {}),
|
|
431
|
+
});
|
|
432
|
+
return await this.observeRunEvents({
|
|
433
|
+
dagsterRunId: launched.runId,
|
|
434
|
+
graphRunId,
|
|
435
|
+
workflowId,
|
|
436
|
+
document,
|
|
437
|
+
nodeIdsByOpName: dagsterNodeIdsByOpNameFromDocument(document),
|
|
438
|
+
events: request.events,
|
|
439
|
+
inputs: request.inputs,
|
|
440
|
+
...(request.options.metadata !== undefined
|
|
441
|
+
? { metadata: request.options.metadata }
|
|
442
|
+
: {}),
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Replays (re-executes) an EXISTING Dagster run through the client port's
|
|
447
|
+
* `replayRun`, then observes the new run through the existing event bridge to a
|
|
448
|
+
* canonical result.
|
|
449
|
+
*
|
|
450
|
+
* The operation is gated: when `executionEnabled` is off it fails closed with
|
|
451
|
+
* `GRAPH_DAGSTER_EXECUTION_NOT_ENABLED` BEFORE any network call, and when the
|
|
452
|
+
* client port exposes no `replayRun` it fails closed with
|
|
453
|
+
* `GRAPH_DAGSTER_REPLAY_NOT_SUPPORTED`. The re-execution mechanism (GraphQL
|
|
454
|
+
* re-execution from the run id, or a re-launch of the run's job with its original
|
|
455
|
+
* configuration) is owned by the host transport; the driver only observes the
|
|
456
|
+
* resulting run.
|
|
457
|
+
*
|
|
458
|
+
* The caller-supplied run id is bound to the requested workflow before any
|
|
459
|
+
* re-execution (C1): the run's owning job is resolved through the read-only
|
|
460
|
+
* `getRun` surface and a cross-job replay, or a run whose owning job cannot be
|
|
461
|
+
* determined, is rejected before the re-execution is issued.
|
|
462
|
+
*
|
|
463
|
+
* @param request - The replay request (existing run id, workflow id, sink, bounds).
|
|
464
|
+
* @returns The canonical execution result of the re-executed run.
|
|
465
|
+
* @throws {GraphExecutionError} `GRAPH_DAGSTER_EXECUTION_NOT_ENABLED` when the
|
|
466
|
+
* gate is off, `GRAPH_DAGSTER_REPLAY_NOT_SUPPORTED` when the port exposes no
|
|
467
|
+
* replay, `GRAPH_DAGSTER_RUN_WORKFLOW_MISMATCH` when the run does not belong
|
|
468
|
+
* to the requested workflow, or `GRAPH_DAGSTER_RUN_LAUNCH_FAILED` when the
|
|
469
|
+
* re-execution fails.
|
|
470
|
+
*/
|
|
471
|
+
async replayRun(request) {
|
|
472
|
+
this.assertExecutionEnabled();
|
|
473
|
+
const client = this.requireClient();
|
|
474
|
+
if (typeof client.replayRun !== "function") {
|
|
475
|
+
throw new index_js_1.GraphExecutionError("Dagster client port exposes no replayRun; replaying an existing run is not supported", constants_js_1.DAGSTER_ERROR.REPLAY_NOT_SUPPORTED);
|
|
476
|
+
}
|
|
477
|
+
await this.assertRunOwnedByWorkflow(client, request.dagsterRunId, request.workflowId);
|
|
478
|
+
const job = await client.getJob(request.workflowId);
|
|
479
|
+
const document = dagsterJobDocument(job);
|
|
480
|
+
const graphRunId = request.graphRunId ?? `dagster-replay-${request.dagsterRunId}`;
|
|
481
|
+
const launched = await this.replayThroughPort(client, {
|
|
482
|
+
dagsterRunId: request.dagsterRunId,
|
|
483
|
+
jobName: request.workflowId,
|
|
484
|
+
graphRunId,
|
|
485
|
+
workflowId: request.workflowId,
|
|
486
|
+
});
|
|
487
|
+
await this.awaitRunTerminal(client, launched.runId, {
|
|
488
|
+
...(request.signal ? { signal: request.signal } : {}),
|
|
489
|
+
...(request.terminalTimeoutMs !== undefined
|
|
490
|
+
? { timeoutMs: request.terminalTimeoutMs }
|
|
491
|
+
: {}),
|
|
492
|
+
});
|
|
493
|
+
return await this.observeRunEvents({
|
|
494
|
+
dagsterRunId: launched.runId,
|
|
495
|
+
graphRunId,
|
|
496
|
+
workflowId: request.workflowId,
|
|
497
|
+
document,
|
|
498
|
+
nodeIdsByOpName: dagsterNodeIdsByOpName(job),
|
|
499
|
+
events: request.events,
|
|
500
|
+
...(request.inputs !== undefined ? { inputs: request.inputs } : {}),
|
|
501
|
+
...(request.metadata !== undefined ? { metadata: request.metadata } : {}),
|
|
502
|
+
...(request.signal ? { signal: request.signal } : {}),
|
|
503
|
+
...(request.maxEvents !== undefined
|
|
504
|
+
? { maxEvents: request.maxEvents }
|
|
505
|
+
: {}),
|
|
506
|
+
...(request.maxPages !== undefined ? { maxPages: request.maxPages } : {}),
|
|
507
|
+
...(request.terminalTimeoutMs !== undefined
|
|
508
|
+
? { terminalTimeoutMs: request.terminalTimeoutMs }
|
|
509
|
+
: {}),
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Terminates an EXISTING run through the client port.
|
|
514
|
+
*
|
|
515
|
+
* @param runId - The Dagster run id.
|
|
516
|
+
* @param reason - Optional cancellation reason.
|
|
517
|
+
* @returns `true` when a run was terminated.
|
|
518
|
+
*/
|
|
519
|
+
async cancel(runId, reason) {
|
|
520
|
+
const client = this.client;
|
|
521
|
+
if (!client)
|
|
522
|
+
return false;
|
|
523
|
+
await client.terminateRun(runId, reason);
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Releases the bridge resources associated with a run.
|
|
528
|
+
*
|
|
529
|
+
* @param runId - The canonical run id.
|
|
530
|
+
*/
|
|
531
|
+
async release(runId) {
|
|
532
|
+
const bridge = this.bridges.get(runId);
|
|
533
|
+
if (!bridge)
|
|
534
|
+
return;
|
|
535
|
+
await bridge.stop();
|
|
536
|
+
this.bridges.delete(runId);
|
|
537
|
+
}
|
|
538
|
+
/** Disposes the backend and the host-injected client port. */
|
|
539
|
+
async dispose() {
|
|
540
|
+
for (const bridge of this.bridges.values()) {
|
|
541
|
+
await bridge.stop();
|
|
542
|
+
}
|
|
543
|
+
this.bridges.clear();
|
|
544
|
+
await this.client?.dispose?.();
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Subscribes to an EXISTING (or just-launched) run's event stream, maps every
|
|
548
|
+
* event onto the canonical sink, and returns the canonical result of the
|
|
549
|
+
* terminal record. Shared by `observeRun`, `execute`, and `replayRun`.
|
|
550
|
+
*
|
|
551
|
+
* @param input - The run identity, document, op map, sink, and observation bounds.
|
|
552
|
+
* @returns The canonical execution result.
|
|
553
|
+
* @throws {GraphExecutionError} when the run cannot be read or subscribed to, or
|
|
554
|
+
* when an observation bound is hit.
|
|
555
|
+
*/
|
|
556
|
+
async observeRunEvents(input) {
|
|
557
|
+
const client = this.requireClient();
|
|
558
|
+
const bridge = new DagsterGraphEventBridge_js_1.DagsterGraphEventBridge({
|
|
559
|
+
dagsterRunId: input.dagsterRunId,
|
|
560
|
+
graphRunId: input.graphRunId,
|
|
561
|
+
workflowId: input.workflowId,
|
|
562
|
+
nodeIdsByOpName: input.nodeIdsByOpName,
|
|
563
|
+
sink: input.events,
|
|
564
|
+
client,
|
|
565
|
+
...(input.signal ? { signal: input.signal } : {}),
|
|
566
|
+
...(input.maxEvents !== undefined ? { maxEvents: input.maxEvents } : {}),
|
|
567
|
+
...(input.maxPages !== undefined ? { maxPages: input.maxPages } : {}),
|
|
568
|
+
...(input.terminalTimeoutMs !== undefined
|
|
569
|
+
? { terminalTimeoutMs: input.terminalTimeoutMs }
|
|
570
|
+
: {}),
|
|
571
|
+
});
|
|
572
|
+
this.bridges.set(input.graphRunId, bridge);
|
|
573
|
+
try {
|
|
574
|
+
await bridge.start();
|
|
575
|
+
const record = await bridge.waitForTerminal();
|
|
576
|
+
return this.mapper.map({
|
|
577
|
+
runId: input.graphRunId,
|
|
578
|
+
document: input.document,
|
|
579
|
+
inputs: input.inputs ?? {},
|
|
580
|
+
options: { runId: input.graphRunId, metadata: input.metadata },
|
|
581
|
+
record,
|
|
582
|
+
nodeResults: bridge.collectedNodeResults(),
|
|
583
|
+
events: [],
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
catch (error) {
|
|
587
|
+
if (error instanceof index_js_1.GraphExecutionError)
|
|
588
|
+
throw error;
|
|
589
|
+
throw new index_js_1.GraphExecutionError(error instanceof Error ? error.message : String(error), constants_js_1.DAGSTER_ERROR.RUN_FAILED, { runId: input.graphRunId });
|
|
590
|
+
}
|
|
591
|
+
finally {
|
|
592
|
+
await bridge.stop();
|
|
593
|
+
this.bridges.delete(input.graphRunId);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Launches a run through the port, mapping any transport failure onto the
|
|
598
|
+
* driver's machine-readable launch error.
|
|
599
|
+
*
|
|
600
|
+
* @param client - The wired client port.
|
|
601
|
+
* @param input - The job name, canonical run id, workflow id, and run config.
|
|
602
|
+
* @returns The launched run handle.
|
|
603
|
+
* @throws {GraphExecutionError} `GRAPH_DAGSTER_RUN_LAUNCH_FAILED`.
|
|
604
|
+
*/
|
|
605
|
+
async launchThroughPort(client, input) {
|
|
606
|
+
try {
|
|
607
|
+
return await client.launchRun({
|
|
608
|
+
jobName: input.jobName,
|
|
609
|
+
...(input.runConfig ? { runConfig: input.runConfig } : {}),
|
|
610
|
+
tags: this.executionTags(input.graphRunId, input.workflowId),
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
catch (error) {
|
|
614
|
+
if (error instanceof index_js_1.GraphExecutionError)
|
|
615
|
+
throw error;
|
|
616
|
+
throw new index_js_1.GraphExecutionError(error instanceof Error ? error.message : String(error), constants_js_1.DAGSTER_ERROR.RUN_LAUNCH_FAILED, { jobName: input.jobName, runId: input.graphRunId });
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Re-executes an existing run through the port, mapping any transport failure
|
|
621
|
+
* onto the driver's machine-readable launch error.
|
|
622
|
+
*
|
|
623
|
+
* @param client - The wired client port.
|
|
624
|
+
* @param input - The existing run id, job name, canonical run id, workflow id.
|
|
625
|
+
* @returns The re-executed run handle.
|
|
626
|
+
* @throws {GraphExecutionError} `GRAPH_DAGSTER_RUN_LAUNCH_FAILED`.
|
|
627
|
+
*/
|
|
628
|
+
async replayThroughPort(client, input) {
|
|
629
|
+
try {
|
|
630
|
+
return await client.replayRun({
|
|
631
|
+
dagsterRunId: input.dagsterRunId,
|
|
632
|
+
jobName: input.jobName,
|
|
633
|
+
tags: this.executionTags(input.graphRunId, input.workflowId),
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
catch (error) {
|
|
637
|
+
if (error instanceof index_js_1.GraphExecutionError)
|
|
638
|
+
throw error;
|
|
639
|
+
throw new index_js_1.GraphExecutionError(error instanceof Error ? error.message : String(error), constants_js_1.DAGSTER_ERROR.RUN_LAUNCH_FAILED, { runId: input.graphRunId });
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Resolves the canonical deployed job a requested workflow binds to and rejects
|
|
644
|
+
* any document whose untrusted `metadata.dagsterJobName` claims a different job
|
|
645
|
+
* BEFORE any launch (C2). The canonical id comes from the document's own
|
|
646
|
+
* identity and is confirmed through the read-only `getJob` surface, mirroring
|
|
647
|
+
* `replayRun`; an unknown workflow fails closed as a launch failure.
|
|
648
|
+
*
|
|
649
|
+
* @param client - The wired client port.
|
|
650
|
+
* @param workflowId - The canonical workflow id (the document's own identity).
|
|
651
|
+
* @param document - The canonical document whose metadata must agree.
|
|
652
|
+
* @returns The canonical deployed job name to launch.
|
|
653
|
+
* @throws {GraphExecutionError} `GRAPH_DAGSTER_RUN_WORKFLOW_MISMATCH` when the
|
|
654
|
+
* metadata names a different job, or `GRAPH_DAGSTER_RUN_LAUNCH_FAILED` when the
|
|
655
|
+
* canonical job cannot be resolved.
|
|
656
|
+
*/
|
|
657
|
+
async resolveCanonicalJobName(client, workflowId, document) {
|
|
658
|
+
const claimed = document.metadata?.["dagsterJobName"];
|
|
659
|
+
if (typeof claimed === "string" &&
|
|
660
|
+
claimed.length > 0 &&
|
|
661
|
+
claimed !== workflowId) {
|
|
662
|
+
throw new index_js_1.GraphExecutionError(`Workflow document '${workflowId}' declares a different Dagster job ('${claimed}'); refusing to launch a mismatched job`, constants_js_1.DAGSTER_ERROR.RUN_WORKFLOW_MISMATCH, { workflowId, claimedJobName: claimed });
|
|
663
|
+
}
|
|
664
|
+
try {
|
|
665
|
+
const job = await client.getJob(workflowId);
|
|
666
|
+
return job.name || workflowId;
|
|
667
|
+
}
|
|
668
|
+
catch (error) {
|
|
669
|
+
if (error instanceof index_js_1.GraphExecutionError)
|
|
670
|
+
throw error;
|
|
671
|
+
throw new index_js_1.GraphExecutionError(error instanceof Error ? error.message : String(error), constants_js_1.DAGSTER_ERROR.RUN_LAUNCH_FAILED, { jobName: workflowId });
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Asserts that a caller-supplied Dagster run id belongs to the requested
|
|
676
|
+
* workflow before it is re-executed (C1 BOLA guard). The run's owning job is
|
|
677
|
+
* resolved from the read-only `getRun` surface; a cross-job run, or a run whose
|
|
678
|
+
* owning job cannot be determined, is rejected before any re-execution.
|
|
679
|
+
*
|
|
680
|
+
* @param client - The wired client port.
|
|
681
|
+
* @param dagsterRunId - The caller-supplied run id to bind.
|
|
682
|
+
* @param workflowId - The workflow the run must belong to.
|
|
683
|
+
* @throws {GraphExecutionError} `GRAPH_DAGSTER_RUN_WORKFLOW_MISMATCH` when the
|
|
684
|
+
* run is foreign or its owning job cannot be determined.
|
|
685
|
+
*/
|
|
686
|
+
async assertRunOwnedByWorkflow(client, dagsterRunId, workflowId) {
|
|
687
|
+
let record;
|
|
688
|
+
try {
|
|
689
|
+
record = await client.getRun(dagsterRunId);
|
|
690
|
+
}
|
|
691
|
+
catch (error) {
|
|
692
|
+
if (error instanceof index_js_1.GraphExecutionError)
|
|
693
|
+
throw error;
|
|
694
|
+
throw new index_js_1.GraphExecutionError(`Dagster run '${dagsterRunId}' could not be read to bind it to workflow '${workflowId}'`, constants_js_1.DAGSTER_ERROR.RUN_WORKFLOW_MISMATCH, { runId: dagsterRunId, workflowId });
|
|
695
|
+
}
|
|
696
|
+
const owner = record.jobName ?? record.pipelineName;
|
|
697
|
+
if (typeof owner !== "string" || owner.length === 0 || owner !== workflowId) {
|
|
698
|
+
throw new index_js_1.GraphExecutionError(`Dagster run '${dagsterRunId}' does not belong to workflow '${workflowId}'`, constants_js_1.DAGSTER_ERROR.RUN_WORKFLOW_MISMATCH, { runId: dagsterRunId, workflowId, ...(owner ? { owner } : {}) });
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Awaits a launched/re-executed run's terminal state through the read-only
|
|
703
|
+
* `getRun` surface, bounded by the signal and timeout. The run is then observed
|
|
704
|
+
* through the event bridge; this keeps the transport's replay-based subscription
|
|
705
|
+
* (which does not stream) sufficient without a live transport.
|
|
706
|
+
*
|
|
707
|
+
* @param client - The wired client port.
|
|
708
|
+
* @param runId - The launched/re-executed Dagster run id.
|
|
709
|
+
* @param options - Optional signal, timeout, and poll interval.
|
|
710
|
+
* @throws {GraphExecutionError} `GRAPH_DAGSTER_OBSERVE_ABORTED` on abort, or
|
|
711
|
+
* `GRAPH_DAGSTER_OBSERVE_TIMEOUT` when the run does not terminate in time.
|
|
712
|
+
*/
|
|
713
|
+
async awaitRunTerminal(client, runId, options = {}) {
|
|
714
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_EXECUTION_TERMINAL_TIMEOUT_MS;
|
|
715
|
+
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_EXECUTION_POLL_INTERVAL_MS;
|
|
716
|
+
const deadline = Date.now() + timeoutMs;
|
|
717
|
+
for (;;) {
|
|
718
|
+
if (options.signal?.aborted) {
|
|
719
|
+
throw new index_js_1.GraphExecutionError(`Dagster run '${runId}' wait was aborted by the caller`, constants_js_1.DAGSTER_ERROR.OBSERVE_ABORTED, { runId });
|
|
720
|
+
}
|
|
721
|
+
const record = await client.getRun(runId);
|
|
722
|
+
if (DAGSTER_TERMINAL_RUN_STATUSES.has(record.status))
|
|
723
|
+
return;
|
|
724
|
+
if (Date.now() >= deadline) {
|
|
725
|
+
throw new index_js_1.GraphExecutionError(`Dagster run '${runId}' did not reach a terminal state within ${timeoutMs}ms`, constants_js_1.DAGSTER_ERROR.OBSERVE_TIMEOUT, { runId, timeoutMs });
|
|
726
|
+
}
|
|
727
|
+
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Fails closed when the explicit execution gate is off, BEFORE any client or
|
|
732
|
+
* network call.
|
|
733
|
+
*
|
|
734
|
+
* @throws {GraphExecutionError} `GRAPH_DAGSTER_EXECUTION_NOT_ENABLED`.
|
|
735
|
+
*/
|
|
736
|
+
assertExecutionEnabled() {
|
|
737
|
+
if (!this.executionEnabled) {
|
|
738
|
+
throw new index_js_1.GraphExecutionError("Dagster execution is disabled: set `executionEnabled: true` on the backend config to execute or replay EXISTING workflows", constants_js_1.DAGSTER_ERROR.EXECUTION_NOT_ENABLED);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Builds the run tags the driver attaches to a launched/re-executed run: the
|
|
743
|
+
* host defaults plus the canonical run/workflow identity under the
|
|
744
|
+
* {@link DAGSTER_TAG_NAMESPACE} namespace. No document content or Python source
|
|
745
|
+
* is carried.
|
|
746
|
+
*
|
|
747
|
+
* @param graphRunId - The canonical run id.
|
|
748
|
+
* @param workflowId - The canonical workflow id.
|
|
749
|
+
* @returns The run tags.
|
|
750
|
+
*/
|
|
751
|
+
executionTags(graphRunId, workflowId) {
|
|
752
|
+
return {
|
|
753
|
+
...this.defaultTags,
|
|
754
|
+
[`${constants_js_1.DAGSTER_TAG_NAMESPACE}graphRunId`]: graphRunId,
|
|
755
|
+
[`${constants_js_1.DAGSTER_TAG_NAMESPACE}workflowId`]: workflowId,
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Reads the optional raw Dagster run configuration from execution metadata. The
|
|
760
|
+
* driver forwards it verbatim; it never synthesizes run config.
|
|
761
|
+
*
|
|
762
|
+
* @param metadata - The execution options metadata.
|
|
763
|
+
* @returns The raw run config, when present.
|
|
764
|
+
*/
|
|
765
|
+
dagsterRunConfigOf(metadata) {
|
|
766
|
+
const runConfig = metadata?.["dagsterRunConfig"];
|
|
767
|
+
if (runConfig === undefined || runConfig === null)
|
|
768
|
+
return undefined;
|
|
769
|
+
if (typeof runConfig !== "object" || Array.isArray(runConfig)) {
|
|
770
|
+
throw new index_js_1.GraphExecutionError("Dagster run config must be a JSON-safe object", constants_js_1.DAGSTER_ERROR.RUN_CONFIG_INVALID);
|
|
771
|
+
}
|
|
772
|
+
return dagsterAllowlistedRunConfig(runConfig, 0);
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Returns the wired client port or fails loudly.
|
|
776
|
+
*
|
|
777
|
+
* @returns The client port.
|
|
778
|
+
* @throws {GraphExecutionError} when no client is configured.
|
|
779
|
+
*/
|
|
780
|
+
requireClient() {
|
|
781
|
+
if (!this.client) {
|
|
782
|
+
throw new index_js_1.GraphExecutionError("DagsterGraphExecutionBackend has no client configured; call initialize(config) first", constants_js_1.DAGSTER_ERROR.CLIENT_NOT_CONFIGURED);
|
|
783
|
+
}
|
|
784
|
+
return this.client;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
exports.DagsterGraphExecutionBackend = DagsterGraphExecutionBackend;
|
|
788
|
+
//# sourceMappingURL=DagsterGraphExecutionBackend.js.map
|
|
789
|
+
//# sourceMappingURL=DagsterGraphExecutionBackend.cjs.map
|