EmboFlow/apps/worker/src/contracts/execution-context.ts

68 lines
1.5 KiB
TypeScript

export type ExecutorType = "python" | "docker" | "http";
export type TaskStatus = "pending" | "queued" | "running" | "success" | "failed" | "cancelled";
export type TaskStatusCounts = {
pending: number;
queued: number;
running: number;
success: number;
failed: number;
cancelled: number;
};
export type TaskExecutionSummary = {
outcome: "success" | "failed";
executorType: ExecutorType;
assetCount: number;
artifactIds: string[];
stdoutLineCount: number;
stderrLineCount: number;
errorMessage?: string;
};
export type RunExecutionSummary = {
totalTaskCount: number;
completedTaskCount: number;
artifactCount: number;
stdoutLineCount: number;
stderrLineCount: number;
failedTaskIds: string[];
taskCounts: TaskStatusCounts;
};
export type ExecutorExecutionResult = {
result: unknown;
stdoutLines?: string[];
stderrLines?: string[];
};
export type TaskRecord = {
id: string;
workflowRunId?: string;
workflowVersionId?: string;
nodeId: string;
nodeType?: string;
executorType: ExecutorType;
status: TaskStatus;
attempt?: number;
assetIds?: string[];
upstreamNodeIds?: string[];
outputArtifactIds?: string[];
errorMessage?: string;
startedAt?: string;
finishedAt?: string;
durationMs?: number;
logLines?: string[];
stdoutLines?: string[];
stderrLines?: string[];
summary?: TaskExecutionSummary;
lastResultPreview?: Record<string, unknown>;
};
export type ExecutionContext = {
taskId: string;
workflowRunId?: string;
workflowVersionId?: string;
nodeId: string;
assetIds?: string[];
};