Add DAG loading to spec

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet
2025-08-21 17:03:21 +02:00
parent ec91a15131
commit 1939a3d09d

View File

@@ -241,6 +241,41 @@
} }
] ]
}, },
{
"name": "flow.dag",
"summary": "Compute and return the execution DAG for a Flow",
"params": [
{
"name": "params",
"schema": {
"$ref": "#/components/schemas/FlowLoadParams"
}
}
],
"result": {
"name": "result",
"schema": {
"$ref": "#/components/schemas/FlowDag"
}
},
"errors": [
{
"$ref": "#/components/errors/InvalidParams"
},
{
"$ref": "#/components/errors/NotFound"
},
{
"$ref": "#/components/errors/StorageError"
},
{
"$ref": "#/components/errors/DagMissingDependency"
},
{
"$ref": "#/components/errors/DagCycleDetected"
}
]
},
{ {
"name": "job.create", "name": "job.create",
"summary": "Create/Upsert Job in a context", "summary": "Create/Upsert Job in a context",
@@ -747,6 +782,125 @@
} }
} }
}, },
"JobSummary": {
"type": "object",
"required": [
"id",
"depends",
"prerequisites",
"script_type"
],
"properties": {
"id": {
"type": "integer",
"format": "uint32"
},
"depends": {
"type": "array",
"items": {
"type": "integer",
"format": "uint32"
}
},
"prerequisites": {
"type": "array",
"items": {
"type": "string"
}
},
"script_type": {
"$ref": "#/components/schemas/ScriptType"
}
}
},
"EdgeTuple": {
"type": "array",
"items": [
{
"type": "integer",
"format": "uint32"
},
{
"type": "integer",
"format": "uint32"
}
],
"minItems": 2,
"maxItems": 2,
"description": "Tuple [from, to] representing a directed edge"
},
"FlowDag": {
"type": "object",
"required": [
"flow_id",
"caller_id",
"context_id",
"nodes",
"edges",
"reverse_edges",
"roots",
"leaves",
"levels"
],
"properties": {
"flow_id": {
"type": "integer",
"format": "uint32"
},
"caller_id": {
"type": "integer",
"format": "uint32"
},
"context_id": {
"type": "integer",
"format": "uint32"
},
"nodes": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/JobSummary"
},
"description": "Map keyed by job id (serialized as string in JSON)"
},
"edges": {
"type": "array",
"items": {
"$ref": "#/components/schemas/EdgeTuple"
}
},
"reverse_edges": {
"type": "array",
"items": {
"$ref": "#/components/schemas/EdgeTuple"
}
},
"roots": {
"type": "array",
"items": {
"type": "integer",
"format": "uint32"
}
},
"leaves": {
"type": "array",
"items": {
"type": "integer",
"format": "uint32"
}
},
"levels": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "integer",
"format": "uint32"
}
},
"description": "Topological execution layers (parallelizable batches)"
}
}
},
"ActorCreate": { "ActorCreate": {
"type": "object", "type": "object",
"required": [ "required": [
@@ -1219,6 +1373,14 @@
"StorageError": { "StorageError": {
"code": -32010, "code": -32010,
"message": "Storage Error" "message": "Storage Error"
},
"DagMissingDependency": {
"code": -32020,
"message": "DAG Missing Dependency"
},
"DagCycleDetected": {
"code": -32021,
"message": "DAG Cycle Detected"
} }
} }
} }