feat: persist blocked executor jobs
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
CODE_RUN_SHADOW_WORKFLOW,
|
||||
createCodeRunShadowGraph,
|
||||
} from './code-run-shadow-graph.mjs';
|
||||
import { createExecutorGateway } from './executor-gateway.mjs';
|
||||
|
||||
function graphConfig(runId) {
|
||||
return {
|
||||
@@ -35,14 +36,22 @@ export function createLangGraphOrchestratorRuntime({
|
||||
checkpointKind = 'unknown',
|
||||
durable = false,
|
||||
checkpointProbe = null,
|
||||
executorJobStore = null,
|
||||
executorJobProbe = null,
|
||||
} = {}) {
|
||||
const graph = createCodeRunShadowGraph({ checkpointer });
|
||||
const executorGateway = createExecutorGateway({
|
||||
...(executorJobStore ? { store: executorJobStore } : {}),
|
||||
});
|
||||
const graph = createCodeRunShadowGraph({ checkpointer, executorGateway });
|
||||
const probe = typeof checkpointProbe === 'function'
|
||||
? checkpointProbe
|
||||
: async () => {
|
||||
await checkpointer.getTuple(graphConfig('__orchestrator_readiness__'));
|
||||
return true;
|
||||
};
|
||||
const probeExecutorJobs = typeof executorJobProbe === 'function'
|
||||
? executorJobProbe
|
||||
: async () => true;
|
||||
|
||||
async function getSnapshot(runId) {
|
||||
return graph.getState(graphConfig(runId));
|
||||
@@ -63,6 +72,7 @@ export function createLangGraphOrchestratorRuntime({
|
||||
durable: Boolean(durable),
|
||||
},
|
||||
execution: 'observe-only',
|
||||
executorGateway: executorGateway.status(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -122,7 +132,7 @@ export function createLangGraphOrchestratorRuntime({
|
||||
health,
|
||||
|
||||
async ready() {
|
||||
await probe();
|
||||
await Promise.all([probe(), probeExecutorJobs()]);
|
||||
return {
|
||||
...health(),
|
||||
ready: true,
|
||||
|
||||
Reference in New Issue
Block a user