From 812b0c100c81192ed9ee9e92cbe080501bee4af3 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Wed, 21 Feb 2024 14:48:07 +0800 Subject: [PATCH 01/13] add json diff module Signed-off-by: Austin Liu --- flyteadmin/go.mod | 5 +++++ flyteadmin/go.sum | 11 +++++++++++ go.mod | 5 +++++ go.sum | 11 +++++++++++ 4 files changed, 32 insertions(+) diff --git a/flyteadmin/go.mod b/flyteadmin/go.mod index c2844c6cac..18f7b2eaf9 100644 --- a/flyteadmin/go.mod +++ b/flyteadmin/go.mod @@ -46,6 +46,7 @@ require ( github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 + github.com/wI2L/jsondiff v0.5.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 go.opentelemetry.io/otel v1.21.0 golang.org/x/oauth2 v0.16.0 @@ -166,6 +167,10 @@ require ( github.com/spf13/viper v1.11.0 // indirect github.com/stretchr/objx v0.5.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect + github.com/tidwall/gjson v1.17.0 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/tidwall/sjson v1.2.5 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect diff --git a/flyteadmin/go.sum b/flyteadmin/go.sum index 0693371e59..6e6479957a 100644 --- a/flyteadmin/go.sum +++ b/flyteadmin/go.sum @@ -1265,13 +1265,22 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/tidwall/gjson v1.3.2/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= github.com/tidwall/gjson v1.6.8/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= github.com/tidwall/gjson v1.7.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= +github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM= +github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.0.4/go.mod h1:bURseu1nuBkFpIES5cz6zBtjmYeOQmEESshn7VpF15Y= github.com/tidwall/sjson v1.1.5/go.mod h1:VuJzsZnTowhSxWdOgsAnb886i4AjEyTkk7tNtsL7EYE= +github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= +github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= @@ -1288,6 +1297,8 @@ github.com/unrolled/secure v0.0.0-20181005190816-ff9db2ff917f/go.mod h1:mnPT77IA github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/wI2L/jsondiff v0.5.0 h1:RRMTi/mH+R2aXcPe1VYyvGINJqQfC3R+KSEakuU1Ikw= +github.com/wI2L/jsondiff v0.5.0/go.mod h1:qqG6hnK0Lsrz2BpIVCxWiK9ItsBCpIZQiv0izJjOZ9s= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= diff --git a/go.mod b/go.mod index 998cd19de7..c303d976ae 100644 --- a/go.mod +++ b/go.mod @@ -169,6 +169,11 @@ require ( github.com/stretchr/objx v0.5.0 // indirect github.com/stretchr/testify v1.8.4 // indirect github.com/subosito/gotenv v1.2.0 // indirect + github.com/tidwall/gjson v1.17.0 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/tidwall/sjson v1.2.5 // indirect + github.com/wI2L/jsondiff v0.5.0 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect diff --git a/go.sum b/go.sum index 294ed0f37d..e8d5ee8603 100644 --- a/go.sum +++ b/go.sum @@ -1300,13 +1300,22 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/tidwall/gjson v1.3.2/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= github.com/tidwall/gjson v1.6.8/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= github.com/tidwall/gjson v1.7.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= +github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM= +github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.0.4/go.mod h1:bURseu1nuBkFpIES5cz6zBtjmYeOQmEESshn7VpF15Y= github.com/tidwall/sjson v1.1.5/go.mod h1:VuJzsZnTowhSxWdOgsAnb886i4AjEyTkk7tNtsL7EYE= +github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= +github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= @@ -1323,6 +1332,8 @@ github.com/unrolled/secure v0.0.0-20181005190816-ff9db2ff917f/go.mod h1:mnPT77IA github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/wI2L/jsondiff v0.5.0 h1:RRMTi/mH+R2aXcPe1VYyvGINJqQfC3R+KSEakuU1Ikw= +github.com/wI2L/jsondiff v0.5.0/go.mod h1:qqG6hnK0Lsrz2BpIVCxWiK9ItsBCpIZQiv0izJjOZ9s= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= From c424646039f07a268b118bc01290492c70466de5 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Wed, 21 Feb 2024 14:50:12 +0800 Subject: [PATCH 02/13] add CreateTaskFailureReason Signed-off-by: Austin Liu --- flyteidl/protos/flyteidl/admin/task.proto | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/flyteidl/protos/flyteidl/admin/task.proto b/flyteidl/protos/flyteidl/admin/task.proto index 78fbba39f8..3badc32d0f 100644 --- a/flyteidl/protos/flyteidl/admin/task.proto +++ b/flyteidl/protos/flyteidl/admin/task.proto @@ -69,3 +69,23 @@ message TaskClosure { // Time at which the task was created. google.protobuf.Timestamp created_at = 2; } + +// The task id is already used and the structure is different +message TaskErrorExistsDifferentStructure { + core.Identifier id = 1; + core.TaskTemplate old_spec = 2; + core.TaskTemplate new_spec = 3; +} + +// The task id is already used with an identical sctructure +message TaskErrorExistsIdenticalStructure { + core.Identifier id = 1; +} + +// When a CreateTaskRequest fails due to matching id +message CreateTaskFailureReason { + oneof reason { + TaskErrorExistsDifferentStructure exists_different_structure = 1; + TaskErrorExistsIdenticalStructure exists_identical_structure = 2; + } +} From fb7de5f6a5c3b6e1091bf4de12094daba1528333 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Wed, 21 Feb 2024 14:51:13 +0800 Subject: [PATCH 03/13] update task proto buff gen code Signed-off-by: Austin Liu --- flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts | 142 ++++++ flyteidl/gen/pb-go/flyteidl/admin/task.pb.go | 349 +++++++++++++-- flyteidl/gen/pb-js/flyteidl.d.ts | 177 ++++++++ flyteidl/gen/pb-js/flyteidl.js | 416 ++++++++++++++++++ .../gen/pb_python/flyteidl/admin/task_pb2.py | 8 +- .../gen/pb_python/flyteidl/admin/task_pb2.pyi | 24 + flyteidl/gen/pb_rust/flyteidl.admin.rs | 36 ++ 7 files changed, 1115 insertions(+), 37 deletions(-) diff --git a/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts b/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts index f4b22f068f..2f50f1ef02 100644 --- a/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts +++ b/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts @@ -306,3 +306,145 @@ export class TaskClosure extends Message { } } +/** + * The task id is already used and the structure is different + * + * @generated from message flyteidl.admin.TaskErrorExistsDifferentStructure + */ +export class TaskErrorExistsDifferentStructure extends Message { + /** + * @generated from field: flyteidl.core.Identifier id = 1; + */ + id?: Identifier; + + /** + * @generated from field: flyteidl.core.TaskTemplate old_spec = 2; + */ + oldSpec?: TaskTemplate; + + /** + * @generated from field: flyteidl.core.TaskTemplate new_spec = 3; + */ + newSpec?: TaskTemplate; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "flyteidl.admin.TaskErrorExistsDifferentStructure"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "message", T: Identifier }, + { no: 2, name: "old_spec", kind: "message", T: TaskTemplate }, + { no: 3, name: "new_spec", kind: "message", T: TaskTemplate }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TaskErrorExistsDifferentStructure { + return new TaskErrorExistsDifferentStructure().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TaskErrorExistsDifferentStructure { + return new TaskErrorExistsDifferentStructure().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TaskErrorExistsDifferentStructure { + return new TaskErrorExistsDifferentStructure().fromJsonString(jsonString, options); + } + + static equals(a: TaskErrorExistsDifferentStructure | PlainMessage | undefined, b: TaskErrorExistsDifferentStructure | PlainMessage | undefined): boolean { + return proto3.util.equals(TaskErrorExistsDifferentStructure, a, b); + } +} + +/** + * The task id is already used with an identical sctructure + * + * @generated from message flyteidl.admin.TaskErrorExistsIdenticalStructure + */ +export class TaskErrorExistsIdenticalStructure extends Message { + /** + * @generated from field: flyteidl.core.Identifier id = 1; + */ + id?: Identifier; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "flyteidl.admin.TaskErrorExistsIdenticalStructure"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "message", T: Identifier }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TaskErrorExistsIdenticalStructure { + return new TaskErrorExistsIdenticalStructure().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TaskErrorExistsIdenticalStructure { + return new TaskErrorExistsIdenticalStructure().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TaskErrorExistsIdenticalStructure { + return new TaskErrorExistsIdenticalStructure().fromJsonString(jsonString, options); + } + + static equals(a: TaskErrorExistsIdenticalStructure | PlainMessage | undefined, b: TaskErrorExistsIdenticalStructure | PlainMessage | undefined): boolean { + return proto3.util.equals(TaskErrorExistsIdenticalStructure, a, b); + } +} + +/** + * When a CreateTaskRequest fails due to matching id + * + * @generated from message flyteidl.admin.CreateTaskFailureReason + */ +export class CreateTaskFailureReason extends Message { + /** + * @generated from oneof flyteidl.admin.CreateTaskFailureReason.reason + */ + reason: { + /** + * @generated from field: flyteidl.admin.TaskErrorExistsDifferentStructure exists_different_structure = 1; + */ + value: TaskErrorExistsDifferentStructure; + case: "existsDifferentStructure"; + } | { + /** + * @generated from field: flyteidl.admin.TaskErrorExistsIdenticalStructure exists_identical_structure = 2; + */ + value: TaskErrorExistsIdenticalStructure; + case: "existsIdenticalStructure"; + } | { case: undefined; value?: undefined } = { case: undefined }; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "flyteidl.admin.CreateTaskFailureReason"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "exists_different_structure", kind: "message", T: TaskErrorExistsDifferentStructure, oneof: "reason" }, + { no: 2, name: "exists_identical_structure", kind: "message", T: TaskErrorExistsIdenticalStructure, oneof: "reason" }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CreateTaskFailureReason { + return new CreateTaskFailureReason().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CreateTaskFailureReason { + return new CreateTaskFailureReason().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CreateTaskFailureReason { + return new CreateTaskFailureReason().fromJsonString(jsonString, options); + } + + static equals(a: CreateTaskFailureReason | PlainMessage | undefined, b: CreateTaskFailureReason | PlainMessage | undefined): boolean { + return proto3.util.equals(CreateTaskFailureReason, a, b); + } +} + diff --git a/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go b/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go index e2f74db35d..980f34c185 100644 --- a/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go +++ b/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go @@ -368,6 +368,200 @@ func (x *TaskClosure) GetCreatedAt() *timestamppb.Timestamp { return nil } +// The task id is already used and the structure is different +type TaskErrorExistsDifferentStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *core.Identifier `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + OldSpec *core.TaskTemplate `protobuf:"bytes,2,opt,name=old_spec,json=oldSpec,proto3" json:"old_spec,omitempty"` + NewSpec *core.TaskTemplate `protobuf:"bytes,3,opt,name=new_spec,json=newSpec,proto3" json:"new_spec,omitempty"` +} + +func (x *TaskErrorExistsDifferentStructure) Reset() { + *x = TaskErrorExistsDifferentStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_flyteidl_admin_task_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TaskErrorExistsDifferentStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskErrorExistsDifferentStructure) ProtoMessage() {} + +func (x *TaskErrorExistsDifferentStructure) ProtoReflect() protoreflect.Message { + mi := &file_flyteidl_admin_task_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TaskErrorExistsDifferentStructure.ProtoReflect.Descriptor instead. +func (*TaskErrorExistsDifferentStructure) Descriptor() ([]byte, []int) { + return file_flyteidl_admin_task_proto_rawDescGZIP(), []int{6} +} + +func (x *TaskErrorExistsDifferentStructure) GetId() *core.Identifier { + if x != nil { + return x.Id + } + return nil +} + +func (x *TaskErrorExistsDifferentStructure) GetOldSpec() *core.TaskTemplate { + if x != nil { + return x.OldSpec + } + return nil +} + +func (x *TaskErrorExistsDifferentStructure) GetNewSpec() *core.TaskTemplate { + if x != nil { + return x.NewSpec + } + return nil +} + +// The task id is already used with an identical sctructure +type TaskErrorExistsIdenticalStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *core.Identifier `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *TaskErrorExistsIdenticalStructure) Reset() { + *x = TaskErrorExistsIdenticalStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_flyteidl_admin_task_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TaskErrorExistsIdenticalStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskErrorExistsIdenticalStructure) ProtoMessage() {} + +func (x *TaskErrorExistsIdenticalStructure) ProtoReflect() protoreflect.Message { + mi := &file_flyteidl_admin_task_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TaskErrorExistsIdenticalStructure.ProtoReflect.Descriptor instead. +func (*TaskErrorExistsIdenticalStructure) Descriptor() ([]byte, []int) { + return file_flyteidl_admin_task_proto_rawDescGZIP(), []int{7} +} + +func (x *TaskErrorExistsIdenticalStructure) GetId() *core.Identifier { + if x != nil { + return x.Id + } + return nil +} + +// When a CreateTaskRequest fails due to matching id +type CreateTaskFailureReason struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Reason: + // + // *CreateTaskFailureReason_ExistsDifferentStructure + // *CreateTaskFailureReason_ExistsIdenticalStructure + Reason isCreateTaskFailureReason_Reason `protobuf_oneof:"reason"` +} + +func (x *CreateTaskFailureReason) Reset() { + *x = CreateTaskFailureReason{} + if protoimpl.UnsafeEnabled { + mi := &file_flyteidl_admin_task_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateTaskFailureReason) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateTaskFailureReason) ProtoMessage() {} + +func (x *CreateTaskFailureReason) ProtoReflect() protoreflect.Message { + mi := &file_flyteidl_admin_task_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateTaskFailureReason.ProtoReflect.Descriptor instead. +func (*CreateTaskFailureReason) Descriptor() ([]byte, []int) { + return file_flyteidl_admin_task_proto_rawDescGZIP(), []int{8} +} + +func (m *CreateTaskFailureReason) GetReason() isCreateTaskFailureReason_Reason { + if m != nil { + return m.Reason + } + return nil +} + +func (x *CreateTaskFailureReason) GetExistsDifferentStructure() *TaskErrorExistsDifferentStructure { + if x, ok := x.GetReason().(*CreateTaskFailureReason_ExistsDifferentStructure); ok { + return x.ExistsDifferentStructure + } + return nil +} + +func (x *CreateTaskFailureReason) GetExistsIdenticalStructure() *TaskErrorExistsIdenticalStructure { + if x, ok := x.GetReason().(*CreateTaskFailureReason_ExistsIdenticalStructure); ok { + return x.ExistsIdenticalStructure + } + return nil +} + +type isCreateTaskFailureReason_Reason interface { + isCreateTaskFailureReason_Reason() +} + +type CreateTaskFailureReason_ExistsDifferentStructure struct { + ExistsDifferentStructure *TaskErrorExistsDifferentStructure `protobuf:"bytes,1,opt,name=exists_different_structure,json=existsDifferentStructure,proto3,oneof"` +} + +type CreateTaskFailureReason_ExistsIdenticalStructure struct { + ExistsIdenticalStructure *TaskErrorExistsIdenticalStructure `protobuf:"bytes,2,opt,name=exists_identical_structure,json=existsIdenticalStructure,proto3,oneof"` +} + +func (*CreateTaskFailureReason_ExistsDifferentStructure) isCreateTaskFailureReason_Reason() {} + +func (*CreateTaskFailureReason_ExistsIdenticalStructure) isCreateTaskFailureReason_Reason() {} + var File_flyteidl_admin_task_proto protoreflect.FileDescriptor var file_flyteidl_admin_task_proto_rawDesc = []byte{ @@ -424,18 +618,52 @@ var file_flyteidl_admin_task_proto_rawDesc = []byte{ 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x42, 0xb5, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, - 0x6c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x42, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x6f, 0x72, 0x67, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x2f, - 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x62, 0x2d, - 0x67, 0x6f, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x61, 0x64, 0x6d, 0x69, - 0x6e, 0xa2, 0x02, 0x03, 0x46, 0x41, 0x58, 0xaa, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, - 0x64, 0x6c, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xca, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, - 0x69, 0x64, 0x6c, 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xe2, 0x02, 0x1a, 0x46, 0x6c, 0x79, 0x74, - 0x65, 0x69, 0x64, 0x6c, 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, - 0x6c, 0x3a, 0x3a, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0xbe, 0x01, 0x0a, 0x21, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, + 0x69, 0x73, 0x74, 0x73, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, + 0x72, 0x65, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x36, 0x0a, 0x08, 0x6f, 0x6c, 0x64, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, + 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x52, 0x07, 0x6f, 0x6c, 0x64, 0x53, 0x70, 0x65, 0x63, 0x12, 0x36, 0x0a, 0x08, 0x6e, 0x65, 0x77, + 0x5f, 0x73, 0x70, 0x65, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x6c, + 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x61, 0x73, 0x6b, + 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x53, 0x70, 0x65, + 0x63, 0x22, 0x4e, 0x0a, 0x21, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, + 0x69, 0x73, 0x74, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, + 0x72, 0x65, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, + 0x64, 0x22, 0x89, 0x02, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, + 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x71, 0x0a, + 0x1a, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x74, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x31, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, + 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, 0x69, 0x73, + 0x74, 0x73, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x18, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x44, 0x69, + 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, + 0x12, 0x71, 0x0a, 0x1a, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, + 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, + 0x78, 0x69, 0x73, 0x74, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x18, 0x65, 0x78, 0x69, 0x73, 0x74, + 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x75, 0x72, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0xb5, 0x01, + 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, + 0x64, 0x6d, 0x69, 0x6e, 0x42, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6c, + 0x79, 0x74, 0x65, 0x6f, 0x72, 0x67, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x2f, 0x66, 0x6c, 0x79, + 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x62, 0x2d, 0x67, 0x6f, 0x2f, + 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0xa2, 0x02, + 0x03, 0x46, 0x41, 0x58, 0xaa, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, + 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xca, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, + 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xe2, 0x02, 0x1a, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, + 0x6c, 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x3a, 0x3a, + 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -450,35 +678,44 @@ func file_flyteidl_admin_task_proto_rawDescGZIP() []byte { return file_flyteidl_admin_task_proto_rawDescData } -var file_flyteidl_admin_task_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_flyteidl_admin_task_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_flyteidl_admin_task_proto_goTypes = []interface{}{ - (*TaskCreateRequest)(nil), // 0: flyteidl.admin.TaskCreateRequest - (*TaskCreateResponse)(nil), // 1: flyteidl.admin.TaskCreateResponse - (*Task)(nil), // 2: flyteidl.admin.Task - (*TaskList)(nil), // 3: flyteidl.admin.TaskList - (*TaskSpec)(nil), // 4: flyteidl.admin.TaskSpec - (*TaskClosure)(nil), // 5: flyteidl.admin.TaskClosure - (*core.Identifier)(nil), // 6: flyteidl.core.Identifier - (*core.TaskTemplate)(nil), // 7: flyteidl.core.TaskTemplate - (*DescriptionEntity)(nil), // 8: flyteidl.admin.DescriptionEntity - (*core.CompiledTask)(nil), // 9: flyteidl.core.CompiledTask - (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp + (*TaskCreateRequest)(nil), // 0: flyteidl.admin.TaskCreateRequest + (*TaskCreateResponse)(nil), // 1: flyteidl.admin.TaskCreateResponse + (*Task)(nil), // 2: flyteidl.admin.Task + (*TaskList)(nil), // 3: flyteidl.admin.TaskList + (*TaskSpec)(nil), // 4: flyteidl.admin.TaskSpec + (*TaskClosure)(nil), // 5: flyteidl.admin.TaskClosure + (*TaskErrorExistsDifferentStructure)(nil), // 6: flyteidl.admin.TaskErrorExistsDifferentStructure + (*TaskErrorExistsIdenticalStructure)(nil), // 7: flyteidl.admin.TaskErrorExistsIdenticalStructure + (*CreateTaskFailureReason)(nil), // 8: flyteidl.admin.CreateTaskFailureReason + (*core.Identifier)(nil), // 9: flyteidl.core.Identifier + (*core.TaskTemplate)(nil), // 10: flyteidl.core.TaskTemplate + (*DescriptionEntity)(nil), // 11: flyteidl.admin.DescriptionEntity + (*core.CompiledTask)(nil), // 12: flyteidl.core.CompiledTask + (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp } var file_flyteidl_admin_task_proto_depIdxs = []int32{ - 6, // 0: flyteidl.admin.TaskCreateRequest.id:type_name -> flyteidl.core.Identifier + 9, // 0: flyteidl.admin.TaskCreateRequest.id:type_name -> flyteidl.core.Identifier 4, // 1: flyteidl.admin.TaskCreateRequest.spec:type_name -> flyteidl.admin.TaskSpec - 6, // 2: flyteidl.admin.Task.id:type_name -> flyteidl.core.Identifier + 9, // 2: flyteidl.admin.Task.id:type_name -> flyteidl.core.Identifier 5, // 3: flyteidl.admin.Task.closure:type_name -> flyteidl.admin.TaskClosure 2, // 4: flyteidl.admin.TaskList.tasks:type_name -> flyteidl.admin.Task - 7, // 5: flyteidl.admin.TaskSpec.template:type_name -> flyteidl.core.TaskTemplate - 8, // 6: flyteidl.admin.TaskSpec.description:type_name -> flyteidl.admin.DescriptionEntity - 9, // 7: flyteidl.admin.TaskClosure.compiled_task:type_name -> flyteidl.core.CompiledTask - 10, // 8: flyteidl.admin.TaskClosure.created_at:type_name -> google.protobuf.Timestamp - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 10, // 5: flyteidl.admin.TaskSpec.template:type_name -> flyteidl.core.TaskTemplate + 11, // 6: flyteidl.admin.TaskSpec.description:type_name -> flyteidl.admin.DescriptionEntity + 12, // 7: flyteidl.admin.TaskClosure.compiled_task:type_name -> flyteidl.core.CompiledTask + 13, // 8: flyteidl.admin.TaskClosure.created_at:type_name -> google.protobuf.Timestamp + 9, // 9: flyteidl.admin.TaskErrorExistsDifferentStructure.id:type_name -> flyteidl.core.Identifier + 10, // 10: flyteidl.admin.TaskErrorExistsDifferentStructure.old_spec:type_name -> flyteidl.core.TaskTemplate + 10, // 11: flyteidl.admin.TaskErrorExistsDifferentStructure.new_spec:type_name -> flyteidl.core.TaskTemplate + 9, // 12: flyteidl.admin.TaskErrorExistsIdenticalStructure.id:type_name -> flyteidl.core.Identifier + 6, // 13: flyteidl.admin.CreateTaskFailureReason.exists_different_structure:type_name -> flyteidl.admin.TaskErrorExistsDifferentStructure + 7, // 14: flyteidl.admin.CreateTaskFailureReason.exists_identical_structure:type_name -> flyteidl.admin.TaskErrorExistsIdenticalStructure + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_flyteidl_admin_task_proto_init() } @@ -560,6 +797,46 @@ func file_flyteidl_admin_task_proto_init() { return nil } } + file_flyteidl_admin_task_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TaskErrorExistsDifferentStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_flyteidl_admin_task_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TaskErrorExistsIdenticalStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_flyteidl_admin_task_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateTaskFailureReason); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_flyteidl_admin_task_proto_msgTypes[8].OneofWrappers = []interface{}{ + (*CreateTaskFailureReason_ExistsDifferentStructure)(nil), + (*CreateTaskFailureReason_ExistsIdenticalStructure)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -567,7 +844,7 @@ func file_flyteidl_admin_task_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_flyteidl_admin_task_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/flyteidl/gen/pb-js/flyteidl.d.ts b/flyteidl/gen/pb-js/flyteidl.d.ts index 60556e3b43..a3bd56d155 100644 --- a/flyteidl/gen/pb-js/flyteidl.d.ts +++ b/flyteidl/gen/pb-js/flyteidl.d.ts @@ -19372,6 +19372,183 @@ export namespace flyteidl { public static verify(message: { [k: string]: any }): (string|null); } + /** Properties of a TaskErrorExistsDifferentStructure. */ + interface ITaskErrorExistsDifferentStructure { + + /** TaskErrorExistsDifferentStructure id */ + id?: (flyteidl.core.IIdentifier|null); + + /** TaskErrorExistsDifferentStructure oldSpec */ + oldSpec?: (flyteidl.core.ITaskTemplate|null); + + /** TaskErrorExistsDifferentStructure newSpec */ + newSpec?: (flyteidl.core.ITaskTemplate|null); + } + + /** Represents a TaskErrorExistsDifferentStructure. */ + class TaskErrorExistsDifferentStructure implements ITaskErrorExistsDifferentStructure { + + /** + * Constructs a new TaskErrorExistsDifferentStructure. + * @param [properties] Properties to set + */ + constructor(properties?: flyteidl.admin.ITaskErrorExistsDifferentStructure); + + /** TaskErrorExistsDifferentStructure id. */ + public id?: (flyteidl.core.IIdentifier|null); + + /** TaskErrorExistsDifferentStructure oldSpec. */ + public oldSpec?: (flyteidl.core.ITaskTemplate|null); + + /** TaskErrorExistsDifferentStructure newSpec. */ + public newSpec?: (flyteidl.core.ITaskTemplate|null); + + /** + * Creates a new TaskErrorExistsDifferentStructure instance using the specified properties. + * @param [properties] Properties to set + * @returns TaskErrorExistsDifferentStructure instance + */ + public static create(properties?: flyteidl.admin.ITaskErrorExistsDifferentStructure): flyteidl.admin.TaskErrorExistsDifferentStructure; + + /** + * Encodes the specified TaskErrorExistsDifferentStructure message. Does not implicitly {@link flyteidl.admin.TaskErrorExistsDifferentStructure.verify|verify} messages. + * @param message TaskErrorExistsDifferentStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: flyteidl.admin.ITaskErrorExistsDifferentStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TaskErrorExistsDifferentStructure message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TaskErrorExistsDifferentStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): flyteidl.admin.TaskErrorExistsDifferentStructure; + + /** + * Verifies a TaskErrorExistsDifferentStructure message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + } + + /** Properties of a TaskErrorExistsIdenticalStructure. */ + interface ITaskErrorExistsIdenticalStructure { + + /** TaskErrorExistsIdenticalStructure id */ + id?: (flyteidl.core.IIdentifier|null); + } + + /** Represents a TaskErrorExistsIdenticalStructure. */ + class TaskErrorExistsIdenticalStructure implements ITaskErrorExistsIdenticalStructure { + + /** + * Constructs a new TaskErrorExistsIdenticalStructure. + * @param [properties] Properties to set + */ + constructor(properties?: flyteidl.admin.ITaskErrorExistsIdenticalStructure); + + /** TaskErrorExistsIdenticalStructure id. */ + public id?: (flyteidl.core.IIdentifier|null); + + /** + * Creates a new TaskErrorExistsIdenticalStructure instance using the specified properties. + * @param [properties] Properties to set + * @returns TaskErrorExistsIdenticalStructure instance + */ + public static create(properties?: flyteidl.admin.ITaskErrorExistsIdenticalStructure): flyteidl.admin.TaskErrorExistsIdenticalStructure; + + /** + * Encodes the specified TaskErrorExistsIdenticalStructure message. Does not implicitly {@link flyteidl.admin.TaskErrorExistsIdenticalStructure.verify|verify} messages. + * @param message TaskErrorExistsIdenticalStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: flyteidl.admin.ITaskErrorExistsIdenticalStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TaskErrorExistsIdenticalStructure message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TaskErrorExistsIdenticalStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): flyteidl.admin.TaskErrorExistsIdenticalStructure; + + /** + * Verifies a TaskErrorExistsIdenticalStructure message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + } + + /** Properties of a CreateTaskFailureReason. */ + interface ICreateTaskFailureReason { + + /** CreateTaskFailureReason existsDifferentStructure */ + existsDifferentStructure?: (flyteidl.admin.ITaskErrorExistsDifferentStructure|null); + + /** CreateTaskFailureReason existsIdenticalStructure */ + existsIdenticalStructure?: (flyteidl.admin.ITaskErrorExistsIdenticalStructure|null); + } + + /** Represents a CreateTaskFailureReason. */ + class CreateTaskFailureReason implements ICreateTaskFailureReason { + + /** + * Constructs a new CreateTaskFailureReason. + * @param [properties] Properties to set + */ + constructor(properties?: flyteidl.admin.ICreateTaskFailureReason); + + /** CreateTaskFailureReason existsDifferentStructure. */ + public existsDifferentStructure?: (flyteidl.admin.ITaskErrorExistsDifferentStructure|null); + + /** CreateTaskFailureReason existsIdenticalStructure. */ + public existsIdenticalStructure?: (flyteidl.admin.ITaskErrorExistsIdenticalStructure|null); + + /** CreateTaskFailureReason reason. */ + public reason?: ("existsDifferentStructure"|"existsIdenticalStructure"); + + /** + * Creates a new CreateTaskFailureReason instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateTaskFailureReason instance + */ + public static create(properties?: flyteidl.admin.ICreateTaskFailureReason): flyteidl.admin.CreateTaskFailureReason; + + /** + * Encodes the specified CreateTaskFailureReason message. Does not implicitly {@link flyteidl.admin.CreateTaskFailureReason.verify|verify} messages. + * @param message CreateTaskFailureReason message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: flyteidl.admin.ICreateTaskFailureReason, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateTaskFailureReason message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateTaskFailureReason + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): flyteidl.admin.CreateTaskFailureReason; + + /** + * Verifies a CreateTaskFailureReason message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + } + /** Properties of a TaskExecutionGetRequest. */ interface ITaskExecutionGetRequest { diff --git a/flyteidl/gen/pb-js/flyteidl.js b/flyteidl/gen/pb-js/flyteidl.js index 4ec39993c5..aad8d9673a 100644 --- a/flyteidl/gen/pb-js/flyteidl.js +++ b/flyteidl/gen/pb-js/flyteidl.js @@ -46536,6 +46536,422 @@ return TaskClosure; })(); + admin.TaskErrorExistsDifferentStructure = (function() { + + /** + * Properties of a TaskErrorExistsDifferentStructure. + * @memberof flyteidl.admin + * @interface ITaskErrorExistsDifferentStructure + * @property {flyteidl.core.IIdentifier|null} [id] TaskErrorExistsDifferentStructure id + * @property {flyteidl.core.ITaskTemplate|null} [oldSpec] TaskErrorExistsDifferentStructure oldSpec + * @property {flyteidl.core.ITaskTemplate|null} [newSpec] TaskErrorExistsDifferentStructure newSpec + */ + + /** + * Constructs a new TaskErrorExistsDifferentStructure. + * @memberof flyteidl.admin + * @classdesc Represents a TaskErrorExistsDifferentStructure. + * @implements ITaskErrorExistsDifferentStructure + * @constructor + * @param {flyteidl.admin.ITaskErrorExistsDifferentStructure=} [properties] Properties to set + */ + function TaskErrorExistsDifferentStructure(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TaskErrorExistsDifferentStructure id. + * @member {flyteidl.core.IIdentifier|null|undefined} id + * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure + * @instance + */ + TaskErrorExistsDifferentStructure.prototype.id = null; + + /** + * TaskErrorExistsDifferentStructure oldSpec. + * @member {flyteidl.core.ITaskTemplate|null|undefined} oldSpec + * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure + * @instance + */ + TaskErrorExistsDifferentStructure.prototype.oldSpec = null; + + /** + * TaskErrorExistsDifferentStructure newSpec. + * @member {flyteidl.core.ITaskTemplate|null|undefined} newSpec + * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure + * @instance + */ + TaskErrorExistsDifferentStructure.prototype.newSpec = null; + + /** + * Creates a new TaskErrorExistsDifferentStructure instance using the specified properties. + * @function create + * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure + * @static + * @param {flyteidl.admin.ITaskErrorExistsDifferentStructure=} [properties] Properties to set + * @returns {flyteidl.admin.TaskErrorExistsDifferentStructure} TaskErrorExistsDifferentStructure instance + */ + TaskErrorExistsDifferentStructure.create = function create(properties) { + return new TaskErrorExistsDifferentStructure(properties); + }; + + /** + * Encodes the specified TaskErrorExistsDifferentStructure message. Does not implicitly {@link flyteidl.admin.TaskErrorExistsDifferentStructure.verify|verify} messages. + * @function encode + * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure + * @static + * @param {flyteidl.admin.ITaskErrorExistsDifferentStructure} message TaskErrorExistsDifferentStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TaskErrorExistsDifferentStructure.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && message.hasOwnProperty("id")) + $root.flyteidl.core.Identifier.encode(message.id, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.oldSpec != null && message.hasOwnProperty("oldSpec")) + $root.flyteidl.core.TaskTemplate.encode(message.oldSpec, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.newSpec != null && message.hasOwnProperty("newSpec")) + $root.flyteidl.core.TaskTemplate.encode(message.newSpec, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Decodes a TaskErrorExistsDifferentStructure message from the specified reader or buffer. + * @function decode + * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {flyteidl.admin.TaskErrorExistsDifferentStructure} TaskErrorExistsDifferentStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TaskErrorExistsDifferentStructure.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.flyteidl.admin.TaskErrorExistsDifferentStructure(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = $root.flyteidl.core.Identifier.decode(reader, reader.uint32()); + break; + case 2: + message.oldSpec = $root.flyteidl.core.TaskTemplate.decode(reader, reader.uint32()); + break; + case 3: + message.newSpec = $root.flyteidl.core.TaskTemplate.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Verifies a TaskErrorExistsDifferentStructure message. + * @function verify + * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TaskErrorExistsDifferentStructure.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) { + var error = $root.flyteidl.core.Identifier.verify(message.id); + if (error) + return "id." + error; + } + if (message.oldSpec != null && message.hasOwnProperty("oldSpec")) { + var error = $root.flyteidl.core.TaskTemplate.verify(message.oldSpec); + if (error) + return "oldSpec." + error; + } + if (message.newSpec != null && message.hasOwnProperty("newSpec")) { + var error = $root.flyteidl.core.TaskTemplate.verify(message.newSpec); + if (error) + return "newSpec." + error; + } + return null; + }; + + return TaskErrorExistsDifferentStructure; + })(); + + admin.TaskErrorExistsIdenticalStructure = (function() { + + /** + * Properties of a TaskErrorExistsIdenticalStructure. + * @memberof flyteidl.admin + * @interface ITaskErrorExistsIdenticalStructure + * @property {flyteidl.core.IIdentifier|null} [id] TaskErrorExistsIdenticalStructure id + */ + + /** + * Constructs a new TaskErrorExistsIdenticalStructure. + * @memberof flyteidl.admin + * @classdesc Represents a TaskErrorExistsIdenticalStructure. + * @implements ITaskErrorExistsIdenticalStructure + * @constructor + * @param {flyteidl.admin.ITaskErrorExistsIdenticalStructure=} [properties] Properties to set + */ + function TaskErrorExistsIdenticalStructure(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TaskErrorExistsIdenticalStructure id. + * @member {flyteidl.core.IIdentifier|null|undefined} id + * @memberof flyteidl.admin.TaskErrorExistsIdenticalStructure + * @instance + */ + TaskErrorExistsIdenticalStructure.prototype.id = null; + + /** + * Creates a new TaskErrorExistsIdenticalStructure instance using the specified properties. + * @function create + * @memberof flyteidl.admin.TaskErrorExistsIdenticalStructure + * @static + * @param {flyteidl.admin.ITaskErrorExistsIdenticalStructure=} [properties] Properties to set + * @returns {flyteidl.admin.TaskErrorExistsIdenticalStructure} TaskErrorExistsIdenticalStructure instance + */ + TaskErrorExistsIdenticalStructure.create = function create(properties) { + return new TaskErrorExistsIdenticalStructure(properties); + }; + + /** + * Encodes the specified TaskErrorExistsIdenticalStructure message. Does not implicitly {@link flyteidl.admin.TaskErrorExistsIdenticalStructure.verify|verify} messages. + * @function encode + * @memberof flyteidl.admin.TaskErrorExistsIdenticalStructure + * @static + * @param {flyteidl.admin.ITaskErrorExistsIdenticalStructure} message TaskErrorExistsIdenticalStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TaskErrorExistsIdenticalStructure.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && message.hasOwnProperty("id")) + $root.flyteidl.core.Identifier.encode(message.id, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Decodes a TaskErrorExistsIdenticalStructure message from the specified reader or buffer. + * @function decode + * @memberof flyteidl.admin.TaskErrorExistsIdenticalStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {flyteidl.admin.TaskErrorExistsIdenticalStructure} TaskErrorExistsIdenticalStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TaskErrorExistsIdenticalStructure.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.flyteidl.admin.TaskErrorExistsIdenticalStructure(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = $root.flyteidl.core.Identifier.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Verifies a TaskErrorExistsIdenticalStructure message. + * @function verify + * @memberof flyteidl.admin.TaskErrorExistsIdenticalStructure + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TaskErrorExistsIdenticalStructure.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) { + var error = $root.flyteidl.core.Identifier.verify(message.id); + if (error) + return "id." + error; + } + return null; + }; + + return TaskErrorExistsIdenticalStructure; + })(); + + admin.CreateTaskFailureReason = (function() { + + /** + * Properties of a CreateTaskFailureReason. + * @memberof flyteidl.admin + * @interface ICreateTaskFailureReason + * @property {flyteidl.admin.ITaskErrorExistsDifferentStructure|null} [existsDifferentStructure] CreateTaskFailureReason existsDifferentStructure + * @property {flyteidl.admin.ITaskErrorExistsIdenticalStructure|null} [existsIdenticalStructure] CreateTaskFailureReason existsIdenticalStructure + */ + + /** + * Constructs a new CreateTaskFailureReason. + * @memberof flyteidl.admin + * @classdesc Represents a CreateTaskFailureReason. + * @implements ICreateTaskFailureReason + * @constructor + * @param {flyteidl.admin.ICreateTaskFailureReason=} [properties] Properties to set + */ + function CreateTaskFailureReason(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateTaskFailureReason existsDifferentStructure. + * @member {flyteidl.admin.ITaskErrorExistsDifferentStructure|null|undefined} existsDifferentStructure + * @memberof flyteidl.admin.CreateTaskFailureReason + * @instance + */ + CreateTaskFailureReason.prototype.existsDifferentStructure = null; + + /** + * CreateTaskFailureReason existsIdenticalStructure. + * @member {flyteidl.admin.ITaskErrorExistsIdenticalStructure|null|undefined} existsIdenticalStructure + * @memberof flyteidl.admin.CreateTaskFailureReason + * @instance + */ + CreateTaskFailureReason.prototype.existsIdenticalStructure = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CreateTaskFailureReason reason. + * @member {"existsDifferentStructure"|"existsIdenticalStructure"|undefined} reason + * @memberof flyteidl.admin.CreateTaskFailureReason + * @instance + */ + Object.defineProperty(CreateTaskFailureReason.prototype, "reason", { + get: $util.oneOfGetter($oneOfFields = ["existsDifferentStructure", "existsIdenticalStructure"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CreateTaskFailureReason instance using the specified properties. + * @function create + * @memberof flyteidl.admin.CreateTaskFailureReason + * @static + * @param {flyteidl.admin.ICreateTaskFailureReason=} [properties] Properties to set + * @returns {flyteidl.admin.CreateTaskFailureReason} CreateTaskFailureReason instance + */ + CreateTaskFailureReason.create = function create(properties) { + return new CreateTaskFailureReason(properties); + }; + + /** + * Encodes the specified CreateTaskFailureReason message. Does not implicitly {@link flyteidl.admin.CreateTaskFailureReason.verify|verify} messages. + * @function encode + * @memberof flyteidl.admin.CreateTaskFailureReason + * @static + * @param {flyteidl.admin.ICreateTaskFailureReason} message CreateTaskFailureReason message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTaskFailureReason.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.existsDifferentStructure != null && message.hasOwnProperty("existsDifferentStructure")) + $root.flyteidl.admin.TaskErrorExistsDifferentStructure.encode(message.existsDifferentStructure, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.existsIdenticalStructure != null && message.hasOwnProperty("existsIdenticalStructure")) + $root.flyteidl.admin.TaskErrorExistsIdenticalStructure.encode(message.existsIdenticalStructure, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Decodes a CreateTaskFailureReason message from the specified reader or buffer. + * @function decode + * @memberof flyteidl.admin.CreateTaskFailureReason + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {flyteidl.admin.CreateTaskFailureReason} CreateTaskFailureReason + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTaskFailureReason.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.flyteidl.admin.CreateTaskFailureReason(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.existsDifferentStructure = $root.flyteidl.admin.TaskErrorExistsDifferentStructure.decode(reader, reader.uint32()); + break; + case 2: + message.existsIdenticalStructure = $root.flyteidl.admin.TaskErrorExistsIdenticalStructure.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Verifies a CreateTaskFailureReason message. + * @function verify + * @memberof flyteidl.admin.CreateTaskFailureReason + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateTaskFailureReason.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.existsDifferentStructure != null && message.hasOwnProperty("existsDifferentStructure")) { + properties.reason = 1; + { + var error = $root.flyteidl.admin.TaskErrorExistsDifferentStructure.verify(message.existsDifferentStructure); + if (error) + return "existsDifferentStructure." + error; + } + } + if (message.existsIdenticalStructure != null && message.hasOwnProperty("existsIdenticalStructure")) { + if (properties.reason === 1) + return "reason: multiple values"; + properties.reason = 1; + { + var error = $root.flyteidl.admin.TaskErrorExistsIdenticalStructure.verify(message.existsIdenticalStructure); + if (error) + return "existsIdenticalStructure." + error; + } + } + return null; + }; + + return CreateTaskFailureReason; + })(); + admin.TaskExecutionGetRequest = (function() { /** diff --git a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py index 97dc00dfef..7bb12b3f99 100644 --- a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py +++ b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py @@ -18,7 +18,7 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19\x66lyteidl/admin/task.proto\x12\x0e\x66lyteidl.admin\x1a\x1e\x66lyteidl/core/identifier.proto\x1a\x19\x66lyteidl/core/tasks.proto\x1a\x1c\x66lyteidl/core/compiler.proto\x1a\'flyteidl/admin/description_entity.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"l\n\x11TaskCreateRequest\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12,\n\x04spec\x18\x02 \x01(\x0b\x32\x18.flyteidl.admin.TaskSpecR\x04spec\"\x14\n\x12TaskCreateResponse\"\x95\x01\n\x04Task\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12\x35\n\x07\x63losure\x18\x02 \x01(\x0b\x32\x1b.flyteidl.admin.TaskClosureR\x07\x63losure\x12+\n\x11short_description\x18\x03 \x01(\tR\x10shortDescription\"L\n\x08TaskList\x12*\n\x05tasks\x18\x01 \x03(\x0b\x32\x14.flyteidl.admin.TaskR\x05tasks\x12\x14\n\x05token\x18\x02 \x01(\tR\x05token\"\x88\x01\n\x08TaskSpec\x12\x37\n\x08template\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.TaskTemplateR\x08template\x12\x43\n\x0b\x64\x65scription\x18\x02 \x01(\x0b\x32!.flyteidl.admin.DescriptionEntityR\x0b\x64\x65scription\"\x8a\x01\n\x0bTaskClosure\x12@\n\rcompiled_task\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.CompiledTaskR\x0c\x63ompiledTask\x12\x39\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAtB\xb5\x01\n\x12\x63om.flyteidl.adminB\tTaskProtoP\x01Z;github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin\xa2\x02\x03\x46\x41X\xaa\x02\x0e\x46lyteidl.Admin\xca\x02\x0e\x46lyteidl\\Admin\xe2\x02\x1a\x46lyteidl\\Admin\\GPBMetadata\xea\x02\x0f\x46lyteidl::Adminb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19\x66lyteidl/admin/task.proto\x12\x0e\x66lyteidl.admin\x1a\x1e\x66lyteidl/core/identifier.proto\x1a\x19\x66lyteidl/core/tasks.proto\x1a\x1c\x66lyteidl/core/compiler.proto\x1a\'flyteidl/admin/description_entity.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"l\n\x11TaskCreateRequest\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12,\n\x04spec\x18\x02 \x01(\x0b\x32\x18.flyteidl.admin.TaskSpecR\x04spec\"\x14\n\x12TaskCreateResponse\"\x95\x01\n\x04Task\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12\x35\n\x07\x63losure\x18\x02 \x01(\x0b\x32\x1b.flyteidl.admin.TaskClosureR\x07\x63losure\x12+\n\x11short_description\x18\x03 \x01(\tR\x10shortDescription\"L\n\x08TaskList\x12*\n\x05tasks\x18\x01 \x03(\x0b\x32\x14.flyteidl.admin.TaskR\x05tasks\x12\x14\n\x05token\x18\x02 \x01(\tR\x05token\"\x88\x01\n\x08TaskSpec\x12\x37\n\x08template\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.TaskTemplateR\x08template\x12\x43\n\x0b\x64\x65scription\x18\x02 \x01(\x0b\x32!.flyteidl.admin.DescriptionEntityR\x0b\x64\x65scription\"\x8a\x01\n\x0bTaskClosure\x12@\n\rcompiled_task\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.CompiledTaskR\x0c\x63ompiledTask\x12\x39\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\"\xbe\x01\n!TaskErrorExistsDifferentStructure\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12\x36\n\x08old_spec\x18\x02 \x01(\x0b\x32\x1b.flyteidl.core.TaskTemplateR\x07oldSpec\x12\x36\n\x08new_spec\x18\x03 \x01(\x0b\x32\x1b.flyteidl.core.TaskTemplateR\x07newSpec\"N\n!TaskErrorExistsIdenticalStructure\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\"\x89\x02\n\x17\x43reateTaskFailureReason\x12q\n\x1a\x65xists_different_structure\x18\x01 \x01(\x0b\x32\x31.flyteidl.admin.TaskErrorExistsDifferentStructureH\x00R\x18\x65xistsDifferentStructure\x12q\n\x1a\x65xists_identical_structure\x18\x02 \x01(\x0b\x32\x31.flyteidl.admin.TaskErrorExistsIdenticalStructureH\x00R\x18\x65xistsIdenticalStructureB\x08\n\x06reasonB\xb5\x01\n\x12\x63om.flyteidl.adminB\tTaskProtoP\x01Z;github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin\xa2\x02\x03\x46\x41X\xaa\x02\x0e\x46lyteidl.Admin\xca\x02\x0e\x46lyteidl\\Admin\xe2\x02\x1a\x46lyteidl\\Admin\\GPBMetadata\xea\x02\x0f\x46lyteidl::Adminb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -39,4 +39,10 @@ _globals['_TASKSPEC']._serialized_end=707 _globals['_TASKCLOSURE']._serialized_start=710 _globals['_TASKCLOSURE']._serialized_end=848 + _globals['_TASKERROREXISTSDIFFERENTSTRUCTURE']._serialized_start=851 + _globals['_TASKERROREXISTSDIFFERENTSTRUCTURE']._serialized_end=1041 + _globals['_TASKERROREXISTSIDENTICALSTRUCTURE']._serialized_start=1043 + _globals['_TASKERROREXISTSIDENTICALSTRUCTURE']._serialized_end=1121 + _globals['_CREATETASKFAILUREREASON']._serialized_start=1124 + _globals['_CREATETASKFAILUREREASON']._serialized_end=1389 # @@protoc_insertion_point(module_scope) diff --git a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi index 2e6370fba5..e63d7fbf35 100644 --- a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi +++ b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi @@ -55,3 +55,27 @@ class TaskClosure(_message.Message): compiled_task: _compiler_pb2.CompiledTask created_at: _timestamp_pb2.Timestamp def __init__(self, compiled_task: _Optional[_Union[_compiler_pb2.CompiledTask, _Mapping]] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class TaskErrorExistsDifferentStructure(_message.Message): + __slots__ = ["id", "old_spec", "new_spec"] + ID_FIELD_NUMBER: _ClassVar[int] + OLD_SPEC_FIELD_NUMBER: _ClassVar[int] + NEW_SPEC_FIELD_NUMBER: _ClassVar[int] + id: _identifier_pb2.Identifier + old_spec: _tasks_pb2.TaskTemplate + new_spec: _tasks_pb2.TaskTemplate + def __init__(self, id: _Optional[_Union[_identifier_pb2.Identifier, _Mapping]] = ..., old_spec: _Optional[_Union[_tasks_pb2.TaskTemplate, _Mapping]] = ..., new_spec: _Optional[_Union[_tasks_pb2.TaskTemplate, _Mapping]] = ...) -> None: ... + +class TaskErrorExistsIdenticalStructure(_message.Message): + __slots__ = ["id"] + ID_FIELD_NUMBER: _ClassVar[int] + id: _identifier_pb2.Identifier + def __init__(self, id: _Optional[_Union[_identifier_pb2.Identifier, _Mapping]] = ...) -> None: ... + +class CreateTaskFailureReason(_message.Message): + __slots__ = ["exists_different_structure", "exists_identical_structure"] + EXISTS_DIFFERENT_STRUCTURE_FIELD_NUMBER: _ClassVar[int] + EXISTS_IDENTICAL_STRUCTURE_FIELD_NUMBER: _ClassVar[int] + exists_different_structure: TaskErrorExistsDifferentStructure + exists_identical_structure: TaskErrorExistsIdenticalStructure + def __init__(self, exists_different_structure: _Optional[_Union[TaskErrorExistsDifferentStructure, _Mapping]] = ..., exists_identical_structure: _Optional[_Union[TaskErrorExistsIdenticalStructure, _Mapping]] = ...) -> None: ... diff --git a/flyteidl/gen/pb_rust/flyteidl.admin.rs b/flyteidl/gen/pb_rust/flyteidl.admin.rs index 3995c67bb0..1800c64394 100644 --- a/flyteidl/gen/pb_rust/flyteidl.admin.rs +++ b/flyteidl/gen/pb_rust/flyteidl.admin.rs @@ -2908,6 +2908,42 @@ pub struct TaskClosure { #[prost(message, optional, tag="2")] pub created_at: ::core::option::Option<::prost_types::Timestamp>, } +/// The task id is already used and the structure is different +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TaskErrorExistsDifferentStructure { + #[prost(message, optional, tag="1")] + pub id: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub old_spec: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub new_spec: ::core::option::Option, +} +/// The task id is already used with an identical sctructure +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TaskErrorExistsIdenticalStructure { + #[prost(message, optional, tag="1")] + pub id: ::core::option::Option, +} +/// When a CreateTaskRequest fails due to matching id +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateTaskFailureReason { + #[prost(oneof="create_task_failure_reason::Reason", tags="1, 2")] + pub reason: ::core::option::Option, +} +/// Nested message and enum types in `CreateTaskFailureReason`. +pub mod create_task_failure_reason { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Reason { + #[prost(message, tag="1")] + ExistsDifferentStructure(super::TaskErrorExistsDifferentStructure), + #[prost(message, tag="2")] + ExistsIdenticalStructure(super::TaskErrorExistsIdenticalStructure), + } +} /// A message used to fetch a single task execution entity. /// See :ref:`ref_flyteidl.admin.TaskExecution` for more details #[allow(clippy::derive_partial_eq_without_eq)] From f37a90e4959edd0015af07ea998888f2de2b75b8 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Wed, 21 Feb 2024 14:52:43 +0800 Subject: [PATCH 04/13] add task diff DifferentStructureError msg Signed-off-by: Austin Liu --- flyteadmin/pkg/errors/errors.go | 47 +++++++++++++++++++++ flyteadmin/pkg/manager/impl/task_manager.go | 10 +++-- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/flyteadmin/pkg/errors/errors.go b/flyteadmin/pkg/errors/errors.go index e269715a91..7f994f2628 100644 --- a/flyteadmin/pkg/errors/errors.go +++ b/flyteadmin/pkg/errors/errors.go @@ -3,14 +3,17 @@ package errors import ( "context" + "encoding/json" "fmt" "strings" "github.com/golang/protobuf/proto" + "github.com/wI2L/jsondiff" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" "github.com/flyteorg/flyte/flytestdlib/logger" ) @@ -109,6 +112,50 @@ func NewIncompatibleClusterError(ctx context.Context, errorMsg, curCluster strin return statusErr } +func NewTaskExistsDifferentStructureError(ctx context.Context, request *admin.TaskCreateRequest, oldSpec *core.TaskTemplate, newSpec *core.TaskTemplate) FlyteAdminError { + errorMsg := "task with different structure already exists " + diff, err := jsondiff.Compare(oldSpec, newSpec) + if err != nil { + return NewFlyteAdminErrorf(codes.InvalidArgument, errorMsg+"diff computation on two different structures failed") + } + diffString, err := json.Marshal(diff) + if err != nil { + return NewFlyteAdminErrorf(codes.InvalidArgument, errorMsg+"marshal diff computation output failed") + } + errorMsg += string(diffString) + + statusErr, transformationErr := NewFlyteAdminError(codes.InvalidArgument, errorMsg).WithDetails(&admin.CreateTaskFailureReason{ + Reason: &admin.CreateTaskFailureReason_ExistsDifferentStructure{ + ExistsDifferentStructure: &admin.TaskErrorExistsDifferentStructure{ + Id: request.Id, + OldSpec: oldSpec, + NewSpec: newSpec, + }, + }, + }) + if transformationErr != nil { + logger.Panicf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) + return NewFlyteAdminErrorf(codes.InvalidArgument, errorMsg) + } + return statusErr +} + +func NewTaskExistsIdenticalStructureError(ctx context.Context, request *admin.TaskCreateRequest) FlyteAdminError { + errorMsg := "task with identical structure already exists" + statusErr, transformationErr := NewFlyteAdminError(codes.AlreadyExists, errorMsg).WithDetails(&admin.CreateTaskFailureReason{ + Reason: &admin.CreateTaskFailureReason_ExistsIdenticalStructure{ + ExistsIdenticalStructure: &admin.TaskErrorExistsIdenticalStructure{ + Id: request.Id, + }, + }, + }) + if transformationErr != nil { + logger.Panicf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) + return NewFlyteAdminErrorf(codes.AlreadyExists, errorMsg) + } + return statusErr +} + func NewWorkflowExistsDifferentStructureError(ctx context.Context, request *admin.WorkflowCreateRequest) FlyteAdminError { errorMsg := "workflow with different structure already exists" statusErr, transformationErr := NewFlyteAdminError(codes.InvalidArgument, errorMsg).WithDetails(&admin.CreateWorkflowFailureReason{ diff --git a/flyteadmin/pkg/manager/impl/task_manager.go b/flyteadmin/pkg/manager/impl/task_manager.go index d42639c31e..1218d3a239 100644 --- a/flyteadmin/pkg/manager/impl/task_manager.go +++ b/flyteadmin/pkg/manager/impl/task_manager.go @@ -92,11 +92,13 @@ func (t *TaskManager) CreateTask( existingTask, err := util.GetTaskModel(ctx, t.db, request.Spec.Template.Id) if err == nil { if bytes.Equal(taskDigest, existingTask.Digest) { - return nil, errors.NewFlyteAdminErrorf(codes.AlreadyExists, - "identical task already exists with id %s", request.Id) + return nil, errors.NewTaskExistsIdenticalStructureError(ctx, &request) } - return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument, - "task with different structure already exists with id %v", request.Id) + t2, err2 := util.GetTask(ctx, t.db, *request.Id) + if err2 != nil { + return nil, errors.NewTaskExistsDifferentStructureError(ctx, &request, t2.Closure.CompiledTask.Template, compiledTask.Template) + } + return nil, errors.NewTaskExistsDifferentStructureError(ctx, &request, t2.Closure.CompiledTask.Template, compiledTask.Template) } taskModel, err := transformers.CreateTaskModel(finalizedRequest, admin.TaskClosure{ CompiledTask: compiledTask, From 713f93a077c327bbb0901a54529ca4e2a3d6fd91 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Sat, 24 Feb 2024 04:18:46 +0800 Subject: [PATCH 05/13] prettify json error message & rollback idl change Signed-off-by: Austin Liu --- flyteadmin/go.mod | 4 - flyteadmin/go.sum | 11 -- flyteadmin/pkg/errors/errors.go | 45 ++++--- flyteadmin/pkg/manager/impl/task_manager.go | 10 +- .../pkg/manager/impl/workflow_manager.go | 6 +- flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts | 12 -- flyteidl/gen/pb-go/flyteidl/admin/task.pb.go | 119 +++++++----------- flyteidl/gen/pb-js/flyteidl.d.ts | 12 -- flyteidl/gen/pb-js/flyteidl.js | 38 ------ .../gen/pb_python/flyteidl/admin/task_pb2.py | 14 +-- .../gen/pb_python/flyteidl/admin/task_pb2.pyi | 8 +- flyteidl/gen/pb_rust/flyteidl.admin.rs | 4 - flyteidl/protos/flyteidl/admin/task.proto | 2 - go.mod | 2 +- go.sum | 4 +- 15 files changed, 99 insertions(+), 192 deletions(-) diff --git a/flyteadmin/go.mod b/flyteadmin/go.mod index 18f7b2eaf9..fd8aa4bc34 100644 --- a/flyteadmin/go.mod +++ b/flyteadmin/go.mod @@ -167,10 +167,6 @@ require ( github.com/spf13/viper v1.11.0 // indirect github.com/stretchr/objx v0.5.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect - github.com/tidwall/gjson v1.17.0 // indirect - github.com/tidwall/match v1.1.1 // indirect - github.com/tidwall/pretty v1.2.0 // indirect - github.com/tidwall/sjson v1.2.5 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect diff --git a/flyteadmin/go.sum b/flyteadmin/go.sum index 6e6479957a..0693371e59 100644 --- a/flyteadmin/go.sum +++ b/flyteadmin/go.sum @@ -1265,22 +1265,13 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/tidwall/gjson v1.3.2/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= github.com/tidwall/gjson v1.6.8/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= github.com/tidwall/gjson v1.7.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= -github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM= -github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.0.4/go.mod h1:bURseu1nuBkFpIES5cz6zBtjmYeOQmEESshn7VpF15Y= github.com/tidwall/sjson v1.1.5/go.mod h1:VuJzsZnTowhSxWdOgsAnb886i4AjEyTkk7tNtsL7EYE= -github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= -github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= @@ -1297,8 +1288,6 @@ github.com/unrolled/secure v0.0.0-20181005190816-ff9db2ff917f/go.mod h1:mnPT77IA github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/wI2L/jsondiff v0.5.0 h1:RRMTi/mH+R2aXcPe1VYyvGINJqQfC3R+KSEakuU1Ikw= -github.com/wI2L/jsondiff v0.5.0/go.mod h1:qqG6hnK0Lsrz2BpIVCxWiK9ItsBCpIZQiv0izJjOZ9s= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= diff --git a/flyteadmin/pkg/errors/errors.go b/flyteadmin/pkg/errors/errors.go index 7f994f2628..73f8c260a9 100644 --- a/flyteadmin/pkg/errors/errors.go +++ b/flyteadmin/pkg/errors/errors.go @@ -3,7 +3,6 @@ package errors import ( "context" - "encoding/json" "fmt" "strings" @@ -112,24 +111,34 @@ func NewIncompatibleClusterError(ctx context.Context, errorMsg, curCluster strin return statusErr } -func NewTaskExistsDifferentStructureError(ctx context.Context, request *admin.TaskCreateRequest, oldSpec *core.TaskTemplate, newSpec *core.TaskTemplate) FlyteAdminError { - errorMsg := "task with different structure already exists " - diff, err := jsondiff.Compare(oldSpec, newSpec) - if err != nil { - return NewFlyteAdminErrorf(codes.InvalidArgument, errorMsg+"diff computation on two different structures failed") +func compareJsons(jsonArray1 jsondiff.Patch, jsonArray2 jsondiff.Patch) []string { + results := []string{} + map1 := make(map[string]jsondiff.Operation) + for _, obj := range jsonArray1 { + map1[obj.Path] = obj } - diffString, err := json.Marshal(diff) - if err != nil { - return NewFlyteAdminErrorf(codes.InvalidArgument, errorMsg+"marshal diff computation output failed") + + for _, obj := range jsonArray2 { + if val, ok := map1[obj.Path]; ok { + result := fmt.Sprintf("%s: %s -> %s\t", obj.Path, obj.Value, val.Value) + results = append(results, result) + } } - errorMsg += string(diffString) + return results +} + +func NewTaskExistsDifferentStructureError(ctx context.Context, request *admin.TaskCreateRequest, oldSpec *core.TaskTemplate, newSpec *core.TaskTemplate) FlyteAdminError { + errorMsg := "task with different structure already exists:\n" + // omit source code file object storage path + diff, _ := jsondiff.Compare(oldSpec, newSpec, jsondiff.Ignores("/Target/Container/args/2")) + rdiff, _ := jsondiff.Compare(newSpec, oldSpec, jsondiff.Ignores("/Target/Container/args/2")) + rs := compareJsons(diff, rdiff) + errorMsg += strings.Join(rs, "\n") statusErr, transformationErr := NewFlyteAdminError(codes.InvalidArgument, errorMsg).WithDetails(&admin.CreateTaskFailureReason{ Reason: &admin.CreateTaskFailureReason_ExistsDifferentStructure{ ExistsDifferentStructure: &admin.TaskErrorExistsDifferentStructure{ - Id: request.Id, - OldSpec: oldSpec, - NewSpec: newSpec, + Id: request.Id, }, }, }) @@ -156,8 +165,14 @@ func NewTaskExistsIdenticalStructureError(ctx context.Context, request *admin.Ta return statusErr } -func NewWorkflowExistsDifferentStructureError(ctx context.Context, request *admin.WorkflowCreateRequest) FlyteAdminError { - errorMsg := "workflow with different structure already exists" +func NewWorkflowExistsDifferentStructureError(ctx context.Context, request *admin.WorkflowCreateRequest, oldTemplate *core.TaskTemplate, newTemplate *core.TaskTemplate) FlyteAdminError { + errorMsg := "workflow with different structure already exists:\n" + // omit source code file object storage path + diff, _ := jsondiff.Compare(oldTemplate, newTemplate, jsondiff.Ignores("/Target/Container/args/2")) + rdiff, _ := jsondiff.Compare(newTemplate, oldTemplate, jsondiff.Ignores("/Target/Container/args/2")) + rs := compareJsons(diff, rdiff) + errorMsg += strings.Join(rs, "\n") + statusErr, transformationErr := NewFlyteAdminError(codes.InvalidArgument, errorMsg).WithDetails(&admin.CreateWorkflowFailureReason{ Reason: &admin.CreateWorkflowFailureReason_ExistsDifferentStructure{ ExistsDifferentStructure: &admin.WorkflowErrorExistsDifferentStructure{ diff --git a/flyteadmin/pkg/manager/impl/task_manager.go b/flyteadmin/pkg/manager/impl/task_manager.go index 1218d3a239..e0cb320480 100644 --- a/flyteadmin/pkg/manager/impl/task_manager.go +++ b/flyteadmin/pkg/manager/impl/task_manager.go @@ -89,16 +89,16 @@ func (t *TaskManager) CreateTask( return nil, err } // See if a task exists and confirm whether it's an identical task or one that with a separate definition. - existingTask, err := util.GetTaskModel(ctx, t.db, request.Spec.Template.Id) + existingTaskModel, err := util.GetTaskModel(ctx, t.db, request.Spec.Template.Id) if err == nil { - if bytes.Equal(taskDigest, existingTask.Digest) { + if bytes.Equal(taskDigest, existingTaskModel.Digest) { return nil, errors.NewTaskExistsIdenticalStructureError(ctx, &request) } - t2, err2 := util.GetTask(ctx, t.db, *request.Id) + existingTask, err2 := util.GetTask(ctx, t.db, *request.Id) if err2 != nil { - return nil, errors.NewTaskExistsDifferentStructureError(ctx, &request, t2.Closure.CompiledTask.Template, compiledTask.Template) + return nil, err2 } - return nil, errors.NewTaskExistsDifferentStructureError(ctx, &request, t2.Closure.CompiledTask.Template, compiledTask.Template) + return nil, errors.NewTaskExistsDifferentStructureError(ctx, &request, existingTask.Closure.CompiledTask.Template, compiledTask.Template) } taskModel, err := transformers.CreateTaskModel(finalizedRequest, admin.TaskClosure{ CompiledTask: compiledTask, diff --git a/flyteadmin/pkg/manager/impl/workflow_manager.go b/flyteadmin/pkg/manager/impl/workflow_manager.go index 4b755a4707..5516fb8d40 100644 --- a/flyteadmin/pkg/manager/impl/workflow_manager.go +++ b/flyteadmin/pkg/manager/impl/workflow_manager.go @@ -168,8 +168,12 @@ func (w *WorkflowManager) CreateWorkflow( if bytes.Equal(workflowDigest, existingWorkflowModel.Digest) { return nil, errors.NewWorkflowExistsIdenticalStructureError(ctx, &request) } + existingWorkflow, err2 := util.GetWorkflow(ctx, w.db, w.storageClient, *request.Id) + if err2 != nil { + return nil, err2 + } // A workflow exists with different structure - return nil, errors.NewWorkflowExistsDifferentStructureError(ctx, &request) + return nil, errors.NewWorkflowExistsDifferentStructureError(ctx, &request, existingWorkflow.Closure.CompiledWorkflow.Tasks[0].Template, workflowClosure.CompiledWorkflow.Tasks[0].Template) } else if flyteAdminError, ok := err.(errors.FlyteAdminError); !ok || flyteAdminError.Code() != codes.NotFound { logger.Debugf(ctx, "Failed to get workflow for comparison in CreateWorkflow with ID [%+v] with err %v", request.Id, err) diff --git a/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts b/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts index 2f50f1ef02..d8cfcb2dc6 100644 --- a/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts +++ b/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts @@ -317,16 +317,6 @@ export class TaskErrorExistsDifferentStructure extends Message) { super(); proto3.util.initPartial(data, this); @@ -336,8 +326,6 @@ export class TaskErrorExistsDifferentStructure extends Message [ { no: 1, name: "id", kind: "message", T: Identifier }, - { no: 2, name: "old_spec", kind: "message", T: TaskTemplate }, - { no: 3, name: "new_spec", kind: "message", T: TaskTemplate }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): TaskErrorExistsDifferentStructure { diff --git a/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go b/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go index 980f34c185..60282fa7e6 100644 --- a/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go +++ b/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go @@ -374,9 +374,7 @@ type TaskErrorExistsDifferentStructure struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *core.Identifier `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - OldSpec *core.TaskTemplate `protobuf:"bytes,2,opt,name=old_spec,json=oldSpec,proto3" json:"old_spec,omitempty"` - NewSpec *core.TaskTemplate `protobuf:"bytes,3,opt,name=new_spec,json=newSpec,proto3" json:"new_spec,omitempty"` + Id *core.Identifier `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } func (x *TaskErrorExistsDifferentStructure) Reset() { @@ -418,20 +416,6 @@ func (x *TaskErrorExistsDifferentStructure) GetId() *core.Identifier { return nil } -func (x *TaskErrorExistsDifferentStructure) GetOldSpec() *core.TaskTemplate { - if x != nil { - return x.OldSpec - } - return nil -} - -func (x *TaskErrorExistsDifferentStructure) GetNewSpec() *core.TaskTemplate { - if x != nil { - return x.NewSpec - } - return nil -} - // The task id is already used with an identical sctructure type TaskErrorExistsIdenticalStructure struct { state protoimpl.MessageState @@ -618,52 +602,45 @@ var file_flyteidl_admin_task_proto_rawDesc = []byte{ 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x22, 0xbe, 0x01, 0x0a, 0x21, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, - 0x69, 0x73, 0x74, 0x73, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x36, 0x0a, 0x08, 0x6f, 0x6c, 0x64, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, - 0x52, 0x07, 0x6f, 0x6c, 0x64, 0x53, 0x70, 0x65, 0x63, 0x12, 0x36, 0x0a, 0x08, 0x6e, 0x65, 0x77, - 0x5f, 0x73, 0x70, 0x65, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x6c, - 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x61, 0x73, 0x6b, - 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x53, 0x70, 0x65, - 0x63, 0x22, 0x4e, 0x0a, 0x21, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, + 0x22, 0x4e, 0x0a, 0x21, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, 0x69, + 0x73, 0x74, 0x73, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, + 0x65, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, 0x64, + 0x22, 0x4e, 0x0a, 0x21, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, 0x69, + 0x73, 0x74, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, + 0x65, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, 0x64, + 0x22, 0x89, 0x02, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x46, + 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x71, 0x0a, 0x1a, + 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, + 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x31, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, 0x69, + 0x6e, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, 0x69, 0x73, 0x74, + 0x73, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x18, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x44, 0x69, 0x66, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x71, 0x0a, 0x1a, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, + 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, - 0x64, 0x22, 0x89, 0x02, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, - 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x71, 0x0a, - 0x1a, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x74, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x31, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, 0x69, 0x73, - 0x74, 0x73, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x18, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x44, 0x69, - 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, - 0x12, 0x71, 0x0a, 0x1a, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, - 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, - 0x78, 0x69, 0x73, 0x74, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x74, - 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x18, 0x65, 0x78, 0x69, 0x73, 0x74, - 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x75, 0x72, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0xb5, 0x01, - 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, - 0x64, 0x6d, 0x69, 0x6e, 0x42, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6c, - 0x79, 0x74, 0x65, 0x6f, 0x72, 0x67, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x2f, 0x66, 0x6c, 0x79, - 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x62, 0x2d, 0x67, 0x6f, 0x2f, - 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0xa2, 0x02, - 0x03, 0x46, 0x41, 0x58, 0xaa, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, - 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xca, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, - 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xe2, 0x02, 0x1a, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, - 0x6c, 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x3a, 0x3a, - 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x18, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, + 0x72, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0xb5, 0x01, 0x0a, + 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, + 0x6d, 0x69, 0x6e, 0x42, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6c, 0x79, + 0x74, 0x65, 0x6f, 0x72, 0x67, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x2f, 0x66, 0x6c, 0x79, 0x74, + 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x62, 0x2d, 0x67, 0x6f, 0x2f, 0x66, + 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0xa2, 0x02, 0x03, + 0x46, 0x41, 0x58, 0xaa, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x41, + 0x64, 0x6d, 0x69, 0x6e, 0xca, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x5c, + 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xe2, 0x02, 0x1a, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, + 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x0f, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x3a, 0x3a, 0x41, + 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -706,16 +683,14 @@ var file_flyteidl_admin_task_proto_depIdxs = []int32{ 12, // 7: flyteidl.admin.TaskClosure.compiled_task:type_name -> flyteidl.core.CompiledTask 13, // 8: flyteidl.admin.TaskClosure.created_at:type_name -> google.protobuf.Timestamp 9, // 9: flyteidl.admin.TaskErrorExistsDifferentStructure.id:type_name -> flyteidl.core.Identifier - 10, // 10: flyteidl.admin.TaskErrorExistsDifferentStructure.old_spec:type_name -> flyteidl.core.TaskTemplate - 10, // 11: flyteidl.admin.TaskErrorExistsDifferentStructure.new_spec:type_name -> flyteidl.core.TaskTemplate - 9, // 12: flyteidl.admin.TaskErrorExistsIdenticalStructure.id:type_name -> flyteidl.core.Identifier - 6, // 13: flyteidl.admin.CreateTaskFailureReason.exists_different_structure:type_name -> flyteidl.admin.TaskErrorExistsDifferentStructure - 7, // 14: flyteidl.admin.CreateTaskFailureReason.exists_identical_structure:type_name -> flyteidl.admin.TaskErrorExistsIdenticalStructure - 15, // [15:15] is the sub-list for method output_type - 15, // [15:15] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 9, // 10: flyteidl.admin.TaskErrorExistsIdenticalStructure.id:type_name -> flyteidl.core.Identifier + 6, // 11: flyteidl.admin.CreateTaskFailureReason.exists_different_structure:type_name -> flyteidl.admin.TaskErrorExistsDifferentStructure + 7, // 12: flyteidl.admin.CreateTaskFailureReason.exists_identical_structure:type_name -> flyteidl.admin.TaskErrorExistsIdenticalStructure + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_flyteidl_admin_task_proto_init() } diff --git a/flyteidl/gen/pb-js/flyteidl.d.ts b/flyteidl/gen/pb-js/flyteidl.d.ts index a3bd56d155..e58d9c9872 100644 --- a/flyteidl/gen/pb-js/flyteidl.d.ts +++ b/flyteidl/gen/pb-js/flyteidl.d.ts @@ -19377,12 +19377,6 @@ export namespace flyteidl { /** TaskErrorExistsDifferentStructure id */ id?: (flyteidl.core.IIdentifier|null); - - /** TaskErrorExistsDifferentStructure oldSpec */ - oldSpec?: (flyteidl.core.ITaskTemplate|null); - - /** TaskErrorExistsDifferentStructure newSpec */ - newSpec?: (flyteidl.core.ITaskTemplate|null); } /** Represents a TaskErrorExistsDifferentStructure. */ @@ -19397,12 +19391,6 @@ export namespace flyteidl { /** TaskErrorExistsDifferentStructure id. */ public id?: (flyteidl.core.IIdentifier|null); - /** TaskErrorExistsDifferentStructure oldSpec. */ - public oldSpec?: (flyteidl.core.ITaskTemplate|null); - - /** TaskErrorExistsDifferentStructure newSpec. */ - public newSpec?: (flyteidl.core.ITaskTemplate|null); - /** * Creates a new TaskErrorExistsDifferentStructure instance using the specified properties. * @param [properties] Properties to set diff --git a/flyteidl/gen/pb-js/flyteidl.js b/flyteidl/gen/pb-js/flyteidl.js index aad8d9673a..a4d8bfa67d 100644 --- a/flyteidl/gen/pb-js/flyteidl.js +++ b/flyteidl/gen/pb-js/flyteidl.js @@ -46543,8 +46543,6 @@ * @memberof flyteidl.admin * @interface ITaskErrorExistsDifferentStructure * @property {flyteidl.core.IIdentifier|null} [id] TaskErrorExistsDifferentStructure id - * @property {flyteidl.core.ITaskTemplate|null} [oldSpec] TaskErrorExistsDifferentStructure oldSpec - * @property {flyteidl.core.ITaskTemplate|null} [newSpec] TaskErrorExistsDifferentStructure newSpec */ /** @@ -46570,22 +46568,6 @@ */ TaskErrorExistsDifferentStructure.prototype.id = null; - /** - * TaskErrorExistsDifferentStructure oldSpec. - * @member {flyteidl.core.ITaskTemplate|null|undefined} oldSpec - * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure - * @instance - */ - TaskErrorExistsDifferentStructure.prototype.oldSpec = null; - - /** - * TaskErrorExistsDifferentStructure newSpec. - * @member {flyteidl.core.ITaskTemplate|null|undefined} newSpec - * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure - * @instance - */ - TaskErrorExistsDifferentStructure.prototype.newSpec = null; - /** * Creates a new TaskErrorExistsDifferentStructure instance using the specified properties. * @function create @@ -46612,10 +46594,6 @@ writer = $Writer.create(); if (message.id != null && message.hasOwnProperty("id")) $root.flyteidl.core.Identifier.encode(message.id, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.oldSpec != null && message.hasOwnProperty("oldSpec")) - $root.flyteidl.core.TaskTemplate.encode(message.oldSpec, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.newSpec != null && message.hasOwnProperty("newSpec")) - $root.flyteidl.core.TaskTemplate.encode(message.newSpec, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -46640,12 +46618,6 @@ case 1: message.id = $root.flyteidl.core.Identifier.decode(reader, reader.uint32()); break; - case 2: - message.oldSpec = $root.flyteidl.core.TaskTemplate.decode(reader, reader.uint32()); - break; - case 3: - message.newSpec = $root.flyteidl.core.TaskTemplate.decode(reader, reader.uint32()); - break; default: reader.skipType(tag & 7); break; @@ -46670,16 +46642,6 @@ if (error) return "id." + error; } - if (message.oldSpec != null && message.hasOwnProperty("oldSpec")) { - var error = $root.flyteidl.core.TaskTemplate.verify(message.oldSpec); - if (error) - return "oldSpec." + error; - } - if (message.newSpec != null && message.hasOwnProperty("newSpec")) { - var error = $root.flyteidl.core.TaskTemplate.verify(message.newSpec); - if (error) - return "newSpec." + error; - } return null; }; diff --git a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py index 7bb12b3f99..727fcb9e18 100644 --- a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py +++ b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py @@ -18,7 +18,7 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19\x66lyteidl/admin/task.proto\x12\x0e\x66lyteidl.admin\x1a\x1e\x66lyteidl/core/identifier.proto\x1a\x19\x66lyteidl/core/tasks.proto\x1a\x1c\x66lyteidl/core/compiler.proto\x1a\'flyteidl/admin/description_entity.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"l\n\x11TaskCreateRequest\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12,\n\x04spec\x18\x02 \x01(\x0b\x32\x18.flyteidl.admin.TaskSpecR\x04spec\"\x14\n\x12TaskCreateResponse\"\x95\x01\n\x04Task\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12\x35\n\x07\x63losure\x18\x02 \x01(\x0b\x32\x1b.flyteidl.admin.TaskClosureR\x07\x63losure\x12+\n\x11short_description\x18\x03 \x01(\tR\x10shortDescription\"L\n\x08TaskList\x12*\n\x05tasks\x18\x01 \x03(\x0b\x32\x14.flyteidl.admin.TaskR\x05tasks\x12\x14\n\x05token\x18\x02 \x01(\tR\x05token\"\x88\x01\n\x08TaskSpec\x12\x37\n\x08template\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.TaskTemplateR\x08template\x12\x43\n\x0b\x64\x65scription\x18\x02 \x01(\x0b\x32!.flyteidl.admin.DescriptionEntityR\x0b\x64\x65scription\"\x8a\x01\n\x0bTaskClosure\x12@\n\rcompiled_task\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.CompiledTaskR\x0c\x63ompiledTask\x12\x39\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\"\xbe\x01\n!TaskErrorExistsDifferentStructure\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12\x36\n\x08old_spec\x18\x02 \x01(\x0b\x32\x1b.flyteidl.core.TaskTemplateR\x07oldSpec\x12\x36\n\x08new_spec\x18\x03 \x01(\x0b\x32\x1b.flyteidl.core.TaskTemplateR\x07newSpec\"N\n!TaskErrorExistsIdenticalStructure\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\"\x89\x02\n\x17\x43reateTaskFailureReason\x12q\n\x1a\x65xists_different_structure\x18\x01 \x01(\x0b\x32\x31.flyteidl.admin.TaskErrorExistsDifferentStructureH\x00R\x18\x65xistsDifferentStructure\x12q\n\x1a\x65xists_identical_structure\x18\x02 \x01(\x0b\x32\x31.flyteidl.admin.TaskErrorExistsIdenticalStructureH\x00R\x18\x65xistsIdenticalStructureB\x08\n\x06reasonB\xb5\x01\n\x12\x63om.flyteidl.adminB\tTaskProtoP\x01Z;github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin\xa2\x02\x03\x46\x41X\xaa\x02\x0e\x46lyteidl.Admin\xca\x02\x0e\x46lyteidl\\Admin\xe2\x02\x1a\x46lyteidl\\Admin\\GPBMetadata\xea\x02\x0f\x46lyteidl::Adminb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19\x66lyteidl/admin/task.proto\x12\x0e\x66lyteidl.admin\x1a\x1e\x66lyteidl/core/identifier.proto\x1a\x19\x66lyteidl/core/tasks.proto\x1a\x1c\x66lyteidl/core/compiler.proto\x1a\'flyteidl/admin/description_entity.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"l\n\x11TaskCreateRequest\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12,\n\x04spec\x18\x02 \x01(\x0b\x32\x18.flyteidl.admin.TaskSpecR\x04spec\"\x14\n\x12TaskCreateResponse\"\x95\x01\n\x04Task\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12\x35\n\x07\x63losure\x18\x02 \x01(\x0b\x32\x1b.flyteidl.admin.TaskClosureR\x07\x63losure\x12+\n\x11short_description\x18\x03 \x01(\tR\x10shortDescription\"L\n\x08TaskList\x12*\n\x05tasks\x18\x01 \x03(\x0b\x32\x14.flyteidl.admin.TaskR\x05tasks\x12\x14\n\x05token\x18\x02 \x01(\tR\x05token\"\x88\x01\n\x08TaskSpec\x12\x37\n\x08template\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.TaskTemplateR\x08template\x12\x43\n\x0b\x64\x65scription\x18\x02 \x01(\x0b\x32!.flyteidl.admin.DescriptionEntityR\x0b\x64\x65scription\"\x8a\x01\n\x0bTaskClosure\x12@\n\rcompiled_task\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.CompiledTaskR\x0c\x63ompiledTask\x12\x39\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\"N\n!TaskErrorExistsDifferentStructure\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\"N\n!TaskErrorExistsIdenticalStructure\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\"\x89\x02\n\x17\x43reateTaskFailureReason\x12q\n\x1a\x65xists_different_structure\x18\x01 \x01(\x0b\x32\x31.flyteidl.admin.TaskErrorExistsDifferentStructureH\x00R\x18\x65xistsDifferentStructure\x12q\n\x1a\x65xists_identical_structure\x18\x02 \x01(\x0b\x32\x31.flyteidl.admin.TaskErrorExistsIdenticalStructureH\x00R\x18\x65xistsIdenticalStructureB\x08\n\x06reasonB\xb5\x01\n\x12\x63om.flyteidl.adminB\tTaskProtoP\x01Z;github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin\xa2\x02\x03\x46\x41X\xaa\x02\x0e\x46lyteidl.Admin\xca\x02\x0e\x46lyteidl\\Admin\xe2\x02\x1a\x46lyteidl\\Admin\\GPBMetadata\xea\x02\x0f\x46lyteidl::Adminb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -39,10 +39,10 @@ _globals['_TASKSPEC']._serialized_end=707 _globals['_TASKCLOSURE']._serialized_start=710 _globals['_TASKCLOSURE']._serialized_end=848 - _globals['_TASKERROREXISTSDIFFERENTSTRUCTURE']._serialized_start=851 - _globals['_TASKERROREXISTSDIFFERENTSTRUCTURE']._serialized_end=1041 - _globals['_TASKERROREXISTSIDENTICALSTRUCTURE']._serialized_start=1043 - _globals['_TASKERROREXISTSIDENTICALSTRUCTURE']._serialized_end=1121 - _globals['_CREATETASKFAILUREREASON']._serialized_start=1124 - _globals['_CREATETASKFAILUREREASON']._serialized_end=1389 + _globals['_TASKERROREXISTSDIFFERENTSTRUCTURE']._serialized_start=850 + _globals['_TASKERROREXISTSDIFFERENTSTRUCTURE']._serialized_end=928 + _globals['_TASKERROREXISTSIDENTICALSTRUCTURE']._serialized_start=930 + _globals['_TASKERROREXISTSIDENTICALSTRUCTURE']._serialized_end=1008 + _globals['_CREATETASKFAILUREREASON']._serialized_start=1011 + _globals['_CREATETASKFAILUREREASON']._serialized_end=1276 # @@protoc_insertion_point(module_scope) diff --git a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi index e63d7fbf35..4b2ae2cf5f 100644 --- a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi +++ b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi @@ -57,14 +57,10 @@ class TaskClosure(_message.Message): def __init__(self, compiled_task: _Optional[_Union[_compiler_pb2.CompiledTask, _Mapping]] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... class TaskErrorExistsDifferentStructure(_message.Message): - __slots__ = ["id", "old_spec", "new_spec"] + __slots__ = ["id"] ID_FIELD_NUMBER: _ClassVar[int] - OLD_SPEC_FIELD_NUMBER: _ClassVar[int] - NEW_SPEC_FIELD_NUMBER: _ClassVar[int] id: _identifier_pb2.Identifier - old_spec: _tasks_pb2.TaskTemplate - new_spec: _tasks_pb2.TaskTemplate - def __init__(self, id: _Optional[_Union[_identifier_pb2.Identifier, _Mapping]] = ..., old_spec: _Optional[_Union[_tasks_pb2.TaskTemplate, _Mapping]] = ..., new_spec: _Optional[_Union[_tasks_pb2.TaskTemplate, _Mapping]] = ...) -> None: ... + def __init__(self, id: _Optional[_Union[_identifier_pb2.Identifier, _Mapping]] = ...) -> None: ... class TaskErrorExistsIdenticalStructure(_message.Message): __slots__ = ["id"] diff --git a/flyteidl/gen/pb_rust/flyteidl.admin.rs b/flyteidl/gen/pb_rust/flyteidl.admin.rs index 1800c64394..402d0cbeae 100644 --- a/flyteidl/gen/pb_rust/flyteidl.admin.rs +++ b/flyteidl/gen/pb_rust/flyteidl.admin.rs @@ -2914,10 +2914,6 @@ pub struct TaskClosure { pub struct TaskErrorExistsDifferentStructure { #[prost(message, optional, tag="1")] pub id: ::core::option::Option, - #[prost(message, optional, tag="2")] - pub old_spec: ::core::option::Option, - #[prost(message, optional, tag="3")] - pub new_spec: ::core::option::Option, } /// The task id is already used with an identical sctructure #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/flyteidl/protos/flyteidl/admin/task.proto b/flyteidl/protos/flyteidl/admin/task.proto index 3badc32d0f..9740bd939f 100644 --- a/flyteidl/protos/flyteidl/admin/task.proto +++ b/flyteidl/protos/flyteidl/admin/task.proto @@ -73,8 +73,6 @@ message TaskClosure { // The task id is already used and the structure is different message TaskErrorExistsDifferentStructure { core.Identifier id = 1; - core.TaskTemplate old_spec = 2; - core.TaskTemplate new_spec = 3; } // The task id is already used with an identical sctructure diff --git a/go.mod b/go.mod index c303d976ae..5f00818fca 100644 --- a/go.mod +++ b/go.mod @@ -61,7 +61,7 @@ require ( github.com/eapache/queue v1.1.0 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect - github.com/evanphx/json-patch/v5 v5.6.0 // indirect + github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/fatih/color v1.13.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/flyteorg/flyte/flyteidl v0.0.0-00010101000000-000000000000 // indirect diff --git a/go.sum b/go.sum index e8d5ee8603..df8f6fa506 100644 --- a/go.sum +++ b/go.sum @@ -250,8 +250,8 @@ github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= -github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= +github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= +github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= From 2718106a635503c4a7c021d5bba4670f72cdf9be Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Sun, 25 Feb 2024 18:38:22 +0800 Subject: [PATCH 06/13] refactor to compiledWorkflow Signed-off-by: Austin Liu --- flyteadmin/pkg/manager/impl/task_manager.go | 5 +++-- flyteadmin/pkg/manager/impl/workflow_manager.go | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/flyteadmin/pkg/manager/impl/task_manager.go b/flyteadmin/pkg/manager/impl/task_manager.go index e0cb320480..907365287e 100644 --- a/flyteadmin/pkg/manager/impl/task_manager.go +++ b/flyteadmin/pkg/manager/impl/task_manager.go @@ -94,11 +94,12 @@ func (t *TaskManager) CreateTask( if bytes.Equal(taskDigest, existingTaskModel.Digest) { return nil, errors.NewTaskExistsIdenticalStructureError(ctx, &request) } - existingTask, err2 := util.GetTask(ctx, t.db, *request.Id) + + existingTask, err2 := transformers.FromTaskModel(*existingTaskModel) if err2 != nil { return nil, err2 } - return nil, errors.NewTaskExistsDifferentStructureError(ctx, &request, existingTask.Closure.CompiledTask.Template, compiledTask.Template) + return nil, errors.NewTaskExistsDifferentStructureError(ctx, &request, existingTask.Closure.GetCompiledTask(), compiledTask) } taskModel, err := transformers.CreateTaskModel(finalizedRequest, admin.TaskClosure{ CompiledTask: compiledTask, diff --git a/flyteadmin/pkg/manager/impl/workflow_manager.go b/flyteadmin/pkg/manager/impl/workflow_manager.go index 5516fb8d40..48a396ba51 100644 --- a/flyteadmin/pkg/manager/impl/workflow_manager.go +++ b/flyteadmin/pkg/manager/impl/workflow_manager.go @@ -168,12 +168,12 @@ func (w *WorkflowManager) CreateWorkflow( if bytes.Equal(workflowDigest, existingWorkflowModel.Digest) { return nil, errors.NewWorkflowExistsIdenticalStructureError(ctx, &request) } - existingWorkflow, err2 := util.GetWorkflow(ctx, w.db, w.storageClient, *request.Id) + existingWorkflow, err2 := transformers.FromWorkflowModel(existingWorkflowModel) if err2 != nil { return nil, err2 } // A workflow exists with different structure - return nil, errors.NewWorkflowExistsDifferentStructureError(ctx, &request, existingWorkflow.Closure.CompiledWorkflow.Tasks[0].Template, workflowClosure.CompiledWorkflow.Tasks[0].Template) + return nil, errors.NewWorkflowExistsDifferentStructureError(ctx, &request, existingWorkflow.Closure.GetCompiledWorkflow(), workflowClosure.GetCompiledWorkflow()) } else if flyteAdminError, ok := err.(errors.FlyteAdminError); !ok || flyteAdminError.Code() != codes.NotFound { logger.Debugf(ctx, "Failed to get workflow for comparison in CreateWorkflow with ID [%+v] with err %v", request.Id, err) From 39a8c39fbe19bffc1e9fe50a0076a772cf1a56b4 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Sun, 25 Feb 2024 18:39:26 +0800 Subject: [PATCH 07/13] clean up Signed-off-by: Austin Liu --- flyteadmin/pkg/errors/errors.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/flyteadmin/pkg/errors/errors.go b/flyteadmin/pkg/errors/errors.go index 73f8c260a9..bbe9546c94 100644 --- a/flyteadmin/pkg/errors/errors.go +++ b/flyteadmin/pkg/errors/errors.go @@ -120,16 +120,16 @@ func compareJsons(jsonArray1 jsondiff.Patch, jsonArray2 jsondiff.Patch) []string for _, obj := range jsonArray2 { if val, ok := map1[obj.Path]; ok { - result := fmt.Sprintf("%s: %s -> %s\t", obj.Path, obj.Value, val.Value) + result := fmt.Sprintf("%v: %v -> %v\t", obj.Path, obj.Value, val.Value) results = append(results, result) } } return results } -func NewTaskExistsDifferentStructureError(ctx context.Context, request *admin.TaskCreateRequest, oldSpec *core.TaskTemplate, newSpec *core.TaskTemplate) FlyteAdminError { +func NewTaskExistsDifferentStructureError(ctx context.Context, request *admin.TaskCreateRequest, oldSpec *core.CompiledTask, newSpec *core.CompiledTask) FlyteAdminError { errorMsg := "task with different structure already exists:\n" - // omit source code file object storage path + // omit file storage path changed message by ignoring `/args/2` differences computation diff, _ := jsondiff.Compare(oldSpec, newSpec, jsondiff.Ignores("/Target/Container/args/2")) rdiff, _ := jsondiff.Compare(newSpec, oldSpec, jsondiff.Ignores("/Target/Container/args/2")) rs := compareJsons(diff, rdiff) @@ -143,7 +143,7 @@ func NewTaskExistsDifferentStructureError(ctx context.Context, request *admin.Ta }, }) if transformationErr != nil { - logger.Panicf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) + logger.Errorf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) return NewFlyteAdminErrorf(codes.InvalidArgument, errorMsg) } return statusErr @@ -159,17 +159,17 @@ func NewTaskExistsIdenticalStructureError(ctx context.Context, request *admin.Ta }, }) if transformationErr != nil { - logger.Panicf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) + logger.Errorf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) return NewFlyteAdminErrorf(codes.AlreadyExists, errorMsg) } return statusErr } -func NewWorkflowExistsDifferentStructureError(ctx context.Context, request *admin.WorkflowCreateRequest, oldTemplate *core.TaskTemplate, newTemplate *core.TaskTemplate) FlyteAdminError { +func NewWorkflowExistsDifferentStructureError(ctx context.Context, request *admin.WorkflowCreateRequest, oldSpec *core.CompiledWorkflowClosure, newSpec *core.CompiledWorkflowClosure) FlyteAdminError { errorMsg := "workflow with different structure already exists:\n" - // omit source code file object storage path - diff, _ := jsondiff.Compare(oldTemplate, newTemplate, jsondiff.Ignores("/Target/Container/args/2")) - rdiff, _ := jsondiff.Compare(newTemplate, oldTemplate, jsondiff.Ignores("/Target/Container/args/2")) + // omit file storage path changed message by ignoring `/args/2` differences computation + diff, _ := jsondiff.Compare(oldSpec, newSpec, jsondiff.Ignores("/Target/Container/args/2")) + rdiff, _ := jsondiff.Compare(newSpec, oldSpec, jsondiff.Ignores("/Target/Container/args/2")) rs := compareJsons(diff, rdiff) errorMsg += strings.Join(rs, "\n") @@ -181,7 +181,7 @@ func NewWorkflowExistsDifferentStructureError(ctx context.Context, request *admi }, }) if transformationErr != nil { - logger.Panicf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) + logger.Errorf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) return NewFlyteAdminErrorf(codes.InvalidArgument, errorMsg) } return statusErr @@ -197,7 +197,7 @@ func NewWorkflowExistsIdenticalStructureError(ctx context.Context, request *admi }, }) if transformationErr != nil { - logger.Panicf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) + logger.Errorf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) return NewFlyteAdminErrorf(codes.AlreadyExists, errorMsg) } return statusErr From 73477066054bde64cd2596b632937bcef0c6cc28 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Sun, 25 Feb 2024 18:40:33 +0800 Subject: [PATCH 08/13] add create task errors test Signed-off-by: Austin Liu format Signed-off-by: Austin Liu --- flyteadmin/go.mod | 4 ++ flyteadmin/go.sum | 11 +++++ flyteadmin/pkg/errors/errors_test.go | 46 +++++++++++++++++++++ flyteadmin/pkg/manager/impl/task_manager.go | 1 - 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/flyteadmin/go.mod b/flyteadmin/go.mod index fd8aa4bc34..18f7b2eaf9 100644 --- a/flyteadmin/go.mod +++ b/flyteadmin/go.mod @@ -167,6 +167,10 @@ require ( github.com/spf13/viper v1.11.0 // indirect github.com/stretchr/objx v0.5.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect + github.com/tidwall/gjson v1.17.0 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/tidwall/sjson v1.2.5 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect diff --git a/flyteadmin/go.sum b/flyteadmin/go.sum index 0693371e59..6e6479957a 100644 --- a/flyteadmin/go.sum +++ b/flyteadmin/go.sum @@ -1265,13 +1265,22 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/tidwall/gjson v1.3.2/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= github.com/tidwall/gjson v1.6.8/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= github.com/tidwall/gjson v1.7.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= +github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM= +github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.0.4/go.mod h1:bURseu1nuBkFpIES5cz6zBtjmYeOQmEESshn7VpF15Y= github.com/tidwall/sjson v1.1.5/go.mod h1:VuJzsZnTowhSxWdOgsAnb886i4AjEyTkk7tNtsL7EYE= +github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= +github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= @@ -1288,6 +1297,8 @@ github.com/unrolled/secure v0.0.0-20181005190816-ff9db2ff917f/go.mod h1:mnPT77IA github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/wI2L/jsondiff v0.5.0 h1:RRMTi/mH+R2aXcPe1VYyvGINJqQfC3R+KSEakuU1Ikw= +github.com/wI2L/jsondiff v0.5.0/go.mod h1:qqG6hnK0Lsrz2BpIVCxWiK9ItsBCpIZQiv0izJjOZ9s= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= diff --git a/flyteadmin/pkg/errors/errors_test.go b/flyteadmin/pkg/errors/errors_test.go index cb6a2a0ae0..b65e7ae0e2 100644 --- a/flyteadmin/pkg/errors/errors_test.go +++ b/flyteadmin/pkg/errors/errors_test.go @@ -46,6 +46,52 @@ func TestNewIncompatibleClusterError(t *testing.T) { assert.True(t, ok) } +func TestNewTaskExistsDifferentStructureError(t *testing.T) { + t := &admin.TaskCreateRequest{ + Id: &core.Identifier{ + ResourceType: core.ResourceType_TASK, + Project: "testProj", + Domain: "domain", + Name: "name", + Version: "ver", + }, + } + statusErr := NewTaskExistsDifferentStructureError(context.Background(), t) + assert.NotNil(t, statusErr) + s, ok := status.FromError(statusErr) + assert.True(t, ok) + assert.Equal(t, codes.InvalidArgument, s.Code()) + assert.Equal(t, "task with different structure already exists", s.Message()) + + details, ok := s.Details()[0].(*admin.CreateTaskFailureReason) + assert.True(t, ok) + _, ok = details.GetReason().(*admin.CreateTaskFailureReason_ExistsDifferentStructure) + assert.True(t, ok) +} + +func TestNewTaskExistsIdenticalStructureError(t *testing.T) { + t := &admin.TaskCreateRequest{ + Id: &core.Identifier{ + ResourceType: core.ResourceType_TASK, + Project: "testProj", + Domain: "domain", + Name: "name", + Version: "ver", + }, + } + statusErr := NewTaskExistsIdenticalStructureError(context.Background(), t) + assert.NotNil(t, statusErr) + s, ok := status.FromError(statusErr) + assert.True(t, ok) + assert.Equal(t, codes.AlreadyExists, s.Code()) + assert.Equal(t, "task with identical structure already exists", s.Message()) + + details, ok := s.Details()[0].(*admin.CreateTaskFailureReason) + assert.True(t, ok) + _, ok = details.GetReason().(*admin.CreateTaskFailureReason_ExistsIdenticalStructure) + assert.True(t, ok) +} + func TestNewWorkflowExistsDifferentStructureError(t *testing.T) { wf := &admin.WorkflowCreateRequest{ Id: &core.Identifier{ diff --git a/flyteadmin/pkg/manager/impl/task_manager.go b/flyteadmin/pkg/manager/impl/task_manager.go index 907365287e..d6bd7c97fb 100644 --- a/flyteadmin/pkg/manager/impl/task_manager.go +++ b/flyteadmin/pkg/manager/impl/task_manager.go @@ -94,7 +94,6 @@ func (t *TaskManager) CreateTask( if bytes.Equal(taskDigest, existingTaskModel.Digest) { return nil, errors.NewTaskExistsIdenticalStructureError(ctx, &request) } - existingTask, err2 := transformers.FromTaskModel(*existingTaskModel) if err2 != nil { return nil, err2 From 38a83577e4111ebc63c2b3529fb8b70576616233 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Tue, 27 Feb 2024 19:39:40 +0800 Subject: [PATCH 09/13] cleanup error & test Signed-off-by: Austin Liu --- flyteadmin/pkg/errors/errors.go | 41 ++--- flyteadmin/pkg/errors/errors_test.go | 148 ++++++++++++------ .../pkg/manager/impl/workflow_manager_test.go | 4 +- 3 files changed, 116 insertions(+), 77 deletions(-) diff --git a/flyteadmin/pkg/errors/errors.go b/flyteadmin/pkg/errors/errors.go index bbe9546c94..8cb04bba71 100644 --- a/flyteadmin/pkg/errors/errors.go +++ b/flyteadmin/pkg/errors/errors.go @@ -120,7 +120,7 @@ func compareJsons(jsonArray1 jsondiff.Patch, jsonArray2 jsondiff.Patch) []string for _, obj := range jsonArray2 { if val, ok := map1[obj.Path]; ok { - result := fmt.Sprintf("%v: %v -> %v\t", obj.Path, obj.Value, val.Value) + result := fmt.Sprintf("\t\t- %v: %v -> %v", obj.Path, obj.Value, val.Value) results = append(results, result) } } @@ -129,48 +129,27 @@ func compareJsons(jsonArray1 jsondiff.Patch, jsonArray2 jsondiff.Patch) []string func NewTaskExistsDifferentStructureError(ctx context.Context, request *admin.TaskCreateRequest, oldSpec *core.CompiledTask, newSpec *core.CompiledTask) FlyteAdminError { errorMsg := "task with different structure already exists:\n" - // omit file storage path changed message by ignoring `/args/2` differences computation - diff, _ := jsondiff.Compare(oldSpec, newSpec, jsondiff.Ignores("/Target/Container/args/2")) - rdiff, _ := jsondiff.Compare(newSpec, oldSpec, jsondiff.Ignores("/Target/Container/args/2")) + diff, _ := jsondiff.Compare(oldSpec, newSpec) + rdiff, _ := jsondiff.Compare(newSpec, oldSpec) rs := compareJsons(diff, rdiff) + errorMsg += strings.Join(rs, "\n") - statusErr, transformationErr := NewFlyteAdminError(codes.InvalidArgument, errorMsg).WithDetails(&admin.CreateTaskFailureReason{ - Reason: &admin.CreateTaskFailureReason_ExistsDifferentStructure{ - ExistsDifferentStructure: &admin.TaskErrorExistsDifferentStructure{ - Id: request.Id, - }, - }, - }) - if transformationErr != nil { - logger.Errorf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) - return NewFlyteAdminErrorf(codes.InvalidArgument, errorMsg) - } - return statusErr + return NewFlyteAdminErrorf(codes.InvalidArgument, errorMsg) + } func NewTaskExistsIdenticalStructureError(ctx context.Context, request *admin.TaskCreateRequest) FlyteAdminError { errorMsg := "task with identical structure already exists" - statusErr, transformationErr := NewFlyteAdminError(codes.AlreadyExists, errorMsg).WithDetails(&admin.CreateTaskFailureReason{ - Reason: &admin.CreateTaskFailureReason_ExistsIdenticalStructure{ - ExistsIdenticalStructure: &admin.TaskErrorExistsIdenticalStructure{ - Id: request.Id, - }, - }, - }) - if transformationErr != nil { - logger.Errorf(ctx, "Failed to wrap grpc status in type 'Error': %v", transformationErr) - return NewFlyteAdminErrorf(codes.AlreadyExists, errorMsg) - } - return statusErr + return NewFlyteAdminErrorf(codes.AlreadyExists, errorMsg) } func NewWorkflowExistsDifferentStructureError(ctx context.Context, request *admin.WorkflowCreateRequest, oldSpec *core.CompiledWorkflowClosure, newSpec *core.CompiledWorkflowClosure) FlyteAdminError { errorMsg := "workflow with different structure already exists:\n" - // omit file storage path changed message by ignoring `/args/2` differences computation - diff, _ := jsondiff.Compare(oldSpec, newSpec, jsondiff.Ignores("/Target/Container/args/2")) - rdiff, _ := jsondiff.Compare(newSpec, oldSpec, jsondiff.Ignores("/Target/Container/args/2")) + diff, _ := jsondiff.Compare(oldSpec, newSpec) + rdiff, _ := jsondiff.Compare(newSpec, oldSpec) rs := compareJsons(diff, rdiff) + errorMsg += strings.Join(rs, "\n") statusErr, transformationErr := NewFlyteAdminError(codes.InvalidArgument, errorMsg).WithDetails(&admin.CreateWorkflowFailureReason{ diff --git a/flyteadmin/pkg/errors/errors_test.go b/flyteadmin/pkg/errors/errors_test.go index b65e7ae0e2..4391b6f955 100644 --- a/flyteadmin/pkg/errors/errors_test.go +++ b/flyteadmin/pkg/errors/errors_test.go @@ -13,6 +13,14 @@ import ( "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" ) +var identifier = core.Identifier{ + ResourceType: core.ResourceType_TASK, + Project: "testProj", + Domain: "domain", + Name: "name", + Version: "ver", +} + func TestGrpcStatusError(t *testing.T) { msg := "some error" @@ -47,67 +55,125 @@ func TestNewIncompatibleClusterError(t *testing.T) { } func TestNewTaskExistsDifferentStructureError(t *testing.T) { - t := &admin.TaskCreateRequest{ - Id: &core.Identifier{ - ResourceType: core.ResourceType_TASK, - Project: "testProj", - Domain: "domain", - Name: "name", - Version: "ver", + req := &admin.TaskCreateRequest{ + Id: &identifier, + } + + oldTask := &core.CompiledTask{ + Template: &core.TaskTemplate{ + Target: &core.TaskTemplate_Container{ + Container: &core.Container{ + Resources: &core.Resources{ + Requests: []*core.Resources_ResourceEntry{ + { + Name: core.Resources_CPU, + Value: "150m", + }, + }, + }, + }, + }, + Id: &identifier, + }, + } + + newTask := &core.CompiledTask{ + Template: &core.TaskTemplate{ + Target: &core.TaskTemplate_Container{ + Container: &core.Container{ + Resources: &core.Resources{ + Requests: []*core.Resources_ResourceEntry{ + { + Name: core.Resources_CPU, + Value: "250m", + }, + }, + }, + }, + }, + Id: &identifier, }, } - statusErr := NewTaskExistsDifferentStructureError(context.Background(), t) + + statusErr := NewTaskExistsDifferentStructureError(context.Background(), req, oldTask, newTask) assert.NotNil(t, statusErr) s, ok := status.FromError(statusErr) assert.True(t, ok) assert.Equal(t, codes.InvalidArgument, s.Code()) - assert.Equal(t, "task with different structure already exists", s.Message()) - - details, ok := s.Details()[0].(*admin.CreateTaskFailureReason) - assert.True(t, ok) - _, ok = details.GetReason().(*admin.CreateTaskFailureReason_ExistsDifferentStructure) - assert.True(t, ok) + assert.Equal(t, "task with different structure already exists:\n\t\t- /template/Target/Container/resources/requests/0/value: 150m -> 250m", s.Message()) } func TestNewTaskExistsIdenticalStructureError(t *testing.T) { - t := &admin.TaskCreateRequest{ - Id: &core.Identifier{ - ResourceType: core.ResourceType_TASK, - Project: "testProj", - Domain: "domain", - Name: "name", - Version: "ver", - }, + req := &admin.TaskCreateRequest{ + Id: &identifier, } - statusErr := NewTaskExistsIdenticalStructureError(context.Background(), t) + statusErr := NewTaskExistsIdenticalStructureError(context.Background(), req) assert.NotNil(t, statusErr) s, ok := status.FromError(statusErr) assert.True(t, ok) assert.Equal(t, codes.AlreadyExists, s.Code()) assert.Equal(t, "task with identical structure already exists", s.Message()) - - details, ok := s.Details()[0].(*admin.CreateTaskFailureReason) - assert.True(t, ok) - _, ok = details.GetReason().(*admin.CreateTaskFailureReason_ExistsIdenticalStructure) - assert.True(t, ok) } func TestNewWorkflowExistsDifferentStructureError(t *testing.T) { - wf := &admin.WorkflowCreateRequest{ - Id: &core.Identifier{ - ResourceType: core.ResourceType_WORKFLOW, - Project: "testProj", - Domain: "domain", - Name: "name", - Version: "ver", + req := &admin.WorkflowCreateRequest{ + Id: &identifier, + } + + oldWorkflow := &core.CompiledWorkflowClosure{ + Primary: &core.CompiledWorkflow{ + Connections: &core.ConnectionSet{ + Upstream: map[string]*core.ConnectionSet_IdList{ + "foo": &core.ConnectionSet_IdList{ + Ids: []string{"start-node"}, + }, + "end-node": &core.ConnectionSet_IdList{ + Ids: []string{"foo"}, + }, + }, + }, + Template: &core.WorkflowTemplate{ + Nodes: []*core.Node{ + &core.Node{ + Id: "foo", + Target: &core.Node_TaskNode{}, + }, + }, + Id: &identifier, + }, }, } - statusErr := NewWorkflowExistsDifferentStructureError(context.Background(), wf) + + newWorkflow := &core.CompiledWorkflowClosure{ + Primary: &core.CompiledWorkflow{ + Connections: &core.ConnectionSet{ + Upstream: map[string]*core.ConnectionSet_IdList{ + "bar": &core.ConnectionSet_IdList{ + Ids: []string{"start-node"}, + }, + "end-node": &core.ConnectionSet_IdList{ + Ids: []string{"bar"}, + }, + }, + }, + Template: &core.WorkflowTemplate{ + Nodes: []*core.Node{ + &core.Node{ + Id: "bar", + Target: &core.Node_TaskNode{}, + }, + }, + Id: &identifier, + }, + }, + } + + statusErr := NewWorkflowExistsDifferentStructureError(context.Background(), req, oldWorkflow, newWorkflow) assert.NotNil(t, statusErr) s, ok := status.FromError(statusErr) assert.True(t, ok) assert.Equal(t, codes.InvalidArgument, s.Code()) - assert.Equal(t, "workflow with different structure already exists", s.Message()) + assert.Equal(t, "workflow with different structure already exists:\n\t\t- /primary/connections/upstream/bar: -> map[ids:[start-node]]\n\t\t- /primary/connections/upstream/end-node/ids/0: foo -> bar\n\t\t- /primary/connections/upstream/foo: map[ids:[start-node]] -> \n\t\t- /primary/template/nodes/0/id: foo -> bar", s.Message()) details, ok := s.Details()[0].(*admin.CreateWorkflowFailureReason) assert.True(t, ok) @@ -117,13 +183,7 @@ func TestNewWorkflowExistsDifferentStructureError(t *testing.T) { func TestNewWorkflowExistsIdenticalStructureError(t *testing.T) { wf := &admin.WorkflowCreateRequest{ - Id: &core.Identifier{ - ResourceType: core.ResourceType_WORKFLOW, - Project: "testProj", - Domain: "domain", - Name: "name", - Version: "ver", - }, + Id: &identifier, } statusErr := NewWorkflowExistsIdenticalStructureError(context.Background(), wf) assert.NotNil(t, statusErr) diff --git a/flyteadmin/pkg/manager/impl/workflow_manager_test.go b/flyteadmin/pkg/manager/impl/workflow_manager_test.go index b5565f8cda..3c286a2430 100644 --- a/flyteadmin/pkg/manager/impl/workflow_manager_test.go +++ b/flyteadmin/pkg/manager/impl/workflow_manager_test.go @@ -187,7 +187,7 @@ func TestCreateWorkflow_ExistingWorkflow(t *testing.T) { getMockWorkflowConfigProvider(), getMockWorkflowCompiler(), mockStorageClient, storagePrefix, mockScope.NewTestScope()) request := testutils.GetWorkflowRequest() response, err := workflowManager.CreateWorkflow(context.Background(), request) - assert.EqualError(t, err, "workflow with different structure already exists") + assert.EqualError(t, err, "workflow with different structure already exists:\n\t\t- /primary/template/id: -> map[domain:domain name:name project:project resource_type:2 version:version]\n\t\t- /primary/template/interface/inputs: -> map[variables:map[foo:map[type:map[Type:map[Simple:3]]]]]\n\t\t- /primary/template/interface/outputs: -> map[variables:map[bar:map[type:map[Type:map[Simple:3]]]]]\n\t\t- /primary/template/nodes: -> [map[Target: id:node 1] map[Target: id:node 2]]") assert.Nil(t, response) } @@ -205,7 +205,7 @@ func TestCreateWorkflow_ExistingWorkflow_Different(t *testing.T) { request := testutils.GetWorkflowRequest() response, err := workflowManager.CreateWorkflow(context.Background(), request) - assert.EqualError(t, err, "workflow with different structure already exists") + assert.EqualError(t, err, "workflow with different structure already exists:\n\t\t- /primary/template/id: -> map[domain:domain name:name project:project resource_type:2 version:version]\n\t\t- /primary/template/interface/inputs: -> map[variables:map[foo:map[type:map[Type:map[Simple:3]]]]]\n\t\t- /primary/template/interface/outputs: -> map[variables:map[bar:map[type:map[Type:map[Simple:3]]]]]\n\t\t- /primary/template/nodes: -> [map[Target: id:node 1] map[Target: id:node 2]]") flyteErr := err.(flyteErrors.FlyteAdminError) assert.Equal(t, codes.InvalidArgument, flyteErr.Code()) assert.Nil(t, response) From 1663a7b02641177294640a859091f528cecdc313 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Tue, 27 Feb 2024 19:40:01 +0800 Subject: [PATCH 10/13] rollback proto change Signed-off-by: Austin Liu rollback proto change Signed-off-by: Austin Liu --- flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts | 130 ------ flyteidl/gen/pb-go/flyteidl/admin/task.pb.go | 324 ++------------- flyteidl/gen/pb-js/flyteidl.d.ts | 165 -------- flyteidl/gen/pb-js/flyteidl.js | 378 ------------------ .../gen/pb_python/flyteidl/admin/task_pb2.py | 8 +- .../gen/pb_python/flyteidl/admin/task_pb2.pyi | 20 - flyteidl/gen/pb_rust/flyteidl.admin.rs | 32 -- flyteidl/protos/flyteidl/admin/task.proto | 18 - 8 files changed, 37 insertions(+), 1038 deletions(-) diff --git a/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts b/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts index d8cfcb2dc6..f4b22f068f 100644 --- a/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts +++ b/flyteidl/gen/pb-es/flyteidl/admin/task_pb.ts @@ -306,133 +306,3 @@ export class TaskClosure extends Message { } } -/** - * The task id is already used and the structure is different - * - * @generated from message flyteidl.admin.TaskErrorExistsDifferentStructure - */ -export class TaskErrorExistsDifferentStructure extends Message { - /** - * @generated from field: flyteidl.core.Identifier id = 1; - */ - id?: Identifier; - - constructor(data?: PartialMessage) { - super(); - proto3.util.initPartial(data, this); - } - - static readonly runtime: typeof proto3 = proto3; - static readonly typeName = "flyteidl.admin.TaskErrorExistsDifferentStructure"; - static readonly fields: FieldList = proto3.util.newFieldList(() => [ - { no: 1, name: "id", kind: "message", T: Identifier }, - ]); - - static fromBinary(bytes: Uint8Array, options?: Partial): TaskErrorExistsDifferentStructure { - return new TaskErrorExistsDifferentStructure().fromBinary(bytes, options); - } - - static fromJson(jsonValue: JsonValue, options?: Partial): TaskErrorExistsDifferentStructure { - return new TaskErrorExistsDifferentStructure().fromJson(jsonValue, options); - } - - static fromJsonString(jsonString: string, options?: Partial): TaskErrorExistsDifferentStructure { - return new TaskErrorExistsDifferentStructure().fromJsonString(jsonString, options); - } - - static equals(a: TaskErrorExistsDifferentStructure | PlainMessage | undefined, b: TaskErrorExistsDifferentStructure | PlainMessage | undefined): boolean { - return proto3.util.equals(TaskErrorExistsDifferentStructure, a, b); - } -} - -/** - * The task id is already used with an identical sctructure - * - * @generated from message flyteidl.admin.TaskErrorExistsIdenticalStructure - */ -export class TaskErrorExistsIdenticalStructure extends Message { - /** - * @generated from field: flyteidl.core.Identifier id = 1; - */ - id?: Identifier; - - constructor(data?: PartialMessage) { - super(); - proto3.util.initPartial(data, this); - } - - static readonly runtime: typeof proto3 = proto3; - static readonly typeName = "flyteidl.admin.TaskErrorExistsIdenticalStructure"; - static readonly fields: FieldList = proto3.util.newFieldList(() => [ - { no: 1, name: "id", kind: "message", T: Identifier }, - ]); - - static fromBinary(bytes: Uint8Array, options?: Partial): TaskErrorExistsIdenticalStructure { - return new TaskErrorExistsIdenticalStructure().fromBinary(bytes, options); - } - - static fromJson(jsonValue: JsonValue, options?: Partial): TaskErrorExistsIdenticalStructure { - return new TaskErrorExistsIdenticalStructure().fromJson(jsonValue, options); - } - - static fromJsonString(jsonString: string, options?: Partial): TaskErrorExistsIdenticalStructure { - return new TaskErrorExistsIdenticalStructure().fromJsonString(jsonString, options); - } - - static equals(a: TaskErrorExistsIdenticalStructure | PlainMessage | undefined, b: TaskErrorExistsIdenticalStructure | PlainMessage | undefined): boolean { - return proto3.util.equals(TaskErrorExistsIdenticalStructure, a, b); - } -} - -/** - * When a CreateTaskRequest fails due to matching id - * - * @generated from message flyteidl.admin.CreateTaskFailureReason - */ -export class CreateTaskFailureReason extends Message { - /** - * @generated from oneof flyteidl.admin.CreateTaskFailureReason.reason - */ - reason: { - /** - * @generated from field: flyteidl.admin.TaskErrorExistsDifferentStructure exists_different_structure = 1; - */ - value: TaskErrorExistsDifferentStructure; - case: "existsDifferentStructure"; - } | { - /** - * @generated from field: flyteidl.admin.TaskErrorExistsIdenticalStructure exists_identical_structure = 2; - */ - value: TaskErrorExistsIdenticalStructure; - case: "existsIdenticalStructure"; - } | { case: undefined; value?: undefined } = { case: undefined }; - - constructor(data?: PartialMessage) { - super(); - proto3.util.initPartial(data, this); - } - - static readonly runtime: typeof proto3 = proto3; - static readonly typeName = "flyteidl.admin.CreateTaskFailureReason"; - static readonly fields: FieldList = proto3.util.newFieldList(() => [ - { no: 1, name: "exists_different_structure", kind: "message", T: TaskErrorExistsDifferentStructure, oneof: "reason" }, - { no: 2, name: "exists_identical_structure", kind: "message", T: TaskErrorExistsIdenticalStructure, oneof: "reason" }, - ]); - - static fromBinary(bytes: Uint8Array, options?: Partial): CreateTaskFailureReason { - return new CreateTaskFailureReason().fromBinary(bytes, options); - } - - static fromJson(jsonValue: JsonValue, options?: Partial): CreateTaskFailureReason { - return new CreateTaskFailureReason().fromJson(jsonValue, options); - } - - static fromJsonString(jsonString: string, options?: Partial): CreateTaskFailureReason { - return new CreateTaskFailureReason().fromJsonString(jsonString, options); - } - - static equals(a: CreateTaskFailureReason | PlainMessage | undefined, b: CreateTaskFailureReason | PlainMessage | undefined): boolean { - return proto3.util.equals(CreateTaskFailureReason, a, b); - } -} - diff --git a/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go b/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go index 60282fa7e6..e2f74db35d 100644 --- a/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go +++ b/flyteidl/gen/pb-go/flyteidl/admin/task.pb.go @@ -368,184 +368,6 @@ func (x *TaskClosure) GetCreatedAt() *timestamppb.Timestamp { return nil } -// The task id is already used and the structure is different -type TaskErrorExistsDifferentStructure struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id *core.Identifier `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *TaskErrorExistsDifferentStructure) Reset() { - *x = TaskErrorExistsDifferentStructure{} - if protoimpl.UnsafeEnabled { - mi := &file_flyteidl_admin_task_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TaskErrorExistsDifferentStructure) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TaskErrorExistsDifferentStructure) ProtoMessage() {} - -func (x *TaskErrorExistsDifferentStructure) ProtoReflect() protoreflect.Message { - mi := &file_flyteidl_admin_task_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TaskErrorExistsDifferentStructure.ProtoReflect.Descriptor instead. -func (*TaskErrorExistsDifferentStructure) Descriptor() ([]byte, []int) { - return file_flyteidl_admin_task_proto_rawDescGZIP(), []int{6} -} - -func (x *TaskErrorExistsDifferentStructure) GetId() *core.Identifier { - if x != nil { - return x.Id - } - return nil -} - -// The task id is already used with an identical sctructure -type TaskErrorExistsIdenticalStructure struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id *core.Identifier `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *TaskErrorExistsIdenticalStructure) Reset() { - *x = TaskErrorExistsIdenticalStructure{} - if protoimpl.UnsafeEnabled { - mi := &file_flyteidl_admin_task_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TaskErrorExistsIdenticalStructure) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TaskErrorExistsIdenticalStructure) ProtoMessage() {} - -func (x *TaskErrorExistsIdenticalStructure) ProtoReflect() protoreflect.Message { - mi := &file_flyteidl_admin_task_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TaskErrorExistsIdenticalStructure.ProtoReflect.Descriptor instead. -func (*TaskErrorExistsIdenticalStructure) Descriptor() ([]byte, []int) { - return file_flyteidl_admin_task_proto_rawDescGZIP(), []int{7} -} - -func (x *TaskErrorExistsIdenticalStructure) GetId() *core.Identifier { - if x != nil { - return x.Id - } - return nil -} - -// When a CreateTaskRequest fails due to matching id -type CreateTaskFailureReason struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Reason: - // - // *CreateTaskFailureReason_ExistsDifferentStructure - // *CreateTaskFailureReason_ExistsIdenticalStructure - Reason isCreateTaskFailureReason_Reason `protobuf_oneof:"reason"` -} - -func (x *CreateTaskFailureReason) Reset() { - *x = CreateTaskFailureReason{} - if protoimpl.UnsafeEnabled { - mi := &file_flyteidl_admin_task_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateTaskFailureReason) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateTaskFailureReason) ProtoMessage() {} - -func (x *CreateTaskFailureReason) ProtoReflect() protoreflect.Message { - mi := &file_flyteidl_admin_task_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateTaskFailureReason.ProtoReflect.Descriptor instead. -func (*CreateTaskFailureReason) Descriptor() ([]byte, []int) { - return file_flyteidl_admin_task_proto_rawDescGZIP(), []int{8} -} - -func (m *CreateTaskFailureReason) GetReason() isCreateTaskFailureReason_Reason { - if m != nil { - return m.Reason - } - return nil -} - -func (x *CreateTaskFailureReason) GetExistsDifferentStructure() *TaskErrorExistsDifferentStructure { - if x, ok := x.GetReason().(*CreateTaskFailureReason_ExistsDifferentStructure); ok { - return x.ExistsDifferentStructure - } - return nil -} - -func (x *CreateTaskFailureReason) GetExistsIdenticalStructure() *TaskErrorExistsIdenticalStructure { - if x, ok := x.GetReason().(*CreateTaskFailureReason_ExistsIdenticalStructure); ok { - return x.ExistsIdenticalStructure - } - return nil -} - -type isCreateTaskFailureReason_Reason interface { - isCreateTaskFailureReason_Reason() -} - -type CreateTaskFailureReason_ExistsDifferentStructure struct { - ExistsDifferentStructure *TaskErrorExistsDifferentStructure `protobuf:"bytes,1,opt,name=exists_different_structure,json=existsDifferentStructure,proto3,oneof"` -} - -type CreateTaskFailureReason_ExistsIdenticalStructure struct { - ExistsIdenticalStructure *TaskErrorExistsIdenticalStructure `protobuf:"bytes,2,opt,name=exists_identical_structure,json=existsIdenticalStructure,proto3,oneof"` -} - -func (*CreateTaskFailureReason_ExistsDifferentStructure) isCreateTaskFailureReason_Reason() {} - -func (*CreateTaskFailureReason_ExistsIdenticalStructure) isCreateTaskFailureReason_Reason() {} - var File_flyteidl_admin_task_proto protoreflect.FileDescriptor var file_flyteidl_admin_task_proto_rawDesc = []byte{ @@ -602,45 +424,18 @@ var file_flyteidl_admin_task_proto_rawDesc = []byte{ 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x22, 0x4e, 0x0a, 0x21, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, 0x69, - 0x73, 0x74, 0x73, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, 0x64, - 0x22, 0x4e, 0x0a, 0x21, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, 0x69, - 0x73, 0x74, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, 0x64, - 0x22, 0x89, 0x02, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x46, - 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x71, 0x0a, 0x1a, - 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, - 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x31, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, 0x69, - 0x6e, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, 0x69, 0x73, 0x74, - 0x73, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x18, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x44, 0x69, 0x66, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, - 0x71, 0x0a, 0x1a, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, - 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, - 0x69, 0x73, 0x74, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x18, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, - 0x72, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0xb5, 0x01, 0x0a, - 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, - 0x6d, 0x69, 0x6e, 0x42, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6c, 0x79, - 0x74, 0x65, 0x6f, 0x72, 0x67, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x2f, 0x66, 0x6c, 0x79, 0x74, - 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x62, 0x2d, 0x67, 0x6f, 0x2f, 0x66, - 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0xa2, 0x02, 0x03, - 0x46, 0x41, 0x58, 0xaa, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x41, - 0x64, 0x6d, 0x69, 0x6e, 0xca, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x5c, - 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xe2, 0x02, 0x1a, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, - 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x0f, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x3a, 0x3a, 0x41, - 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0xb5, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, + 0x6c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x42, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x6f, 0x72, 0x67, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x2f, + 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x62, 0x2d, + 0x67, 0x6f, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x61, 0x64, 0x6d, 0x69, + 0x6e, 0xa2, 0x02, 0x03, 0x46, 0x41, 0x58, 0xaa, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, + 0x64, 0x6c, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xca, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, + 0x69, 0x64, 0x6c, 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xe2, 0x02, 0x1a, 0x46, 0x6c, 0x79, 0x74, + 0x65, 0x69, 0x64, 0x6c, 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, + 0x6c, 0x3a, 0x3a, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -655,42 +450,35 @@ func file_flyteidl_admin_task_proto_rawDescGZIP() []byte { return file_flyteidl_admin_task_proto_rawDescData } -var file_flyteidl_admin_task_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_flyteidl_admin_task_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_flyteidl_admin_task_proto_goTypes = []interface{}{ - (*TaskCreateRequest)(nil), // 0: flyteidl.admin.TaskCreateRequest - (*TaskCreateResponse)(nil), // 1: flyteidl.admin.TaskCreateResponse - (*Task)(nil), // 2: flyteidl.admin.Task - (*TaskList)(nil), // 3: flyteidl.admin.TaskList - (*TaskSpec)(nil), // 4: flyteidl.admin.TaskSpec - (*TaskClosure)(nil), // 5: flyteidl.admin.TaskClosure - (*TaskErrorExistsDifferentStructure)(nil), // 6: flyteidl.admin.TaskErrorExistsDifferentStructure - (*TaskErrorExistsIdenticalStructure)(nil), // 7: flyteidl.admin.TaskErrorExistsIdenticalStructure - (*CreateTaskFailureReason)(nil), // 8: flyteidl.admin.CreateTaskFailureReason - (*core.Identifier)(nil), // 9: flyteidl.core.Identifier - (*core.TaskTemplate)(nil), // 10: flyteidl.core.TaskTemplate - (*DescriptionEntity)(nil), // 11: flyteidl.admin.DescriptionEntity - (*core.CompiledTask)(nil), // 12: flyteidl.core.CompiledTask - (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp + (*TaskCreateRequest)(nil), // 0: flyteidl.admin.TaskCreateRequest + (*TaskCreateResponse)(nil), // 1: flyteidl.admin.TaskCreateResponse + (*Task)(nil), // 2: flyteidl.admin.Task + (*TaskList)(nil), // 3: flyteidl.admin.TaskList + (*TaskSpec)(nil), // 4: flyteidl.admin.TaskSpec + (*TaskClosure)(nil), // 5: flyteidl.admin.TaskClosure + (*core.Identifier)(nil), // 6: flyteidl.core.Identifier + (*core.TaskTemplate)(nil), // 7: flyteidl.core.TaskTemplate + (*DescriptionEntity)(nil), // 8: flyteidl.admin.DescriptionEntity + (*core.CompiledTask)(nil), // 9: flyteidl.core.CompiledTask + (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp } var file_flyteidl_admin_task_proto_depIdxs = []int32{ - 9, // 0: flyteidl.admin.TaskCreateRequest.id:type_name -> flyteidl.core.Identifier + 6, // 0: flyteidl.admin.TaskCreateRequest.id:type_name -> flyteidl.core.Identifier 4, // 1: flyteidl.admin.TaskCreateRequest.spec:type_name -> flyteidl.admin.TaskSpec - 9, // 2: flyteidl.admin.Task.id:type_name -> flyteidl.core.Identifier + 6, // 2: flyteidl.admin.Task.id:type_name -> flyteidl.core.Identifier 5, // 3: flyteidl.admin.Task.closure:type_name -> flyteidl.admin.TaskClosure 2, // 4: flyteidl.admin.TaskList.tasks:type_name -> flyteidl.admin.Task - 10, // 5: flyteidl.admin.TaskSpec.template:type_name -> flyteidl.core.TaskTemplate - 11, // 6: flyteidl.admin.TaskSpec.description:type_name -> flyteidl.admin.DescriptionEntity - 12, // 7: flyteidl.admin.TaskClosure.compiled_task:type_name -> flyteidl.core.CompiledTask - 13, // 8: flyteidl.admin.TaskClosure.created_at:type_name -> google.protobuf.Timestamp - 9, // 9: flyteidl.admin.TaskErrorExistsDifferentStructure.id:type_name -> flyteidl.core.Identifier - 9, // 10: flyteidl.admin.TaskErrorExistsIdenticalStructure.id:type_name -> flyteidl.core.Identifier - 6, // 11: flyteidl.admin.CreateTaskFailureReason.exists_different_structure:type_name -> flyteidl.admin.TaskErrorExistsDifferentStructure - 7, // 12: flyteidl.admin.CreateTaskFailureReason.exists_identical_structure:type_name -> flyteidl.admin.TaskErrorExistsIdenticalStructure - 13, // [13:13] is the sub-list for method output_type - 13, // [13:13] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name + 7, // 5: flyteidl.admin.TaskSpec.template:type_name -> flyteidl.core.TaskTemplate + 8, // 6: flyteidl.admin.TaskSpec.description:type_name -> flyteidl.admin.DescriptionEntity + 9, // 7: flyteidl.admin.TaskClosure.compiled_task:type_name -> flyteidl.core.CompiledTask + 10, // 8: flyteidl.admin.TaskClosure.created_at:type_name -> google.protobuf.Timestamp + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_flyteidl_admin_task_proto_init() } @@ -772,46 +560,6 @@ func file_flyteidl_admin_task_proto_init() { return nil } } - file_flyteidl_admin_task_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TaskErrorExistsDifferentStructure); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_flyteidl_admin_task_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TaskErrorExistsIdenticalStructure); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_flyteidl_admin_task_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateTaskFailureReason); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_flyteidl_admin_task_proto_msgTypes[8].OneofWrappers = []interface{}{ - (*CreateTaskFailureReason_ExistsDifferentStructure)(nil), - (*CreateTaskFailureReason_ExistsIdenticalStructure)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -819,7 +567,7 @@ func file_flyteidl_admin_task_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_flyteidl_admin_task_proto_rawDesc, NumEnums: 0, - NumMessages: 9, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/flyteidl/gen/pb-js/flyteidl.d.ts b/flyteidl/gen/pb-js/flyteidl.d.ts index e58d9c9872..60556e3b43 100644 --- a/flyteidl/gen/pb-js/flyteidl.d.ts +++ b/flyteidl/gen/pb-js/flyteidl.d.ts @@ -19372,171 +19372,6 @@ export namespace flyteidl { public static verify(message: { [k: string]: any }): (string|null); } - /** Properties of a TaskErrorExistsDifferentStructure. */ - interface ITaskErrorExistsDifferentStructure { - - /** TaskErrorExistsDifferentStructure id */ - id?: (flyteidl.core.IIdentifier|null); - } - - /** Represents a TaskErrorExistsDifferentStructure. */ - class TaskErrorExistsDifferentStructure implements ITaskErrorExistsDifferentStructure { - - /** - * Constructs a new TaskErrorExistsDifferentStructure. - * @param [properties] Properties to set - */ - constructor(properties?: flyteidl.admin.ITaskErrorExistsDifferentStructure); - - /** TaskErrorExistsDifferentStructure id. */ - public id?: (flyteidl.core.IIdentifier|null); - - /** - * Creates a new TaskErrorExistsDifferentStructure instance using the specified properties. - * @param [properties] Properties to set - * @returns TaskErrorExistsDifferentStructure instance - */ - public static create(properties?: flyteidl.admin.ITaskErrorExistsDifferentStructure): flyteidl.admin.TaskErrorExistsDifferentStructure; - - /** - * Encodes the specified TaskErrorExistsDifferentStructure message. Does not implicitly {@link flyteidl.admin.TaskErrorExistsDifferentStructure.verify|verify} messages. - * @param message TaskErrorExistsDifferentStructure message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: flyteidl.admin.ITaskErrorExistsDifferentStructure, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TaskErrorExistsDifferentStructure message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TaskErrorExistsDifferentStructure - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): flyteidl.admin.TaskErrorExistsDifferentStructure; - - /** - * Verifies a TaskErrorExistsDifferentStructure message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - } - - /** Properties of a TaskErrorExistsIdenticalStructure. */ - interface ITaskErrorExistsIdenticalStructure { - - /** TaskErrorExistsIdenticalStructure id */ - id?: (flyteidl.core.IIdentifier|null); - } - - /** Represents a TaskErrorExistsIdenticalStructure. */ - class TaskErrorExistsIdenticalStructure implements ITaskErrorExistsIdenticalStructure { - - /** - * Constructs a new TaskErrorExistsIdenticalStructure. - * @param [properties] Properties to set - */ - constructor(properties?: flyteidl.admin.ITaskErrorExistsIdenticalStructure); - - /** TaskErrorExistsIdenticalStructure id. */ - public id?: (flyteidl.core.IIdentifier|null); - - /** - * Creates a new TaskErrorExistsIdenticalStructure instance using the specified properties. - * @param [properties] Properties to set - * @returns TaskErrorExistsIdenticalStructure instance - */ - public static create(properties?: flyteidl.admin.ITaskErrorExistsIdenticalStructure): flyteidl.admin.TaskErrorExistsIdenticalStructure; - - /** - * Encodes the specified TaskErrorExistsIdenticalStructure message. Does not implicitly {@link flyteidl.admin.TaskErrorExistsIdenticalStructure.verify|verify} messages. - * @param message TaskErrorExistsIdenticalStructure message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: flyteidl.admin.ITaskErrorExistsIdenticalStructure, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TaskErrorExistsIdenticalStructure message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TaskErrorExistsIdenticalStructure - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): flyteidl.admin.TaskErrorExistsIdenticalStructure; - - /** - * Verifies a TaskErrorExistsIdenticalStructure message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - } - - /** Properties of a CreateTaskFailureReason. */ - interface ICreateTaskFailureReason { - - /** CreateTaskFailureReason existsDifferentStructure */ - existsDifferentStructure?: (flyteidl.admin.ITaskErrorExistsDifferentStructure|null); - - /** CreateTaskFailureReason existsIdenticalStructure */ - existsIdenticalStructure?: (flyteidl.admin.ITaskErrorExistsIdenticalStructure|null); - } - - /** Represents a CreateTaskFailureReason. */ - class CreateTaskFailureReason implements ICreateTaskFailureReason { - - /** - * Constructs a new CreateTaskFailureReason. - * @param [properties] Properties to set - */ - constructor(properties?: flyteidl.admin.ICreateTaskFailureReason); - - /** CreateTaskFailureReason existsDifferentStructure. */ - public existsDifferentStructure?: (flyteidl.admin.ITaskErrorExistsDifferentStructure|null); - - /** CreateTaskFailureReason existsIdenticalStructure. */ - public existsIdenticalStructure?: (flyteidl.admin.ITaskErrorExistsIdenticalStructure|null); - - /** CreateTaskFailureReason reason. */ - public reason?: ("existsDifferentStructure"|"existsIdenticalStructure"); - - /** - * Creates a new CreateTaskFailureReason instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateTaskFailureReason instance - */ - public static create(properties?: flyteidl.admin.ICreateTaskFailureReason): flyteidl.admin.CreateTaskFailureReason; - - /** - * Encodes the specified CreateTaskFailureReason message. Does not implicitly {@link flyteidl.admin.CreateTaskFailureReason.verify|verify} messages. - * @param message CreateTaskFailureReason message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: flyteidl.admin.ICreateTaskFailureReason, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateTaskFailureReason message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateTaskFailureReason - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): flyteidl.admin.CreateTaskFailureReason; - - /** - * Verifies a CreateTaskFailureReason message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - } - /** Properties of a TaskExecutionGetRequest. */ interface ITaskExecutionGetRequest { diff --git a/flyteidl/gen/pb-js/flyteidl.js b/flyteidl/gen/pb-js/flyteidl.js index a4d8bfa67d..4ec39993c5 100644 --- a/flyteidl/gen/pb-js/flyteidl.js +++ b/flyteidl/gen/pb-js/flyteidl.js @@ -46536,384 +46536,6 @@ return TaskClosure; })(); - admin.TaskErrorExistsDifferentStructure = (function() { - - /** - * Properties of a TaskErrorExistsDifferentStructure. - * @memberof flyteidl.admin - * @interface ITaskErrorExistsDifferentStructure - * @property {flyteidl.core.IIdentifier|null} [id] TaskErrorExistsDifferentStructure id - */ - - /** - * Constructs a new TaskErrorExistsDifferentStructure. - * @memberof flyteidl.admin - * @classdesc Represents a TaskErrorExistsDifferentStructure. - * @implements ITaskErrorExistsDifferentStructure - * @constructor - * @param {flyteidl.admin.ITaskErrorExistsDifferentStructure=} [properties] Properties to set - */ - function TaskErrorExistsDifferentStructure(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TaskErrorExistsDifferentStructure id. - * @member {flyteidl.core.IIdentifier|null|undefined} id - * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure - * @instance - */ - TaskErrorExistsDifferentStructure.prototype.id = null; - - /** - * Creates a new TaskErrorExistsDifferentStructure instance using the specified properties. - * @function create - * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure - * @static - * @param {flyteidl.admin.ITaskErrorExistsDifferentStructure=} [properties] Properties to set - * @returns {flyteidl.admin.TaskErrorExistsDifferentStructure} TaskErrorExistsDifferentStructure instance - */ - TaskErrorExistsDifferentStructure.create = function create(properties) { - return new TaskErrorExistsDifferentStructure(properties); - }; - - /** - * Encodes the specified TaskErrorExistsDifferentStructure message. Does not implicitly {@link flyteidl.admin.TaskErrorExistsDifferentStructure.verify|verify} messages. - * @function encode - * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure - * @static - * @param {flyteidl.admin.ITaskErrorExistsDifferentStructure} message TaskErrorExistsDifferentStructure message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TaskErrorExistsDifferentStructure.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && message.hasOwnProperty("id")) - $root.flyteidl.core.Identifier.encode(message.id, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Decodes a TaskErrorExistsDifferentStructure message from the specified reader or buffer. - * @function decode - * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {flyteidl.admin.TaskErrorExistsDifferentStructure} TaskErrorExistsDifferentStructure - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TaskErrorExistsDifferentStructure.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.flyteidl.admin.TaskErrorExistsDifferentStructure(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = $root.flyteidl.core.Identifier.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Verifies a TaskErrorExistsDifferentStructure message. - * @function verify - * @memberof flyteidl.admin.TaskErrorExistsDifferentStructure - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TaskErrorExistsDifferentStructure.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) { - var error = $root.flyteidl.core.Identifier.verify(message.id); - if (error) - return "id." + error; - } - return null; - }; - - return TaskErrorExistsDifferentStructure; - })(); - - admin.TaskErrorExistsIdenticalStructure = (function() { - - /** - * Properties of a TaskErrorExistsIdenticalStructure. - * @memberof flyteidl.admin - * @interface ITaskErrorExistsIdenticalStructure - * @property {flyteidl.core.IIdentifier|null} [id] TaskErrorExistsIdenticalStructure id - */ - - /** - * Constructs a new TaskErrorExistsIdenticalStructure. - * @memberof flyteidl.admin - * @classdesc Represents a TaskErrorExistsIdenticalStructure. - * @implements ITaskErrorExistsIdenticalStructure - * @constructor - * @param {flyteidl.admin.ITaskErrorExistsIdenticalStructure=} [properties] Properties to set - */ - function TaskErrorExistsIdenticalStructure(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TaskErrorExistsIdenticalStructure id. - * @member {flyteidl.core.IIdentifier|null|undefined} id - * @memberof flyteidl.admin.TaskErrorExistsIdenticalStructure - * @instance - */ - TaskErrorExistsIdenticalStructure.prototype.id = null; - - /** - * Creates a new TaskErrorExistsIdenticalStructure instance using the specified properties. - * @function create - * @memberof flyteidl.admin.TaskErrorExistsIdenticalStructure - * @static - * @param {flyteidl.admin.ITaskErrorExistsIdenticalStructure=} [properties] Properties to set - * @returns {flyteidl.admin.TaskErrorExistsIdenticalStructure} TaskErrorExistsIdenticalStructure instance - */ - TaskErrorExistsIdenticalStructure.create = function create(properties) { - return new TaskErrorExistsIdenticalStructure(properties); - }; - - /** - * Encodes the specified TaskErrorExistsIdenticalStructure message. Does not implicitly {@link flyteidl.admin.TaskErrorExistsIdenticalStructure.verify|verify} messages. - * @function encode - * @memberof flyteidl.admin.TaskErrorExistsIdenticalStructure - * @static - * @param {flyteidl.admin.ITaskErrorExistsIdenticalStructure} message TaskErrorExistsIdenticalStructure message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TaskErrorExistsIdenticalStructure.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && message.hasOwnProperty("id")) - $root.flyteidl.core.Identifier.encode(message.id, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Decodes a TaskErrorExistsIdenticalStructure message from the specified reader or buffer. - * @function decode - * @memberof flyteidl.admin.TaskErrorExistsIdenticalStructure - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {flyteidl.admin.TaskErrorExistsIdenticalStructure} TaskErrorExistsIdenticalStructure - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TaskErrorExistsIdenticalStructure.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.flyteidl.admin.TaskErrorExistsIdenticalStructure(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = $root.flyteidl.core.Identifier.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Verifies a TaskErrorExistsIdenticalStructure message. - * @function verify - * @memberof flyteidl.admin.TaskErrorExistsIdenticalStructure - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TaskErrorExistsIdenticalStructure.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) { - var error = $root.flyteidl.core.Identifier.verify(message.id); - if (error) - return "id." + error; - } - return null; - }; - - return TaskErrorExistsIdenticalStructure; - })(); - - admin.CreateTaskFailureReason = (function() { - - /** - * Properties of a CreateTaskFailureReason. - * @memberof flyteidl.admin - * @interface ICreateTaskFailureReason - * @property {flyteidl.admin.ITaskErrorExistsDifferentStructure|null} [existsDifferentStructure] CreateTaskFailureReason existsDifferentStructure - * @property {flyteidl.admin.ITaskErrorExistsIdenticalStructure|null} [existsIdenticalStructure] CreateTaskFailureReason existsIdenticalStructure - */ - - /** - * Constructs a new CreateTaskFailureReason. - * @memberof flyteidl.admin - * @classdesc Represents a CreateTaskFailureReason. - * @implements ICreateTaskFailureReason - * @constructor - * @param {flyteidl.admin.ICreateTaskFailureReason=} [properties] Properties to set - */ - function CreateTaskFailureReason(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CreateTaskFailureReason existsDifferentStructure. - * @member {flyteidl.admin.ITaskErrorExistsDifferentStructure|null|undefined} existsDifferentStructure - * @memberof flyteidl.admin.CreateTaskFailureReason - * @instance - */ - CreateTaskFailureReason.prototype.existsDifferentStructure = null; - - /** - * CreateTaskFailureReason existsIdenticalStructure. - * @member {flyteidl.admin.ITaskErrorExistsIdenticalStructure|null|undefined} existsIdenticalStructure - * @memberof flyteidl.admin.CreateTaskFailureReason - * @instance - */ - CreateTaskFailureReason.prototype.existsIdenticalStructure = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * CreateTaskFailureReason reason. - * @member {"existsDifferentStructure"|"existsIdenticalStructure"|undefined} reason - * @memberof flyteidl.admin.CreateTaskFailureReason - * @instance - */ - Object.defineProperty(CreateTaskFailureReason.prototype, "reason", { - get: $util.oneOfGetter($oneOfFields = ["existsDifferentStructure", "existsIdenticalStructure"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new CreateTaskFailureReason instance using the specified properties. - * @function create - * @memberof flyteidl.admin.CreateTaskFailureReason - * @static - * @param {flyteidl.admin.ICreateTaskFailureReason=} [properties] Properties to set - * @returns {flyteidl.admin.CreateTaskFailureReason} CreateTaskFailureReason instance - */ - CreateTaskFailureReason.create = function create(properties) { - return new CreateTaskFailureReason(properties); - }; - - /** - * Encodes the specified CreateTaskFailureReason message. Does not implicitly {@link flyteidl.admin.CreateTaskFailureReason.verify|verify} messages. - * @function encode - * @memberof flyteidl.admin.CreateTaskFailureReason - * @static - * @param {flyteidl.admin.ICreateTaskFailureReason} message CreateTaskFailureReason message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateTaskFailureReason.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.existsDifferentStructure != null && message.hasOwnProperty("existsDifferentStructure")) - $root.flyteidl.admin.TaskErrorExistsDifferentStructure.encode(message.existsDifferentStructure, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.existsIdenticalStructure != null && message.hasOwnProperty("existsIdenticalStructure")) - $root.flyteidl.admin.TaskErrorExistsIdenticalStructure.encode(message.existsIdenticalStructure, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Decodes a CreateTaskFailureReason message from the specified reader or buffer. - * @function decode - * @memberof flyteidl.admin.CreateTaskFailureReason - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {flyteidl.admin.CreateTaskFailureReason} CreateTaskFailureReason - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateTaskFailureReason.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.flyteidl.admin.CreateTaskFailureReason(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.existsDifferentStructure = $root.flyteidl.admin.TaskErrorExistsDifferentStructure.decode(reader, reader.uint32()); - break; - case 2: - message.existsIdenticalStructure = $root.flyteidl.admin.TaskErrorExistsIdenticalStructure.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Verifies a CreateTaskFailureReason message. - * @function verify - * @memberof flyteidl.admin.CreateTaskFailureReason - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateTaskFailureReason.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.existsDifferentStructure != null && message.hasOwnProperty("existsDifferentStructure")) { - properties.reason = 1; - { - var error = $root.flyteidl.admin.TaskErrorExistsDifferentStructure.verify(message.existsDifferentStructure); - if (error) - return "existsDifferentStructure." + error; - } - } - if (message.existsIdenticalStructure != null && message.hasOwnProperty("existsIdenticalStructure")) { - if (properties.reason === 1) - return "reason: multiple values"; - properties.reason = 1; - { - var error = $root.flyteidl.admin.TaskErrorExistsIdenticalStructure.verify(message.existsIdenticalStructure); - if (error) - return "existsIdenticalStructure." + error; - } - } - return null; - }; - - return CreateTaskFailureReason; - })(); - admin.TaskExecutionGetRequest = (function() { /** diff --git a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py index 727fcb9e18..97dc00dfef 100644 --- a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py +++ b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.py @@ -18,7 +18,7 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19\x66lyteidl/admin/task.proto\x12\x0e\x66lyteidl.admin\x1a\x1e\x66lyteidl/core/identifier.proto\x1a\x19\x66lyteidl/core/tasks.proto\x1a\x1c\x66lyteidl/core/compiler.proto\x1a\'flyteidl/admin/description_entity.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"l\n\x11TaskCreateRequest\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12,\n\x04spec\x18\x02 \x01(\x0b\x32\x18.flyteidl.admin.TaskSpecR\x04spec\"\x14\n\x12TaskCreateResponse\"\x95\x01\n\x04Task\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12\x35\n\x07\x63losure\x18\x02 \x01(\x0b\x32\x1b.flyteidl.admin.TaskClosureR\x07\x63losure\x12+\n\x11short_description\x18\x03 \x01(\tR\x10shortDescription\"L\n\x08TaskList\x12*\n\x05tasks\x18\x01 \x03(\x0b\x32\x14.flyteidl.admin.TaskR\x05tasks\x12\x14\n\x05token\x18\x02 \x01(\tR\x05token\"\x88\x01\n\x08TaskSpec\x12\x37\n\x08template\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.TaskTemplateR\x08template\x12\x43\n\x0b\x64\x65scription\x18\x02 \x01(\x0b\x32!.flyteidl.admin.DescriptionEntityR\x0b\x64\x65scription\"\x8a\x01\n\x0bTaskClosure\x12@\n\rcompiled_task\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.CompiledTaskR\x0c\x63ompiledTask\x12\x39\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\"N\n!TaskErrorExistsDifferentStructure\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\"N\n!TaskErrorExistsIdenticalStructure\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\"\x89\x02\n\x17\x43reateTaskFailureReason\x12q\n\x1a\x65xists_different_structure\x18\x01 \x01(\x0b\x32\x31.flyteidl.admin.TaskErrorExistsDifferentStructureH\x00R\x18\x65xistsDifferentStructure\x12q\n\x1a\x65xists_identical_structure\x18\x02 \x01(\x0b\x32\x31.flyteidl.admin.TaskErrorExistsIdenticalStructureH\x00R\x18\x65xistsIdenticalStructureB\x08\n\x06reasonB\xb5\x01\n\x12\x63om.flyteidl.adminB\tTaskProtoP\x01Z;github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin\xa2\x02\x03\x46\x41X\xaa\x02\x0e\x46lyteidl.Admin\xca\x02\x0e\x46lyteidl\\Admin\xe2\x02\x1a\x46lyteidl\\Admin\\GPBMetadata\xea\x02\x0f\x46lyteidl::Adminb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19\x66lyteidl/admin/task.proto\x12\x0e\x66lyteidl.admin\x1a\x1e\x66lyteidl/core/identifier.proto\x1a\x19\x66lyteidl/core/tasks.proto\x1a\x1c\x66lyteidl/core/compiler.proto\x1a\'flyteidl/admin/description_entity.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"l\n\x11TaskCreateRequest\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12,\n\x04spec\x18\x02 \x01(\x0b\x32\x18.flyteidl.admin.TaskSpecR\x04spec\"\x14\n\x12TaskCreateResponse\"\x95\x01\n\x04Task\x12)\n\x02id\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\x02id\x12\x35\n\x07\x63losure\x18\x02 \x01(\x0b\x32\x1b.flyteidl.admin.TaskClosureR\x07\x63losure\x12+\n\x11short_description\x18\x03 \x01(\tR\x10shortDescription\"L\n\x08TaskList\x12*\n\x05tasks\x18\x01 \x03(\x0b\x32\x14.flyteidl.admin.TaskR\x05tasks\x12\x14\n\x05token\x18\x02 \x01(\tR\x05token\"\x88\x01\n\x08TaskSpec\x12\x37\n\x08template\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.TaskTemplateR\x08template\x12\x43\n\x0b\x64\x65scription\x18\x02 \x01(\x0b\x32!.flyteidl.admin.DescriptionEntityR\x0b\x64\x65scription\"\x8a\x01\n\x0bTaskClosure\x12@\n\rcompiled_task\x18\x01 \x01(\x0b\x32\x1b.flyteidl.core.CompiledTaskR\x0c\x63ompiledTask\x12\x39\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAtB\xb5\x01\n\x12\x63om.flyteidl.adminB\tTaskProtoP\x01Z;github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin\xa2\x02\x03\x46\x41X\xaa\x02\x0e\x46lyteidl.Admin\xca\x02\x0e\x46lyteidl\\Admin\xe2\x02\x1a\x46lyteidl\\Admin\\GPBMetadata\xea\x02\x0f\x46lyteidl::Adminb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -39,10 +39,4 @@ _globals['_TASKSPEC']._serialized_end=707 _globals['_TASKCLOSURE']._serialized_start=710 _globals['_TASKCLOSURE']._serialized_end=848 - _globals['_TASKERROREXISTSDIFFERENTSTRUCTURE']._serialized_start=850 - _globals['_TASKERROREXISTSDIFFERENTSTRUCTURE']._serialized_end=928 - _globals['_TASKERROREXISTSIDENTICALSTRUCTURE']._serialized_start=930 - _globals['_TASKERROREXISTSIDENTICALSTRUCTURE']._serialized_end=1008 - _globals['_CREATETASKFAILUREREASON']._serialized_start=1011 - _globals['_CREATETASKFAILUREREASON']._serialized_end=1276 # @@protoc_insertion_point(module_scope) diff --git a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi index 4b2ae2cf5f..2e6370fba5 100644 --- a/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi +++ b/flyteidl/gen/pb_python/flyteidl/admin/task_pb2.pyi @@ -55,23 +55,3 @@ class TaskClosure(_message.Message): compiled_task: _compiler_pb2.CompiledTask created_at: _timestamp_pb2.Timestamp def __init__(self, compiled_task: _Optional[_Union[_compiler_pb2.CompiledTask, _Mapping]] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... - -class TaskErrorExistsDifferentStructure(_message.Message): - __slots__ = ["id"] - ID_FIELD_NUMBER: _ClassVar[int] - id: _identifier_pb2.Identifier - def __init__(self, id: _Optional[_Union[_identifier_pb2.Identifier, _Mapping]] = ...) -> None: ... - -class TaskErrorExistsIdenticalStructure(_message.Message): - __slots__ = ["id"] - ID_FIELD_NUMBER: _ClassVar[int] - id: _identifier_pb2.Identifier - def __init__(self, id: _Optional[_Union[_identifier_pb2.Identifier, _Mapping]] = ...) -> None: ... - -class CreateTaskFailureReason(_message.Message): - __slots__ = ["exists_different_structure", "exists_identical_structure"] - EXISTS_DIFFERENT_STRUCTURE_FIELD_NUMBER: _ClassVar[int] - EXISTS_IDENTICAL_STRUCTURE_FIELD_NUMBER: _ClassVar[int] - exists_different_structure: TaskErrorExistsDifferentStructure - exists_identical_structure: TaskErrorExistsIdenticalStructure - def __init__(self, exists_different_structure: _Optional[_Union[TaskErrorExistsDifferentStructure, _Mapping]] = ..., exists_identical_structure: _Optional[_Union[TaskErrorExistsIdenticalStructure, _Mapping]] = ...) -> None: ... diff --git a/flyteidl/gen/pb_rust/flyteidl.admin.rs b/flyteidl/gen/pb_rust/flyteidl.admin.rs index 402d0cbeae..3995c67bb0 100644 --- a/flyteidl/gen/pb_rust/flyteidl.admin.rs +++ b/flyteidl/gen/pb_rust/flyteidl.admin.rs @@ -2908,38 +2908,6 @@ pub struct TaskClosure { #[prost(message, optional, tag="2")] pub created_at: ::core::option::Option<::prost_types::Timestamp>, } -/// The task id is already used and the structure is different -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TaskErrorExistsDifferentStructure { - #[prost(message, optional, tag="1")] - pub id: ::core::option::Option, -} -/// The task id is already used with an identical sctructure -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TaskErrorExistsIdenticalStructure { - #[prost(message, optional, tag="1")] - pub id: ::core::option::Option, -} -/// When a CreateTaskRequest fails due to matching id -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct CreateTaskFailureReason { - #[prost(oneof="create_task_failure_reason::Reason", tags="1, 2")] - pub reason: ::core::option::Option, -} -/// Nested message and enum types in `CreateTaskFailureReason`. -pub mod create_task_failure_reason { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Reason { - #[prost(message, tag="1")] - ExistsDifferentStructure(super::TaskErrorExistsDifferentStructure), - #[prost(message, tag="2")] - ExistsIdenticalStructure(super::TaskErrorExistsIdenticalStructure), - } -} /// A message used to fetch a single task execution entity. /// See :ref:`ref_flyteidl.admin.TaskExecution` for more details #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/flyteidl/protos/flyteidl/admin/task.proto b/flyteidl/protos/flyteidl/admin/task.proto index 9740bd939f..78fbba39f8 100644 --- a/flyteidl/protos/flyteidl/admin/task.proto +++ b/flyteidl/protos/flyteidl/admin/task.proto @@ -69,21 +69,3 @@ message TaskClosure { // Time at which the task was created. google.protobuf.Timestamp created_at = 2; } - -// The task id is already used and the structure is different -message TaskErrorExistsDifferentStructure { - core.Identifier id = 1; -} - -// The task id is already used with an identical sctructure -message TaskErrorExistsIdenticalStructure { - core.Identifier id = 1; -} - -// When a CreateTaskRequest fails due to matching id -message CreateTaskFailureReason { - oneof reason { - TaskErrorExistsDifferentStructure exists_different_structure = 1; - TaskErrorExistsIdenticalStructure exists_identical_structure = 2; - } -} From 804179e545d982ee4f02b895e70228a57bfa426e Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Fri, 1 Mar 2024 16:47:48 +0800 Subject: [PATCH 11/13] add launchplan Signed-off-by: Austin Liu --- flyteadmin/pkg/errors/errors.go | 16 ++++++ flyteadmin/pkg/errors/errors_test.go | 53 ++++++++++++++++++- .../pkg/manager/impl/launch_plan_manager.go | 12 +++-- 3 files changed, 74 insertions(+), 7 deletions(-) diff --git a/flyteadmin/pkg/errors/errors.go b/flyteadmin/pkg/errors/errors.go index 8cb04bba71..366e2a3f42 100644 --- a/flyteadmin/pkg/errors/errors.go +++ b/flyteadmin/pkg/errors/errors.go @@ -182,6 +182,22 @@ func NewWorkflowExistsIdenticalStructureError(ctx context.Context, request *admi return statusErr } +func NewLaunchPlanExistsDifferentStructureError(ctx context.Context, request *admin.LaunchPlanCreateRequest, oldSpec *admin.LaunchPlanSpec, newSpec *admin.LaunchPlanSpec) FlyteAdminError { + errorMsg := "launch plan with different structure already exists:\n" + diff, _ := jsondiff.Compare(oldSpec, newSpec) + rdiff, _ := jsondiff.Compare(newSpec, oldSpec) + rs := compareJsons(diff, rdiff) + + errorMsg += strings.Join(rs, "\n") + + return NewFlyteAdminErrorf(codes.InvalidArgument, errorMsg) +} + +func NewLaunchPlanExistsIdenticalStructureError(ctx context.Context, request *admin.LaunchPlanCreateRequest) FlyteAdminError { + errorMsg := "launch plan with identical structure already exists" + return NewFlyteAdminErrorf(codes.AlreadyExists, errorMsg) +} + func IsDoesNotExistError(err error) bool { adminError, ok := err.(FlyteAdminError) return ok && adminError.Code() == codes.NotFound diff --git a/flyteadmin/pkg/errors/errors_test.go b/flyteadmin/pkg/errors/errors_test.go index 4391b6f955..4350a5e665 100644 --- a/flyteadmin/pkg/errors/errors_test.go +++ b/flyteadmin/pkg/errors/errors_test.go @@ -182,10 +182,10 @@ func TestNewWorkflowExistsDifferentStructureError(t *testing.T) { } func TestNewWorkflowExistsIdenticalStructureError(t *testing.T) { - wf := &admin.WorkflowCreateRequest{ + req := &admin.WorkflowCreateRequest{ Id: &identifier, } - statusErr := NewWorkflowExistsIdenticalStructureError(context.Background(), wf) + statusErr := NewWorkflowExistsIdenticalStructureError(context.Background(), req) assert.NotNil(t, statusErr) s, ok := status.FromError(statusErr) assert.True(t, ok) @@ -198,6 +198,55 @@ func TestNewWorkflowExistsIdenticalStructureError(t *testing.T) { assert.True(t, ok) } +func TestNewLaunchPlanExistsDifferentStructureError(t *testing.T) { + req := &admin.LaunchPlanCreateRequest{ + Id: &identifier, + } + + oldLaunchPlan := &admin.LaunchPlan{ + Spec: &admin.LaunchPlanSpec{ + WorkflowId: &core.Identifier{ + Project: "testProj", + Domain: "domain", + Name: "lp_name", + Version: "ver1", + }, + }, + Id: &identifier, + } + + newLaunchPlan := &admin.LaunchPlan{ + Spec: &admin.LaunchPlanSpec{ + WorkflowId: &core.Identifier{ + Project: "testProj", + Domain: "domain", + Name: "lp_name", + Version: "ver2", + }, + }, + Id: &identifier, + } + + statusErr := NewLaunchPlanExistsDifferentStructureError(context.Background(), req, oldLaunchPlan.Spec, newLaunchPlan.Spec) + assert.NotNil(t, statusErr) + s, ok := status.FromError(statusErr) + assert.True(t, ok) + assert.Equal(t, codes.InvalidArgument, s.Code()) + assert.Equal(t, "launch plan with different structure already exists:\n\t\t- /workflow_id/version: ver1 -> ver2", s.Message()) +} + +func TestNewLaunchPlanExistsIdenticalStructureError(t *testing.T) { + req := &admin.LaunchPlanCreateRequest{ + Id: &identifier, + } + statusErr := NewLaunchPlanExistsIdenticalStructureError(context.Background(), req) + assert.NotNil(t, statusErr) + s, ok := status.FromError(statusErr) + assert.True(t, ok) + assert.Equal(t, codes.AlreadyExists, s.Code()) + assert.Equal(t, "launch plan with identical structure already exists", s.Message()) +} + func TestIsDoesNotExistError(t *testing.T) { assert.True(t, IsDoesNotExistError(NewFlyteAdminError(codes.NotFound, "foo"))) } diff --git a/flyteadmin/pkg/manager/impl/launch_plan_manager.go b/flyteadmin/pkg/manager/impl/launch_plan_manager.go index 093b4d7cce..d946af286c 100644 --- a/flyteadmin/pkg/manager/impl/launch_plan_manager.go +++ b/flyteadmin/pkg/manager/impl/launch_plan_manager.go @@ -88,12 +88,14 @@ func (m *LaunchPlanManager) CreateLaunchPlan( existingLaunchPlanModel, err := util.GetLaunchPlanModel(ctx, m.db, *request.Id) if err == nil { if bytes.Equal(existingLaunchPlanModel.Digest, launchPlanDigest) { - return nil, errors.NewFlyteAdminErrorf(codes.AlreadyExists, - "identical launch plan already exists with id %s", request.Id) + return nil, errors.NewLaunchPlanExistsIdenticalStructureError(ctx, &request) } - - return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument, - "launch plan with different structure already exists with id %v", request.Id) + existingLaunchPlan, err2 := transformers.FromLaunchPlanModel(existingLaunchPlanModel) + if err2 != nil { + return nil, err2 + } + // A launch plan exists with different structure + return nil, errors.NewLaunchPlanExistsDifferentStructureError(ctx, &request, existingLaunchPlan.Spec, launchPlan.Spec) } launchPlanModel, err := From cff01cfacd2d3e60a3e0c602a882493dffeb58c2 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Wed, 6 Mar 2024 05:23:59 +0800 Subject: [PATCH 12/13] cleanup Signed-off-by: Austin Liu --- flyteadmin/pkg/errors/errors_test.go | 23 +++++++++++++++++++ .../pkg/manager/impl/launch_plan_manager.go | 7 +++--- flyteadmin/pkg/manager/impl/task_manager.go | 7 +++--- .../pkg/manager/impl/workflow_manager.go | 7 +++--- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/flyteadmin/pkg/errors/errors_test.go b/flyteadmin/pkg/errors/errors_test.go index 4350a5e665..9cc0d1a349 100644 --- a/flyteadmin/pkg/errors/errors_test.go +++ b/flyteadmin/pkg/errors/errors_test.go @@ -3,9 +3,11 @@ package errors import ( "context" "errors" + "strings" "testing" "github.com/stretchr/testify/assert" + "github.com/wI2L/jsondiff" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -54,6 +56,27 @@ func TestNewIncompatibleClusterError(t *testing.T) { assert.True(t, ok) } +func TestJsonDifferError(t *testing.T) { + oldSpec := map[string]int{ + "one": 1, + "two": 2, + "three": 3, + "four": 4, + "five": 5, + } + newSpec := map[string]int{ + "five": 5, + "four": 0, + "three": 3, + "two": 2, + "one": 1, + } + diff, _ := jsondiff.Compare(oldSpec, newSpec) + rdiff, _ := jsondiff.Compare(newSpec, oldSpec) + rs := compareJsons(diff, rdiff) + assert.Equal(t, "\t\t- /four: 4 -> 0", strings.Join(rs, "\n")) +} + func TestNewTaskExistsDifferentStructureError(t *testing.T) { req := &admin.TaskCreateRequest{ Id: &identifier, diff --git a/flyteadmin/pkg/manager/impl/launch_plan_manager.go b/flyteadmin/pkg/manager/impl/launch_plan_manager.go index d946af286c..57936313e5 100644 --- a/flyteadmin/pkg/manager/impl/launch_plan_manager.go +++ b/flyteadmin/pkg/manager/impl/launch_plan_manager.go @@ -90,9 +90,10 @@ func (m *LaunchPlanManager) CreateLaunchPlan( if bytes.Equal(existingLaunchPlanModel.Digest, launchPlanDigest) { return nil, errors.NewLaunchPlanExistsIdenticalStructureError(ctx, &request) } - existingLaunchPlan, err2 := transformers.FromLaunchPlanModel(existingLaunchPlanModel) - if err2 != nil { - return nil, err2 + existingLaunchPlan, transformerErr := transformers.FromLaunchPlanModel(existingLaunchPlanModel) + if transformerErr != nil { + logger.Errorf(ctx, "failed to transform launch plan from launch plan model") + return nil, transformerErr } // A launch plan exists with different structure return nil, errors.NewLaunchPlanExistsDifferentStructureError(ctx, &request, existingLaunchPlan.Spec, launchPlan.Spec) diff --git a/flyteadmin/pkg/manager/impl/task_manager.go b/flyteadmin/pkg/manager/impl/task_manager.go index d6bd7c97fb..f3eced5d81 100644 --- a/flyteadmin/pkg/manager/impl/task_manager.go +++ b/flyteadmin/pkg/manager/impl/task_manager.go @@ -94,9 +94,10 @@ func (t *TaskManager) CreateTask( if bytes.Equal(taskDigest, existingTaskModel.Digest) { return nil, errors.NewTaskExistsIdenticalStructureError(ctx, &request) } - existingTask, err2 := transformers.FromTaskModel(*existingTaskModel) - if err2 != nil { - return nil, err2 + existingTask, transformerErr := transformers.FromTaskModel(*existingTaskModel) + if transformerErr != nil { + logger.Errorf(ctx, "failed to transform task from task model") + return nil, transformerErr } return nil, errors.NewTaskExistsDifferentStructureError(ctx, &request, existingTask.Closure.GetCompiledTask(), compiledTask) } diff --git a/flyteadmin/pkg/manager/impl/workflow_manager.go b/flyteadmin/pkg/manager/impl/workflow_manager.go index 48a396ba51..e4cc5cc120 100644 --- a/flyteadmin/pkg/manager/impl/workflow_manager.go +++ b/flyteadmin/pkg/manager/impl/workflow_manager.go @@ -168,9 +168,10 @@ func (w *WorkflowManager) CreateWorkflow( if bytes.Equal(workflowDigest, existingWorkflowModel.Digest) { return nil, errors.NewWorkflowExistsIdenticalStructureError(ctx, &request) } - existingWorkflow, err2 := transformers.FromWorkflowModel(existingWorkflowModel) - if err2 != nil { - return nil, err2 + existingWorkflow, transformerErr := transformers.FromWorkflowModel(existingWorkflowModel) + if transformerErr != nil { + logger.Errorf(ctx, "failed to transform workflow from workflow model") + return nil, transformerErr } // A workflow exists with different structure return nil, errors.NewWorkflowExistsDifferentStructureError(ctx, &request, existingWorkflow.Closure.GetCompiledWorkflow(), workflowClosure.GetCompiledWorkflow()) From 04c34badbb631827ea15cf748531ced05bb1e4d7 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Thu, 7 Mar 2024 16:12:26 +0800 Subject: [PATCH 13/13] test: add no diff case Signed-off-by: Austin Liu --- flyteadmin/pkg/errors/errors_test.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/flyteadmin/pkg/errors/errors_test.go b/flyteadmin/pkg/errors/errors_test.go index 9cc0d1a349..6c97d9e911 100644 --- a/flyteadmin/pkg/errors/errors_test.go +++ b/flyteadmin/pkg/errors/errors_test.go @@ -56,7 +56,7 @@ func TestNewIncompatibleClusterError(t *testing.T) { assert.True(t, ok) } -func TestJsonDifferError(t *testing.T) { +func TestJsonDifferHasDiffError(t *testing.T) { oldSpec := map[string]int{ "one": 1, "two": 2, @@ -77,6 +77,27 @@ func TestJsonDifferError(t *testing.T) { assert.Equal(t, "\t\t- /four: 4 -> 0", strings.Join(rs, "\n")) } +func TestJsonDifferNoDiffError(t *testing.T) { + oldSpec := map[string]int{ + "one": 1, + "two": 2, + "three": 3, + "four": 4, + "five": 5, + } + newSpec := map[string]int{ + "five": 5, + "four": 4, + "three": 3, + "two": 2, + "one": 1, + } + diff, _ := jsondiff.Compare(oldSpec, newSpec) + rdiff, _ := jsondiff.Compare(newSpec, oldSpec) + rs := compareJsons(diff, rdiff) + assert.Equal(t, "", strings.Join(rs, "\n")) +} + func TestNewTaskExistsDifferentStructureError(t *testing.T) { req := &admin.TaskCreateRequest{ Id: &identifier,