From f5cde4fae66af033f0f2c636d62102f275d2ec40 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Thu, 7 Apr 2022 05:56:35 +0000 Subject: [PATCH] Add workflow execution JSON schema (#270) * Add workflow execution jsonschema Signed-off-by: Kevin Su * Updated schema Signed-off-by: Kevin Su * Added Readme Signed-off-by: Kevin Su * updated Signed-off-by: Kevin Su --- flyteidl/jsonschema/README.md | 17 ++++ flyteidl/jsonschema/workflow_execution.json | 90 +++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 flyteidl/jsonschema/README.md create mode 100644 flyteidl/jsonschema/workflow_execution.json diff --git a/flyteidl/jsonschema/README.md b/flyteidl/jsonschema/README.md new file mode 100644 index 0000000000..0d9ee7b4a4 --- /dev/null +++ b/flyteidl/jsonschema/README.md @@ -0,0 +1,17 @@ +# JSON SCHEMA + +This folder contains the JSON Schema of execution event, and this schema will +be used by [cloudevent publisher](https://github.com/flyteorg/flyteadmin/blob/a0ca4b07d3b1c3cccfe3830307df50bc73152ddb/pkg/async/cloudevent/implementations/cloudevent_publisher.go#L96). + +The URL for the JSON file will be included with the cloudevent message. For example +```json +{ + "specversion" : "1.0", + "type" : "com.flyte.resource.workflow", + "source" : "https://github.com/flyteorg/flyteadmin", + "id" : "D234-1234-1234", + "time" : "2018-04-05T17:31:00Z", + "jsonschemaurl": "https://github.com/flyteorg/flyteidl/blob/master/jsonschema/workflow_execution.json", + "data" : "workflow execution event" +} +``` \ No newline at end of file diff --git a/flyteidl/jsonschema/workflow_execution.json b/flyteidl/jsonschema/workflow_execution.json new file mode 100644 index 0000000000..97b197d14f --- /dev/null +++ b/flyteidl/jsonschema/workflow_execution.json @@ -0,0 +1,90 @@ +{ + "$schema": "http://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin/workflow-execution-event-request", + "properties": { + "RequestId": { + "type": "string" + }, + "Event": { + "type": "object", + "properties": { + "execution_id": { + "$ref": "#/$defs/WorkflowExecutionIdentifier" + }, + "producer_id": { + "type": "string" + }, + "phase": { + "type": "integer" + }, + "occurred_at": { + "$ref": "#/$defs/Timestamp" + }, + "output_result": { + "oneOf": [ + { + "type": "object", + "properties": { + "output_uri": { + "type": "string" + } + } + }, + { + "$ref": "#/$defs/ExecutionError" + } + ] + } + } + } + }, + "$defs": { + "WorkflowExecutionIdentifier": { + "properties": { + "project": { + "type": "string" + }, + "domain": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Timestamp": { + "properties": { + "seconds": { + "type": "integer" + }, + "nanos": { + "type": "integer" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExecutionError": { + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "error_uri": { + "type": "string" + }, + "kind": { + "type": "integer" + } + }, + "additionalProperties": false, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object" +} \ No newline at end of file