bobbai00 commented on code in PR #6009:
URL: https://github.com/apache/texera/pull/6009#discussion_r3564762713
##########
agent-service/src/api/execution-api.ts:
##########
@@ -17,6 +17,19 @@
* under the License.
*/
+import { z } from "zod";
Review Comment:
We need it to define the json schema and validate json schema easier
##########
agent-service/src/types/execution.ts:
##########
@@ -17,56 +17,121 @@
* under the License.
*/
-interface ConsoleMessage {
- msgType: string;
+export enum WorkflowFatalErrorType {
+ COMPILATION_ERROR = "COMPILATION_ERROR",
+ EXECUTION_FAILURE = "EXECUTION_FAILURE",
+}
+
+// Canonical agent-service error projection. It follows the engine's
+// workflowruntimestate.proto shape so compile and execution errors share one
model.
+// The legacy sync-execution adapter synthesizes metadata the backend does not
yet emit.
+// 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;
+}
+
+// A normalized result row using the engine Tuple shape: a schema plus
positional fields.
+// The legacy backend returns JSON records, so the adapter builds a synthetic
all-STRING
+// schema after the backend has truncated values for display.
+export interface Attribute {
+ attributeName: string;
+ attributeType: string;
+}
+
+export interface Schema {
+ attributes: Attribute[];
+}
+
+export interface Tuple {
+ schema: Schema;
+ fields: unknown[];
+}
Review Comment:
done
--
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]