diff --git a/gateway/proto/BUILD.bazel b/gateway/proto/BUILD.bazel index 3aab896d..36435e7a 100644 --- a/gateway/proto/BUILD.bazel +++ b/gateway/proto/BUILD.bazel @@ -1,4 +1,3 @@ -load("@rules_go//go:def.bzl", "go_library") load("@rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") @@ -9,27 +8,15 @@ proto_library( ) # keep +# Used for regenerating .pb.go files in ../protopb/ +# The actual go_library is in //gateway/protopb:protopb go_proto_library( name = "gatewaypb_go_proto", compilers = [ "@rules_go//proto:go_proto", "@rules_go//proto:go_grpc_v2", ], - importpath = "github.com/uber/submitqueue/gateway/proto", - proto = ":gatewaypb_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "proto", - embed = [":gatewaypb_go_proto"], - importpath = "github.com/uber/submitqueue/gateway/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":gatewaypb_go_proto"], importpath = "github.com/uber/submitqueue/gateway/protopb", + proto = ":gatewaypb_proto", visibility = ["//visibility:public"], ) diff --git a/orchestrator/proto/BUILD.bazel b/orchestrator/proto/BUILD.bazel index cdbe7a08..17ce7d8c 100644 --- a/orchestrator/proto/BUILD.bazel +++ b/orchestrator/proto/BUILD.bazel @@ -1,4 +1,3 @@ -load("@rules_go//go:def.bzl", "go_library") load("@rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") @@ -9,27 +8,15 @@ proto_library( ) # keep +# Used for regenerating .pb.go files in ../protopb/ +# The actual go_library is in //orchestrator/protopb:protopb go_proto_library( name = "orchestratorpb_go_proto", compilers = [ "@rules_go//proto:go_proto", "@rules_go//proto:go_grpc_v2", ], - importpath = "github.com/uber/submitqueue/orchestrator/proto", - proto = ":orchestratorpb_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "proto", - embed = [":orchestratorpb_go_proto"], - importpath = "github.com/uber/submitqueue/orchestrator/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":orchestratorpb_go_proto"], importpath = "github.com/uber/submitqueue/orchestrator/protopb", + proto = ":orchestratorpb_proto", visibility = ["//visibility:public"], ) diff --git a/speculator/proto/BUILD.bazel b/speculator/proto/BUILD.bazel index 65de9c86..42d8304e 100644 --- a/speculator/proto/BUILD.bazel +++ b/speculator/proto/BUILD.bazel @@ -1,4 +1,3 @@ -load("@rules_go//go:def.bzl", "go_library") load("@rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") @@ -9,27 +8,15 @@ proto_library( ) # keep +# Used for regenerating .pb.go files in ../protopb/ +# The actual go_library is in //speculator/protopb:protopb go_proto_library( name = "speculatorpb_go_proto", compilers = [ "@rules_go//proto:go_proto", "@rules_go//proto:go_grpc_v2", ], - importpath = "github.com/uber/submitqueue/speculator/proto", - proto = ":speculatorpb_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "proto", - embed = [":speculatorpb_go_proto"], - importpath = "github.com/uber/submitqueue/speculator/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":speculatorpb_go_proto"], importpath = "github.com/uber/submitqueue/speculator/protopb", + proto = ":speculatorpb_proto", visibility = ["//visibility:public"], ) diff --git a/speculator/proto/speculator.proto b/speculator/proto/speculator.proto index 1746aa3c..ce39eea3 100644 --- a/speculator/proto/speculator.proto +++ b/speculator/proto/speculator.proto @@ -25,8 +25,104 @@ message PingResponse { string hostname = 4; } -// SubmitQueueSpeculator provides the speculator API +// SpeculationRequest is the request for speculating the outcome of a batch (new request) +message SpeculationRequest { + // ID of the batch being speculated + string batch_id = 1; + // List of batch IDs that the current batch depends on + repeated string dependencies = 2; +} + +// SpeculationResponse is the response for the SpeculationRequest, providing speculation results for the batch, +// including possible speculation paths and their associated scores and recommended actions +message SpeculationResponse { + repeated SpeculationPathResult results = 1; +} + +// SpeculationSignalRequest is the request for sending a speculation signal for a batch in a speculation path, +// providing information about the speculation path and the signal being sent, such as whether a build has succeeded, +// failed, or been cancelled for the batch in this speculation path +message SpeculationSignalRequest { + // path is the speculation path for which the speculation signal is being sent, represented as a list of + // batch IDs that have been triggered as part of this speculation path leading up to the current + SpeculationPath path = 1; + // signal is the speculation signal being sent for the batch in this speculation path, such as whether a + // build has succeeded, failed, or been cancelled for the batch in this speculation path + SpeculationSignal signal = 2; +} + +// SpeculationSignalResponse is the response for the SpeculationSignalRequest, +// providing updated speculation results for the batch based on the received signal, +// including possible speculation paths and their associated scores and recommended actions +message SpeculationSignalResponse { + repeated SpeculationPathResult results = 1; +} + +// SpeculationSignal represents the signal being sent for a batch in a speculation path, such as whether a build has +// succeeded, failed, or been cancelled for the batch in this speculation path, or whether the batch has been +// finalized (landed) or failed to finalize (failed to land) +enum SpeculationSignal { + SPECULATION_SIGNAL_UNSPECIFIED = 0; + // Signal indicating that a build has been triggered for the batch in this speculation path + SPECULATION_SIGNAL_BUILD_SUCCEEDED = 1; + // Signal indicating that a build has been cancelled for the batch in this speculation path + SPECULATION_SIGNAL_BUILD_CANCELLED = 2; + // Signal indicating that a build has failed for the batch in this speculation path + SPECULATION_SIGNAL_BUILD_FAILED = 3; + // Signal indicating that the batch in this speculation path has been finalized, meaning it has been landed + SPECULATION_SIGNAL_FINALIZE_SUCCEEDED = 4; + // Signal indicating that the batch in this speculation path has failed to finalize, meaning it failed to land + SPECULATION_SIGNAL_FINALIZE_FAILED = 5; +} + +// SpeculationAction represents the recommended action to take for a given speculation path, +// such as whether to trigger a build, cancel it, or finalize it +enum SpeculationAction { + SPECULATION_ACTION_UNSPECIFIED = 0; + // Trigger a build for the batch in this speculation path + SPECULATION_ACTION_BUILD = 1; + // Cancel the build for the batch in this speculation path, if it was previously triggered + SPECULATION_ACTION_CANCEL = 2; + // Finalize the batch in this speculation path, meaning land them + SPECULATION_ACTION_FINALIZE = 3; +} + +// SpeculationPath represents a possible speculation path for a batch, including the batch ID and a list of batch IDs +// representing a possible sequence of batches that could be triggered as a result of the current batch,it's dependencies +message SpeculationPath { + // batch_id is the ID of the batch for which this speculation path is being provided + string batch_id = 1; + // batch_ids is a list of batch IDs representing a possible sequence of batches that could be triggered as a result + // of the current batch, based on the dependencies and historical data + repeated string batch_ids = 2; +} + +// SpeculationPathResult represents the speculation result for a given speculation path, including the speculation path, +// a score representing the likelihood of needing this path for build, and a recommended action to take for this path +// based on the speculation results, such as whether to trigger a build, cancel it, or finalize it +message SpeculationPathResult { + // path is the speculation path for which the speculation result is being provided, represented as a list of + // batch IDs that have been triggered as part of this speculation path leading up + SpeculationPath path = 1; + // score is a numerical value representing the likelihood of needing this path for build + // 0.0 >= score <= 1.0, where a higher score indicates a higher likelihood of needing this path for build + float score = 2; + // action is the recommended action to take for this path based on the speculation results, s + // uch as whether to trigger a build, cancel it, or finalize it + SpeculationAction action = 3; +} + +// SubmitQueueSpeculator service provides APIs for speculating, signaling, and receiving speculation results for batches +// in the submit queue, allowing clients to make informed decisions about which batches to trigger builds for, cancel, +// or finalize based on the speculation results and signals received for different speculation paths service SubmitQueueSpeculator { // Ping returns a response indicating the service is alive rpc Ping(PingRequest) returns (PingResponse) {} + // Speculate takes a SpeculationRequest containing information about a batch and its dependencies + // and returns a SpeculationResponse + rpc Speculate(SpeculationRequest) returns (SpeculationResponse) {} + // Signal takes a SpeculationSignalRequest containing a speculation path and a speculation signal for that path, + // and returns a SpeculationSignalResponse containing updated speculation results for the batch based on the + // received signal + rpc Signal(SpeculationSignalRequest) returns (SpeculationSignalResponse) {} } diff --git a/speculator/protopb/speculator.pb.go b/speculator/protopb/speculator.pb.go index 6be0c329..89fc6136 100644 --- a/speculator/protopb/speculator.pb.go +++ b/speculator/protopb/speculator.pb.go @@ -21,6 +21,129 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// SpeculationSignal represents the signal being sent for a batch in a speculation path, such as whether a build has +// succeeded, failed, or been cancelled for the batch in this speculation path, or whether the batch has been +// finalized (landed) or failed to finalize (failed to land) +type SpeculationSignal int32 + +const ( + SpeculationSignal_SPECULATION_SIGNAL_UNSPECIFIED SpeculationSignal = 0 + // Signal indicating that a build has been triggered for the batch in this speculation path + SpeculationSignal_SPECULATION_SIGNAL_BUILD_SUCCEEDED SpeculationSignal = 1 + // Signal indicating that a build has been cancelled for the batch in this speculation path + SpeculationSignal_SPECULATION_SIGNAL_BUILD_CANCELLED SpeculationSignal = 2 + // Signal indicating that a build has failed for the batch in this speculation path + SpeculationSignal_SPECULATION_SIGNAL_BUILD_FAILED SpeculationSignal = 3 + // Signal indicating that the batch in this speculation path has been finalized, meaning it has been landed + SpeculationSignal_SPECULATION_SIGNAL_FINALIZE_SUCCEEDED SpeculationSignal = 4 + // Signal indicating that the batch in this speculation path has failed to finalize, meaning it failed to land + SpeculationSignal_SPECULATION_SIGNAL_FINALIZE_FAILED SpeculationSignal = 5 +) + +// Enum value maps for SpeculationSignal. +var ( + SpeculationSignal_name = map[int32]string{ + 0: "SPECULATION_SIGNAL_UNSPECIFIED", + 1: "SPECULATION_SIGNAL_BUILD_SUCCEEDED", + 2: "SPECULATION_SIGNAL_BUILD_CANCELLED", + 3: "SPECULATION_SIGNAL_BUILD_FAILED", + 4: "SPECULATION_SIGNAL_FINALIZE_SUCCEEDED", + 5: "SPECULATION_SIGNAL_FINALIZE_FAILED", + } + SpeculationSignal_value = map[string]int32{ + "SPECULATION_SIGNAL_UNSPECIFIED": 0, + "SPECULATION_SIGNAL_BUILD_SUCCEEDED": 1, + "SPECULATION_SIGNAL_BUILD_CANCELLED": 2, + "SPECULATION_SIGNAL_BUILD_FAILED": 3, + "SPECULATION_SIGNAL_FINALIZE_SUCCEEDED": 4, + "SPECULATION_SIGNAL_FINALIZE_FAILED": 5, + } +) + +func (x SpeculationSignal) Enum() *SpeculationSignal { + p := new(SpeculationSignal) + *p = x + return p +} + +func (x SpeculationSignal) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SpeculationSignal) Descriptor() protoreflect.EnumDescriptor { + return file_speculator_proto_enumTypes[0].Descriptor() +} + +func (SpeculationSignal) Type() protoreflect.EnumType { + return &file_speculator_proto_enumTypes[0] +} + +func (x SpeculationSignal) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SpeculationSignal.Descriptor instead. +func (SpeculationSignal) EnumDescriptor() ([]byte, []int) { + return file_speculator_proto_rawDescGZIP(), []int{0} +} + +// SpeculationAction represents the recommended action to take for a given speculation path, +// such as whether to trigger a build, cancel it, or finalize it +type SpeculationAction int32 + +const ( + SpeculationAction_SPECULATION_ACTION_UNSPECIFIED SpeculationAction = 0 + // Trigger a build for the batch in this speculation path + SpeculationAction_SPECULATION_ACTION_BUILD SpeculationAction = 1 + // Cancel the build for the batch in this speculation path, if it was previously triggered + SpeculationAction_SPECULATION_ACTION_CANCEL SpeculationAction = 2 + // Finalize the batch in this speculation path, meaning land them + SpeculationAction_SPECULATION_ACTION_FINALIZE SpeculationAction = 3 +) + +// Enum value maps for SpeculationAction. +var ( + SpeculationAction_name = map[int32]string{ + 0: "SPECULATION_ACTION_UNSPECIFIED", + 1: "SPECULATION_ACTION_BUILD", + 2: "SPECULATION_ACTION_CANCEL", + 3: "SPECULATION_ACTION_FINALIZE", + } + SpeculationAction_value = map[string]int32{ + "SPECULATION_ACTION_UNSPECIFIED": 0, + "SPECULATION_ACTION_BUILD": 1, + "SPECULATION_ACTION_CANCEL": 2, + "SPECULATION_ACTION_FINALIZE": 3, + } +) + +func (x SpeculationAction) Enum() *SpeculationAction { + p := new(SpeculationAction) + *p = x + return p +} + +func (x SpeculationAction) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SpeculationAction) Descriptor() protoreflect.EnumDescriptor { + return file_speculator_proto_enumTypes[1].Descriptor() +} + +func (SpeculationAction) Type() protoreflect.EnumType { + return &file_speculator_proto_enumTypes[1] +} + +func (x SpeculationAction) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SpeculationAction.Descriptor instead. +func (SpeculationAction) EnumDescriptor() ([]byte, []int) { + return file_speculator_proto_rawDescGZIP(), []int{1} +} + // PingRequest is the request for the Ping method type PingRequest struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -140,6 +263,339 @@ func (x *PingResponse) GetHostname() string { return "" } +// SpeculationRequest is the request for speculating the outcome of a batch (new request) +type SpeculationRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // ID of the batch being speculated + BatchId string `protobuf:"bytes,1,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` + // List of batch IDs that the current batch depends on + Dependencies []string `protobuf:"bytes,2,rep,name=dependencies,proto3" json:"dependencies,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SpeculationRequest) Reset() { + *x = SpeculationRequest{} + mi := &file_speculator_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SpeculationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SpeculationRequest) ProtoMessage() {} + +func (x *SpeculationRequest) ProtoReflect() protoreflect.Message { + mi := &file_speculator_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SpeculationRequest.ProtoReflect.Descriptor instead. +func (*SpeculationRequest) Descriptor() ([]byte, []int) { + return file_speculator_proto_rawDescGZIP(), []int{2} +} + +func (x *SpeculationRequest) GetBatchId() string { + if x != nil { + return x.BatchId + } + return "" +} + +func (x *SpeculationRequest) GetDependencies() []string { + if x != nil { + return x.Dependencies + } + return nil +} + +// SpeculationResponse is the response for the SpeculationRequest, providing speculation results for the batch, +// including possible speculation paths and their associated scores and recommended actions +type SpeculationResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Results []*SpeculationPathResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SpeculationResponse) Reset() { + *x = SpeculationResponse{} + mi := &file_speculator_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SpeculationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SpeculationResponse) ProtoMessage() {} + +func (x *SpeculationResponse) ProtoReflect() protoreflect.Message { + mi := &file_speculator_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SpeculationResponse.ProtoReflect.Descriptor instead. +func (*SpeculationResponse) Descriptor() ([]byte, []int) { + return file_speculator_proto_rawDescGZIP(), []int{3} +} + +func (x *SpeculationResponse) GetResults() []*SpeculationPathResult { + if x != nil { + return x.Results + } + return nil +} + +// SpeculationSignalRequest is the request for sending a speculation signal for a batch in a speculation path, +// providing information about the speculation path and the signal being sent, such as whether a build has succeeded, +// failed, or been cancelled for the batch in this speculation path +type SpeculationSignalRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // path is the speculation path for which the speculation signal is being sent, represented as a list of + // batch IDs that have been triggered as part of this speculation path leading up to the current + Path *SpeculationPath `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + // signal is the speculation signal being sent for the batch in this speculation path, such as whether a + // build has succeeded, failed, or been cancelled for the batch in this speculation path + Signal SpeculationSignal `protobuf:"varint,2,opt,name=signal,proto3,enum=uber.devexp.submitqueue.speculator.SpeculationSignal" json:"signal,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SpeculationSignalRequest) Reset() { + *x = SpeculationSignalRequest{} + mi := &file_speculator_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SpeculationSignalRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SpeculationSignalRequest) ProtoMessage() {} + +func (x *SpeculationSignalRequest) ProtoReflect() protoreflect.Message { + mi := &file_speculator_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SpeculationSignalRequest.ProtoReflect.Descriptor instead. +func (*SpeculationSignalRequest) Descriptor() ([]byte, []int) { + return file_speculator_proto_rawDescGZIP(), []int{4} +} + +func (x *SpeculationSignalRequest) GetPath() *SpeculationPath { + if x != nil { + return x.Path + } + return nil +} + +func (x *SpeculationSignalRequest) GetSignal() SpeculationSignal { + if x != nil { + return x.Signal + } + return SpeculationSignal_SPECULATION_SIGNAL_UNSPECIFIED +} + +// SpeculationSignalResponse is the response for the SpeculationSignalRequest, +// providing updated speculation results for the batch based on the received signal, +// including possible speculation paths and their associated scores and recommended actions +type SpeculationSignalResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Results []*SpeculationPathResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SpeculationSignalResponse) Reset() { + *x = SpeculationSignalResponse{} + mi := &file_speculator_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SpeculationSignalResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SpeculationSignalResponse) ProtoMessage() {} + +func (x *SpeculationSignalResponse) ProtoReflect() protoreflect.Message { + mi := &file_speculator_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SpeculationSignalResponse.ProtoReflect.Descriptor instead. +func (*SpeculationSignalResponse) Descriptor() ([]byte, []int) { + return file_speculator_proto_rawDescGZIP(), []int{5} +} + +func (x *SpeculationSignalResponse) GetResults() []*SpeculationPathResult { + if x != nil { + return x.Results + } + return nil +} + +// SpeculationPath represents a possible speculation path for a batch, including the batch ID and a list of batch IDs +// representing a possible sequence of batches that could be triggered as a result of the current batch,it's dependencies +type SpeculationPath struct { + state protoimpl.MessageState `protogen:"open.v1"` + // batch_id is the ID of the batch for which this speculation path is being provided + BatchId string `protobuf:"bytes,1,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` + // batch_ids is a list of batch IDs representing a possible sequence of batches that could be triggered as a result + // of the current batch, based on the dependencies and historical data + BatchIds []string `protobuf:"bytes,2,rep,name=batch_ids,json=batchIds,proto3" json:"batch_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SpeculationPath) Reset() { + *x = SpeculationPath{} + mi := &file_speculator_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SpeculationPath) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SpeculationPath) ProtoMessage() {} + +func (x *SpeculationPath) ProtoReflect() protoreflect.Message { + mi := &file_speculator_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SpeculationPath.ProtoReflect.Descriptor instead. +func (*SpeculationPath) Descriptor() ([]byte, []int) { + return file_speculator_proto_rawDescGZIP(), []int{6} +} + +func (x *SpeculationPath) GetBatchId() string { + if x != nil { + return x.BatchId + } + return "" +} + +func (x *SpeculationPath) GetBatchIds() []string { + if x != nil { + return x.BatchIds + } + return nil +} + +// SpeculationPathResult represents the speculation result for a given speculation path, including the speculation path, +// a score representing the likelihood of needing this path for build, and a recommended action to take for this path +// based on the speculation results, such as whether to trigger a build, cancel it, or finalize it +type SpeculationPathResult struct { + state protoimpl.MessageState `protogen:"open.v1"` + // path is the speculation path for which the speculation result is being provided, represented as a list of + // batch IDs that have been triggered as part of this speculation path leading up + Path *SpeculationPath `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + // score is a numerical value representing the likelihood of needing this path for build + // 0.0 >= score <= 1.0, where a higher score indicates a higher likelihood of needing this path for build + Score float32 `protobuf:"fixed32,2,opt,name=score,proto3" json:"score,omitempty"` + // action is the recommended action to take for this path based on the speculation results, s + // uch as whether to trigger a build, cancel it, or finalize it + Action SpeculationAction `protobuf:"varint,3,opt,name=action,proto3,enum=uber.devexp.submitqueue.speculator.SpeculationAction" json:"action,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SpeculationPathResult) Reset() { + *x = SpeculationPathResult{} + mi := &file_speculator_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SpeculationPathResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SpeculationPathResult) ProtoMessage() {} + +func (x *SpeculationPathResult) ProtoReflect() protoreflect.Message { + mi := &file_speculator_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SpeculationPathResult.ProtoReflect.Descriptor instead. +func (*SpeculationPathResult) Descriptor() ([]byte, []int) { + return file_speculator_proto_rawDescGZIP(), []int{7} +} + +func (x *SpeculationPathResult) GetPath() *SpeculationPath { + if x != nil { + return x.Path + } + return nil +} + +func (x *SpeculationPathResult) GetScore() float32 { + if x != nil { + return x.Score + } + return 0 +} + +func (x *SpeculationPathResult) GetAction() SpeculationAction { + if x != nil { + return x.Action + } + return SpeculationAction_SPECULATION_ACTION_UNSPECIFIED +} + var File_speculator_proto protoreflect.FileDescriptor const file_speculator_proto_rawDesc = "" + @@ -151,9 +607,40 @@ const file_speculator_proto_rawDesc = "" + "\amessage\x18\x01 \x01(\tR\amessage\x12!\n" + "\fservice_name\x18\x02 \x01(\tR\vserviceName\x12\x1c\n" + "\ttimestamp\x18\x03 \x01(\x03R\ttimestamp\x12\x1a\n" + - "\bhostname\x18\x04 \x01(\tR\bhostname2\x84\x01\n" + + "\bhostname\x18\x04 \x01(\tR\bhostname\"S\n" + + "\x12SpeculationRequest\x12\x19\n" + + "\bbatch_id\x18\x01 \x01(\tR\abatchId\x12\"\n" + + "\fdependencies\x18\x02 \x03(\tR\fdependencies\"j\n" + + "\x13SpeculationResponse\x12S\n" + + "\aresults\x18\x01 \x03(\v29.uber.devexp.submitqueue.speculator.SpeculationPathResultR\aresults\"\xb2\x01\n" + + "\x18SpeculationSignalRequest\x12G\n" + + "\x04path\x18\x01 \x01(\v23.uber.devexp.submitqueue.speculator.SpeculationPathR\x04path\x12M\n" + + "\x06signal\x18\x02 \x01(\x0e25.uber.devexp.submitqueue.speculator.SpeculationSignalR\x06signal\"p\n" + + "\x19SpeculationSignalResponse\x12S\n" + + "\aresults\x18\x01 \x03(\v29.uber.devexp.submitqueue.speculator.SpeculationPathResultR\aresults\"I\n" + + "\x0fSpeculationPath\x12\x19\n" + + "\bbatch_id\x18\x01 \x01(\tR\abatchId\x12\x1b\n" + + "\tbatch_ids\x18\x02 \x03(\tR\bbatchIds\"\xc5\x01\n" + + "\x15SpeculationPathResult\x12G\n" + + "\x04path\x18\x01 \x01(\v23.uber.devexp.submitqueue.speculator.SpeculationPathR\x04path\x12\x14\n" + + "\x05score\x18\x02 \x01(\x02R\x05score\x12M\n" + + "\x06action\x18\x03 \x01(\x0e25.uber.devexp.submitqueue.speculator.SpeculationActionR\x06action*\xff\x01\n" + + "\x11SpeculationSignal\x12\"\n" + + "\x1eSPECULATION_SIGNAL_UNSPECIFIED\x10\x00\x12&\n" + + "\"SPECULATION_SIGNAL_BUILD_SUCCEEDED\x10\x01\x12&\n" + + "\"SPECULATION_SIGNAL_BUILD_CANCELLED\x10\x02\x12#\n" + + "\x1fSPECULATION_SIGNAL_BUILD_FAILED\x10\x03\x12)\n" + + "%SPECULATION_SIGNAL_FINALIZE_SUCCEEDED\x10\x04\x12&\n" + + "\"SPECULATION_SIGNAL_FINALIZE_FAILED\x10\x05*\x95\x01\n" + + "\x11SpeculationAction\x12\"\n" + + "\x1eSPECULATION_ACTION_UNSPECIFIED\x10\x00\x12\x1c\n" + + "\x18SPECULATION_ACTION_BUILD\x10\x01\x12\x1d\n" + + "\x19SPECULATION_ACTION_CANCEL\x10\x02\x12\x1f\n" + + "\x1bSPECULATION_ACTION_FINALIZE\x10\x032\x8e\x03\n" + "\x15SubmitQueueSpeculator\x12k\n" + - "\x04Ping\x12/.uber.devexp.submitqueue.speculator.PingRequest\x1a0.uber.devexp.submitqueue.speculator.PingResponse\"\x00Bk\n" + + "\x04Ping\x12/.uber.devexp.submitqueue.speculator.PingRequest\x1a0.uber.devexp.submitqueue.speculator.PingResponse\"\x00\x12~\n" + + "\tSpeculate\x126.uber.devexp.submitqueue.speculator.SpeculationRequest\x1a7.uber.devexp.submitqueue.speculator.SpeculationResponse\"\x00\x12\x87\x01\n" + + "\x06Signal\x12<.uber.devexp.submitqueue.speculator.SpeculationSignalRequest\x1a=.uber.devexp.submitqueue.speculator.SpeculationSignalResponse\"\x00Bk\n" + "&com.uber.devexp.submitqueue.speculatorB\x0fSpeculatorProtoP\x01Z.github.com/uber/submitqueue/speculator/protopbb\x06proto3" var ( @@ -168,19 +655,38 @@ func file_speculator_proto_rawDescGZIP() []byte { return file_speculator_proto_rawDescData } -var file_speculator_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_speculator_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_speculator_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_speculator_proto_goTypes = []any{ - (*PingRequest)(nil), // 0: uber.devexp.submitqueue.speculator.PingRequest - (*PingResponse)(nil), // 1: uber.devexp.submitqueue.speculator.PingResponse + (SpeculationSignal)(0), // 0: uber.devexp.submitqueue.speculator.SpeculationSignal + (SpeculationAction)(0), // 1: uber.devexp.submitqueue.speculator.SpeculationAction + (*PingRequest)(nil), // 2: uber.devexp.submitqueue.speculator.PingRequest + (*PingResponse)(nil), // 3: uber.devexp.submitqueue.speculator.PingResponse + (*SpeculationRequest)(nil), // 4: uber.devexp.submitqueue.speculator.SpeculationRequest + (*SpeculationResponse)(nil), // 5: uber.devexp.submitqueue.speculator.SpeculationResponse + (*SpeculationSignalRequest)(nil), // 6: uber.devexp.submitqueue.speculator.SpeculationSignalRequest + (*SpeculationSignalResponse)(nil), // 7: uber.devexp.submitqueue.speculator.SpeculationSignalResponse + (*SpeculationPath)(nil), // 8: uber.devexp.submitqueue.speculator.SpeculationPath + (*SpeculationPathResult)(nil), // 9: uber.devexp.submitqueue.speculator.SpeculationPathResult } var file_speculator_proto_depIdxs = []int32{ - 0, // 0: uber.devexp.submitqueue.speculator.SubmitQueueSpeculator.Ping:input_type -> uber.devexp.submitqueue.speculator.PingRequest - 1, // 1: uber.devexp.submitqueue.speculator.SubmitQueueSpeculator.Ping:output_type -> uber.devexp.submitqueue.speculator.PingResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 9, // 0: uber.devexp.submitqueue.speculator.SpeculationResponse.results:type_name -> uber.devexp.submitqueue.speculator.SpeculationPathResult + 8, // 1: uber.devexp.submitqueue.speculator.SpeculationSignalRequest.path:type_name -> uber.devexp.submitqueue.speculator.SpeculationPath + 0, // 2: uber.devexp.submitqueue.speculator.SpeculationSignalRequest.signal:type_name -> uber.devexp.submitqueue.speculator.SpeculationSignal + 9, // 3: uber.devexp.submitqueue.speculator.SpeculationSignalResponse.results:type_name -> uber.devexp.submitqueue.speculator.SpeculationPathResult + 8, // 4: uber.devexp.submitqueue.speculator.SpeculationPathResult.path:type_name -> uber.devexp.submitqueue.speculator.SpeculationPath + 1, // 5: uber.devexp.submitqueue.speculator.SpeculationPathResult.action:type_name -> uber.devexp.submitqueue.speculator.SpeculationAction + 2, // 6: uber.devexp.submitqueue.speculator.SubmitQueueSpeculator.Ping:input_type -> uber.devexp.submitqueue.speculator.PingRequest + 4, // 7: uber.devexp.submitqueue.speculator.SubmitQueueSpeculator.Speculate:input_type -> uber.devexp.submitqueue.speculator.SpeculationRequest + 6, // 8: uber.devexp.submitqueue.speculator.SubmitQueueSpeculator.Signal:input_type -> uber.devexp.submitqueue.speculator.SpeculationSignalRequest + 3, // 9: uber.devexp.submitqueue.speculator.SubmitQueueSpeculator.Ping:output_type -> uber.devexp.submitqueue.speculator.PingResponse + 5, // 10: uber.devexp.submitqueue.speculator.SubmitQueueSpeculator.Speculate:output_type -> uber.devexp.submitqueue.speculator.SpeculationResponse + 7, // 11: uber.devexp.submitqueue.speculator.SubmitQueueSpeculator.Signal:output_type -> uber.devexp.submitqueue.speculator.SpeculationSignalResponse + 9, // [9:12] is the sub-list for method output_type + 6, // [6:9] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_speculator_proto_init() } @@ -193,13 +699,14 @@ func file_speculator_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_speculator_proto_rawDesc), len(file_speculator_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, + NumEnums: 2, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, GoTypes: file_speculator_proto_goTypes, DependencyIndexes: file_speculator_proto_depIdxs, + EnumInfos: file_speculator_proto_enumTypes, MessageInfos: file_speculator_proto_msgTypes, }.Build() File_speculator_proto = out.File diff --git a/speculator/protopb/speculator.pb.yarpc.go b/speculator/protopb/speculator.pb.yarpc.go index 2c273555..9f760425 100644 --- a/speculator/protopb/speculator.pb.yarpc.go +++ b/speculator/protopb/speculator.pb.yarpc.go @@ -23,6 +23,8 @@ var _ = ioutil.NopCloser // SubmitQueueSpeculatorYARPCClient is the YARPC client-side interface for the SubmitQueueSpeculator service. type SubmitQueueSpeculatorYARPCClient interface { Ping(context.Context, *PingRequest, ...yarpc.CallOption) (*PingResponse, error) + Speculate(context.Context, *SpeculationRequest, ...yarpc.CallOption) (*SpeculationResponse, error) + Signal(context.Context, *SpeculationSignalRequest, ...yarpc.CallOption) (*SpeculationSignalResponse, error) } func newSubmitQueueSpeculatorYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) SubmitQueueSpeculatorYARPCClient { @@ -44,6 +46,8 @@ func NewSubmitQueueSpeculatorYARPCClient(clientConfig transport.ClientConfig, op // SubmitQueueSpeculatorYARPCServer is the YARPC server-side interface for the SubmitQueueSpeculator service. type SubmitQueueSpeculatorYARPCServer interface { Ping(context.Context, *PingRequest) (*PingResponse, error) + Speculate(context.Context, *SpeculationRequest) (*SpeculationResponse, error) + Signal(context.Context, *SpeculationSignalRequest) (*SpeculationSignalResponse, error) } type buildSubmitQueueSpeculatorYARPCProceduresParams struct { @@ -67,6 +71,26 @@ func buildSubmitQueueSpeculatorYARPCProcedures(params buildSubmitQueueSpeculator }, ), }, + { + MethodName: "Speculate", + Handler: protobuf.NewUnaryHandler( + protobuf.UnaryHandlerParams{ + Handle: handler.Speculate, + NewRequest: newSubmitQueueSpeculatorServiceSpeculateYARPCRequest, + AnyResolver: params.AnyResolver, + }, + ), + }, + { + MethodName: "Signal", + Handler: protobuf.NewUnaryHandler( + protobuf.UnaryHandlerParams{ + Handle: handler.Signal, + NewRequest: newSubmitQueueSpeculatorServiceSignalYARPCRequest, + AnyResolver: params.AnyResolver, + }, + ), + }, }, OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{}, StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{}, @@ -197,6 +221,30 @@ func (c *_SubmitQueueSpeculatorYARPCCaller) Ping(ctx context.Context, request *P return response, err } +func (c *_SubmitQueueSpeculatorYARPCCaller) Speculate(ctx context.Context, request *SpeculationRequest, options ...yarpc.CallOption) (*SpeculationResponse, error) { + responseMessage, err := c.streamClient.Call(ctx, "Speculate", request, newSubmitQueueSpeculatorServiceSpeculateYARPCResponse, options...) + if responseMessage == nil { + return nil, err + } + response, ok := responseMessage.(*SpeculationResponse) + if !ok { + return nil, protobuf.CastError(emptySubmitQueueSpeculatorServiceSpeculateYARPCResponse, responseMessage) + } + return response, err +} + +func (c *_SubmitQueueSpeculatorYARPCCaller) Signal(ctx context.Context, request *SpeculationSignalRequest, options ...yarpc.CallOption) (*SpeculationSignalResponse, error) { + responseMessage, err := c.streamClient.Call(ctx, "Signal", request, newSubmitQueueSpeculatorServiceSignalYARPCResponse, options...) + if responseMessage == nil { + return nil, err + } + response, ok := responseMessage.(*SpeculationSignalResponse) + if !ok { + return nil, protobuf.CastError(emptySubmitQueueSpeculatorServiceSignalYARPCResponse, responseMessage) + } + return response, err +} + type _SubmitQueueSpeculatorYARPCHandler struct { server SubmitQueueSpeculatorYARPCServer } @@ -217,6 +265,38 @@ func (h *_SubmitQueueSpeculatorYARPCHandler) Ping(ctx context.Context, requestMe return response, err } +func (h *_SubmitQueueSpeculatorYARPCHandler) Speculate(ctx context.Context, requestMessage proto.Message) (proto.Message, error) { + var request *SpeculationRequest + var ok bool + if requestMessage != nil { + request, ok = requestMessage.(*SpeculationRequest) + if !ok { + return nil, protobuf.CastError(emptySubmitQueueSpeculatorServiceSpeculateYARPCRequest, requestMessage) + } + } + response, err := h.server.Speculate(ctx, request) + if response == nil { + return nil, err + } + return response, err +} + +func (h *_SubmitQueueSpeculatorYARPCHandler) Signal(ctx context.Context, requestMessage proto.Message) (proto.Message, error) { + var request *SpeculationSignalRequest + var ok bool + if requestMessage != nil { + request, ok = requestMessage.(*SpeculationSignalRequest) + if !ok { + return nil, protobuf.CastError(emptySubmitQueueSpeculatorServiceSignalYARPCRequest, requestMessage) + } + } + response, err := h.server.Signal(ctx, request) + if response == nil { + return nil, err + } + return response, err +} + func newSubmitQueueSpeculatorServicePingYARPCRequest() proto.Message { return &PingRequest{} } @@ -225,31 +305,75 @@ func newSubmitQueueSpeculatorServicePingYARPCResponse() proto.Message { return &PingResponse{} } +func newSubmitQueueSpeculatorServiceSpeculateYARPCRequest() proto.Message { + return &SpeculationRequest{} +} + +func newSubmitQueueSpeculatorServiceSpeculateYARPCResponse() proto.Message { + return &SpeculationResponse{} +} + +func newSubmitQueueSpeculatorServiceSignalYARPCRequest() proto.Message { + return &SpeculationSignalRequest{} +} + +func newSubmitQueueSpeculatorServiceSignalYARPCResponse() proto.Message { + return &SpeculationSignalResponse{} +} + var ( - emptySubmitQueueSpeculatorServicePingYARPCRequest = &PingRequest{} - emptySubmitQueueSpeculatorServicePingYARPCResponse = &PingResponse{} + emptySubmitQueueSpeculatorServicePingYARPCRequest = &PingRequest{} + emptySubmitQueueSpeculatorServicePingYARPCResponse = &PingResponse{} + emptySubmitQueueSpeculatorServiceSpeculateYARPCRequest = &SpeculationRequest{} + emptySubmitQueueSpeculatorServiceSpeculateYARPCResponse = &SpeculationResponse{} + emptySubmitQueueSpeculatorServiceSignalYARPCRequest = &SpeculationSignalRequest{} + emptySubmitQueueSpeculatorServiceSignalYARPCResponse = &SpeculationSignalResponse{} ) var yarpcFileDescriptorClosure4a6246af296c2143 = [][]byte{ // speculator.proto []byte{ - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xc1, 0x4a, 0x33, 0x31, - 0x10, 0xc7, 0xbf, 0x7c, 0x2d, 0x6a, 0xa7, 0x05, 0x25, 0x20, 0x2c,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xc0, - 0xce, 0x3d, 0xff, 0xb7, 0x58, 0xc3, 0x4d, 0xe5, 0xec, 0x11, 0xe0, 0xe2, 0xbc, 0x5f, 0xb1, 0xe8, - 0xce, 0x52, 0xb0, 0x67, 0x51, 0x9b, 0xb0, 0x8a, 0x5a, 0x54, 0xce, 0xca, 0x6e, 0x82, 0x3c, 0x40, - 0x65, 0x8f, 0xca, 0x74, 0x46, 0xaf, 0xf5, 0x49, 0x7a, 0x3c, 0x7c, 0x05, 0x00, 0x00, 0xff, 0xff, - 0x84, 0xb6, 0x23, 0xbd, 0xe3, 0x01, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4b, 0x6f, 0xd3, 0x4c, + 0x14, 0xed, 0xc4, 0xe9, 0x23, 0x37, 0xd5, 0x57, 0x7f, 0x03, 0x95, 0xdc, 0x07, 0x34, 0x0c, 0xa2, + 0x84, 0x2e, 0x1c, 0x94, 0x0a, 0x10, 0x12, 0x2c, 0xdc, 0xc4, 0xad, 0x2c, 0x85, 0x10, 0x6c, 0xb2, + 0xe9, 0x26, 0x72, 0x9c, 0x51, 0x62, 0x5a, 0x3f, 0x9a, 0x19, 0x57, 0xac, 0xd8, 0x21, 0x76, 0xec, + 0xf8, 0x23, 0xfc, 0x07, 0x7e, 0x17, 0xc8, 0x13, 0x3b, 0x8f, 0xe2, 0x96, 0x26, 0x82, 0x55, 0x32, + 0x73, 0xcf, 0x3d, 0xf7, 0xcc, 0x3d, 0xd7, 0x33, 0x20, 0xb3, 0x90, 0x3a, 0xd1, 0xb9, 0xcd, 0x83, + 0xa1, 0x1a, 0x0e, 0x03, 0x1e, 0x60, 0x12, 0x75, 0xe9, 0x50, 0xed, 0xd1, 0x4b, 0xfa, 0x31, 0x54, + 0x59, 0xd4, 0xf5, 0x5c, 0x7e, 0x11, 0xd1, 0x88, 0xaa, 0x13, 0x24, 0x79, 0x0c, 0xc5, 0x96, 0x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 0x60, 0xd4, 0x9f, 0xab, + 0x1d, 0xd0, 0x6a, 0xe2, 0x67, 0xb6, 0x03, 0xbb, 0xa0, 0x64, 0x60, 0x84, 0x62, 0x19, 0xe1, 0x7b, + 0xb0, 0x95, 0x11, 0x1d, 0x9d, 0x58, 0xce, 0xe1, 0x3d, 0xd8, 0xc9, 0x08, 0xa7, 0xf2, 0x64, 0xa9, + 0xfa, 0x55, 0x82, 0x4d, 0x4b, 0xd8, 0xf9, 0x2e, 0xb6, 0xd3, 0x1a, 0xbb, 0x89, 0xcf, 0x20, 0x1f, + 0xdf, 0x9a, 0xb8, 0x72, 0x1b, 0xeb, 0xa7, 0x6e, 0xe2, 0xed, 0xa7, 0xb7, 0x4f, 0x18, 0x7d, 0x86, + 0x64, 0x09, 0x7f, 0x82, 0x42, 0x5a, 0x9a, 0xe2, 0xe7, 0x73, 0x0e, 0x5b, 0x5a, 0xf8, 0xc5, 0xdc, + 0x79, 0xe3, 0xfa, 0x5f, 0x10, 0xac, 0x24, 0x53, 0xf9, 0x6a, 0xb1, 0xfb, 0x26, 0xd1, 0xf0, 0x7a, + 0xc1, 0xec, 0x54, 0xc9, 0xd1, 0x19, 0xec, 0x3b, 0x81, 0x77, 0x0b, 0x96, 0xa3, 0x8d, 0x89, 0x59, + 0xad, 0xf8, 0xd5, 0x6c, 0xa1, 0x53, 0xb5, 0xef, 0xf2, 0x41, 0xd4, 0x55, 0x9d, 0xc0, 0xab, 0xc4, + 0x0c, 0x95, 0xa9, 0xd4, 0xca, 0x24, 0xb5, 0x22, 0x5e, 0xd9, 0xb0, 0xdb, 0x5d, 0x11, 0x7f, 0x0e, + 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x21, 0xf3, 0x99, 0x82, 0x07, 0x00, 0x00, }, } diff --git a/speculator/protopb/speculator_grpc.pb.go b/speculator/protopb/speculator_grpc.pb.go index 0713e3da..d88e130c 100644 --- a/speculator/protopb/speculator_grpc.pb.go +++ b/speculator/protopb/speculator_grpc.pb.go @@ -19,17 +19,28 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - SubmitQueueSpeculator_Ping_FullMethodName = "/uber.devexp.submitqueue.speculator.SubmitQueueSpeculator/Ping" + SubmitQueueSpeculator_Ping_FullMethodName = "/uber.devexp.submitqueue.speculator.SubmitQueueSpeculator/Ping" + SubmitQueueSpeculator_Speculate_FullMethodName = "/uber.devexp.submitqueue.speculator.SubmitQueueSpeculator/Speculate" + SubmitQueueSpeculator_Signal_FullMethodName = "/uber.devexp.submitqueue.speculator.SubmitQueueSpeculator/Signal" ) // SubmitQueueSpeculatorClient is the client API for SubmitQueueSpeculator service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // -// SubmitQueueSpeculator provides the speculator API +// SubmitQueueSpeculator service provides APIs for speculating, signaling, and receiving speculation results for batches +// in the submit queue, allowing clients to make informed decisions about which batches to trigger builds for, cancel, +// or finalize based on the speculation results and signals received for different speculation paths type SubmitQueueSpeculatorClient interface { // Ping returns a response indicating the service is alive Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) + // Speculate takes a SpeculationRequest containing information about a batch and its dependencies + // and returns a SpeculationResponse + Speculate(ctx context.Context, in *SpeculationRequest, opts ...grpc.CallOption) (*SpeculationResponse, error) + // Signal takes a SpeculationSignalRequest containing a speculation path and a speculation signal for that path, + // and returns a SpeculationSignalResponse containing updated speculation results for the batch based on the + // received signal + Signal(ctx context.Context, in *SpeculationSignalRequest, opts ...grpc.CallOption) (*SpeculationSignalResponse, error) } type submitQueueSpeculatorClient struct { @@ -50,14 +61,43 @@ func (c *submitQueueSpeculatorClient) Ping(ctx context.Context, in *PingRequest, return out, nil } +func (c *submitQueueSpeculatorClient) Speculate(ctx context.Context, in *SpeculationRequest, opts ...grpc.CallOption) (*SpeculationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SpeculationResponse) + err := c.cc.Invoke(ctx, SubmitQueueSpeculator_Speculate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *submitQueueSpeculatorClient) Signal(ctx context.Context, in *SpeculationSignalRequest, opts ...grpc.CallOption) (*SpeculationSignalResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SpeculationSignalResponse) + err := c.cc.Invoke(ctx, SubmitQueueSpeculator_Signal_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // SubmitQueueSpeculatorServer is the server API for SubmitQueueSpeculator service. // All implementations must embed UnimplementedSubmitQueueSpeculatorServer // for forward compatibility. // -// SubmitQueueSpeculator provides the speculator API +// SubmitQueueSpeculator service provides APIs for speculating, signaling, and receiving speculation results for batches +// in the submit queue, allowing clients to make informed decisions about which batches to trigger builds for, cancel, +// or finalize based on the speculation results and signals received for different speculation paths type SubmitQueueSpeculatorServer interface { // Ping returns a response indicating the service is alive Ping(context.Context, *PingRequest) (*PingResponse, error) + // Speculate takes a SpeculationRequest containing information about a batch and its dependencies + // and returns a SpeculationResponse + Speculate(context.Context, *SpeculationRequest) (*SpeculationResponse, error) + // Signal takes a SpeculationSignalRequest containing a speculation path and a speculation signal for that path, + // and returns a SpeculationSignalResponse containing updated speculation results for the batch based on the + // received signal + Signal(context.Context, *SpeculationSignalRequest) (*SpeculationSignalResponse, error) mustEmbedUnimplementedSubmitQueueSpeculatorServer() } @@ -71,6 +111,12 @@ type UnimplementedSubmitQueueSpeculatorServer struct{} func (UnimplementedSubmitQueueSpeculatorServer) Ping(context.Context, *PingRequest) (*PingResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") } +func (UnimplementedSubmitQueueSpeculatorServer) Speculate(context.Context, *SpeculationRequest) (*SpeculationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Speculate not implemented") +} +func (UnimplementedSubmitQueueSpeculatorServer) Signal(context.Context, *SpeculationSignalRequest) (*SpeculationSignalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Signal not implemented") +} func (UnimplementedSubmitQueueSpeculatorServer) mustEmbedUnimplementedSubmitQueueSpeculatorServer() {} func (UnimplementedSubmitQueueSpeculatorServer) testEmbeddedByValue() {} @@ -110,6 +156,42 @@ func _SubmitQueueSpeculator_Ping_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _SubmitQueueSpeculator_Speculate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SpeculationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubmitQueueSpeculatorServer).Speculate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubmitQueueSpeculator_Speculate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubmitQueueSpeculatorServer).Speculate(ctx, req.(*SpeculationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubmitQueueSpeculator_Signal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SpeculationSignalRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubmitQueueSpeculatorServer).Signal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubmitQueueSpeculator_Signal_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubmitQueueSpeculatorServer).Signal(ctx, req.(*SpeculationSignalRequest)) + } + return interceptor(ctx, in, info, handler) +} + // SubmitQueueSpeculator_ServiceDesc is the grpc.ServiceDesc for SubmitQueueSpeculator service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -121,6 +203,14 @@ var SubmitQueueSpeculator_ServiceDesc = grpc.ServiceDesc{ MethodName: "Ping", Handler: _SubmitQueueSpeculator_Ping_Handler, }, + { + MethodName: "Speculate", + Handler: _SubmitQueueSpeculator_Speculate_Handler, + }, + { + MethodName: "Signal", + Handler: _SubmitQueueSpeculator_Signal_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "speculator.proto",