bobbai00 commented on code in PR #6009:
URL: https://github.com/apache/texera/pull/6009#discussion_r3563585691
##########
agent-service/src/types/execution.ts:
##########
@@ -17,56 +17,116 @@
* under the License.
*/
-interface ConsoleMessage {
- msgType: string;
+export enum WorkflowFatalErrorType {
+ COMPILATION_ERROR = "COMPILATION_ERROR",
+ EXECUTION_FAILURE = "EXECUTION_FAILURE",
+}
+
+// A fatal error reported for one operator. Reuses the engine's wire shape
+// (workflowruntimestate.proto). The same type the workflow-compiling service
+// returns for compilation errors, so compile and execution errors share one
+// shape. Re-exported by api/compile-api.ts.
+export interface WorkflowFatalError {
+ type: { name: WorkflowFatalErrorType };
+ timestamp: { seconds: number; nanos: number };
message: string;
+ details: string;
+ operatorId: string;
+ workerId: string;
}
-interface PortShape {
- portIndex: number;
- rows: number;
- columns: number;
+// Lifecycle state of a single operator, as reported by the engine
+// (mirrors the backend's WorkflowAggregatedState string mapping).
+export enum OperatorState {
+ UNINITIALIZED = "Uninitialized",
+ READY = "Ready",
+ RUNNING = "Running",
+ PAUSING = "Pausing",
+ PAUSED = "Paused",
+ RESUMING = "Resuming",
+ COMPLETED = "Completed",
+ FAILED = "Failed",
+ KILLED = "Killed",
+ TERMINATED = "Terminated",
+ UNKNOWN = "Unknown",
}
-export interface OperatorInfo {
- state: string;
- inputTuples: number;
- outputTuples: number;
- inputPortShapes?: PortShape[];
- resultMode: string;
- result?: Record<string, any>[];
- totalRowCount?: number;
- displayedRows?: number;
- truncated?: boolean;
- consoleLogs?: ConsoleMessage[];
- error?: string;
- warnings?: string[];
- resultStatistics?: Record<string, string>;
+// Aggregated state of a whole workflow execution: the OperatorState values the
+// engine reports, plus the synthetic outcomes the sync-execution endpoint
adds.
+export enum WorkflowExecutionState {
+ UNINITIALIZED = "Uninitialized",
+ READY = "Ready",
+ RUNNING = "Running",
+ PAUSING = "Pausing",
+ PAUSED = "Paused",
+ RESUMING = "Resuming",
+ COMPLETED = "Completed",
+ FAILED = "Failed",
+ KILLED = "Killed",
+ TERMINATED = "Terminated",
+ UNKNOWN = "Unknown",
+ ERROR = "Error",
+ COMPILATION_FAILED = "CompilationFailed",
}
-export interface SyncExecutionResult {
- success: boolean;
- state: string;
- operators: Record<string, OperatorInfo>;
- compilationErrors?: Record<string, string>;
- errors?: string[];
+export enum ConsoleMessageType {
+ PRINT = "PRINT",
+ ERROR = "ERROR",
+ COMMAND = "COMMAND",
+ DEBUGGER = "DEBUGGER",
}
-/**
- * Wire projection of one operator's execution result, summarized for the
- * client: counts and a small record sample instead of full payloads. Returned
- * by the REST route `GET /agents/:id/operator-results`.
- */
+// A reduced console-message projection for sync-execution summaries. The
engine
+// proto also has workerId/timestamp/source; this summary keeps only the fields
+// consumed by agent-service.
+export interface ConsoleMessageSummary {
+ msgType: ConsoleMessageType;
+ title: string;
+ message: string;
+}
+
+// One sampled output row: its original position plus the row's columns.
+export interface SampleRow {
+ rowIndex: number;
+ tuple: Record<string, unknown>;
+}
+
+export enum OperatorResultMode {
+ TABLE = "table",
+ VISUALIZATION = "visualization",
+}
+
+// An operator's output, summarized for the agent. `sampleTuples` are the
+// symmetrically-truncated output rows (the middle is dropped, so `rowIndex`
+// values may have gaps). `outputSchema` / per-column statistics are intended
+// future additions — the engine does not produce them yet.
export interface OperatorResultSummary {
- state: string;
- inputTuples: number;
- outputTuples: number;
- inputPortShapes?: PortShape[];
- outputColumns?: number;
- error?: string;
- warnings?: string[];
- consoleLogCount?: number;
- totalRowCount?: number;
- sampleRecords?: Record<string, unknown>[];
- resultStatistics?: Record<string, string>;
+ resultMode: OperatorResultMode;
+ sampleTuples: SampleRow[];
+ // Total output rows before truncation (sampleTuples may hold fewer).
+ tuplesCount: number;
+}
+
+// Per-operator execution summary returned by the sync-execution backend.
+// Orthogonal sub-summaries replace the previous flat `OperatorInfo`.
+export interface OperatorExecutionSummary {
+ state: OperatorState;
+ // Empty means the operator did not fail.
+ errorMessages: ReadonlyArray<WorkflowFatalError>;
+ // Absent when the operator produced no materialized result.
+ resultSummary?: OperatorResultSummary;
+ // Absent when the operator produced no console output.
+ consoleMessages?: ConsoleMessageSummary[];
+}
+
+// The result of one synchronous workflow execution.
+export interface WorkflowExecutionSummary {
+ // True only on a clean run; can be false even when state is "Completed"
+ // (e.g. an operator logged a console error without aborting the run).
+ success: boolean;
Review Comment:
Agreed. The canonical `WorkflowExecutionSummary` now uses
`WorkflowExecutionState` as its sole outcome and no longer exposes `success`.
The legacy boolean remains only in the sync-response compatibility schema; the
adapter normalizes `success=false, state=Completed` to `Failed` so no failure
information is lost. Agent consumers now treat only `Completed` as successful.
Implemented in d241edcdd.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]