mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
executor: use grpc instead of netrpc as plugin protocol
* Added protobuf spec for executor * Seperated executor structs into their own package
This commit is contained in:
96
plugins/executor/proto/executor.proto
Normal file
96
plugins/executor/proto/executor.proto
Normal file
@@ -0,0 +1,96 @@
|
||||
syntax = "proto3";
|
||||
package hashicorp.nomad.plugins.executor.proto;
|
||||
option go_package = "proto";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "github.com/hashicorp/nomad/plugins/drivers/proto/driver.proto";
|
||||
|
||||
service Executor {
|
||||
rpc Launch(LaunchRequest) returns (LaunchResponse) {}
|
||||
rpc Wait(WaitRequest) returns (WaitResponse) {}
|
||||
rpc Shutdown(ShutdownRequest) returns (ShutdownResponse) {}
|
||||
rpc UpdateResources(UpdateResourcesRequest) returns (UpdateResourcesResponse) {}
|
||||
rpc Version(VersionRequest) returns (VersionResponse) {}
|
||||
rpc Stats(StatsRequest) returns (StatsResponse) {}
|
||||
rpc Signal(SignalRequest) returns (SignalResponse) {}
|
||||
rpc Exec(ExecRequest) returns (ExecResponse) {}
|
||||
}
|
||||
|
||||
message LaunchRequest {
|
||||
string cmd = 1;
|
||||
repeated string args = 2;
|
||||
Resources resources = 3;
|
||||
string stdout_path = 4;
|
||||
string stderr_path = 5;
|
||||
repeated string env = 6;
|
||||
string user = 7;
|
||||
string task_dir = 8;
|
||||
bool resource_limits = 9;
|
||||
bool basic_process_cgroup = 10;
|
||||
}
|
||||
|
||||
message LaunchResponse {
|
||||
ProcessState process = 1;
|
||||
}
|
||||
|
||||
message WaitRequest {}
|
||||
|
||||
message WaitResponse{
|
||||
ProcessState process = 1;
|
||||
}
|
||||
|
||||
message ShutdownRequest {
|
||||
string signal = 1;
|
||||
int64 grace_period = 2;
|
||||
}
|
||||
|
||||
message ShutdownResponse {}
|
||||
|
||||
message UpdateResourcesRequest{
|
||||
Resources resources = 1;
|
||||
}
|
||||
|
||||
message UpdateResourcesResponse {}
|
||||
|
||||
message VersionRequest {}
|
||||
|
||||
message VersionResponse{
|
||||
string version = 1;
|
||||
}
|
||||
|
||||
message StatsRequest {}
|
||||
|
||||
message StatsResponse {
|
||||
hashicorp.nomad.plugins.drivers.proto.TaskStats stats = 1;
|
||||
}
|
||||
|
||||
message SignalRequest {
|
||||
string signal = 1;
|
||||
}
|
||||
|
||||
message SignalResponse {}
|
||||
|
||||
message ExecRequest {
|
||||
google.protobuf.Timestamp deadline = 1;
|
||||
string cmd = 2;
|
||||
repeated string args = 3;
|
||||
}
|
||||
|
||||
message ExecResponse {
|
||||
bytes output = 1;
|
||||
int32 exit_code = 2;
|
||||
}
|
||||
|
||||
message Resources {
|
||||
int32 cpu = 1;
|
||||
int32 memoryMB = 2;
|
||||
int32 diskMB = 3;
|
||||
int32 iops = 4;
|
||||
}
|
||||
|
||||
message ProcessState {
|
||||
int32 pid = 1;
|
||||
int32 exit_code = 2;
|
||||
int32 signal = 3;
|
||||
google.protobuf.Timestamp time = 4;
|
||||
}
|
||||
Reference in New Issue
Block a user