-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjob_runner.proto
More file actions
91 lines (76 loc) · 2.14 KB
/
job_runner.proto
File metadata and controls
91 lines (76 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
syntax = "proto3";
import "google/protobuf/duration.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
package job_runner;
option go_package = "pkg/api/grpc";
// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;
enum Status {
RUNNING = 0;
FAILED = 1;
TERMINATED = 2;
SUCCEEDED = 3;
}
message RunRequest {
// Name specifies Job name.
string name = 1;
// Command is the path of the command to run.
string command = 2;
// Args holds command line arguments.
repeated string args = 3;
// Env specifies the environment of the process.
// Each entry is of the form "key=value".
repeated string env = 4;
}
message RunResponse {}
message GetRequest {
// Name specifies Job name.
string name = 1;
}
message GetResponse {
// CreatedBy specifies the tenant that executed a given Job.
string created_by = 1;
// Status of a given Job.
Status status = 2;
// ExitCode of the exited process.
int32 exit_code = 3;
}
message StreamLogsRequest {
// Name specifies Job name.
string name = 1;
}
message StreamLogsResponse {
// Output represents the streamed Job logs. It is from start of Job execution.
// Contains both the stdout and stderr.
bytes output = 1;
}
message StopRequest {
// Name specifies Job name.
string name = 1;
// GracePeriod represents a period of time given to the Job to terminate gracefully.
google.protobuf.Duration grace_period = 2 [(gogoproto.stdduration) = true];
}
message StopResponse {
// Status of a given Job.
Status status = 1;
// ExitCode of the exited process.
int32 exit_code = 2;
}
message PingRequest {
string message = 1;
}
message PingResponse {
string message = 1;
}
// JobService provides functionality for managing Jobs
service JobService {
rpc Run(RunRequest) returns (RunResponse){}
rpc Get(GetRequest) returns (GetResponse){}
rpc Stop(StopRequest) returns (StopResponse){}
rpc StreamLogs(StreamLogsRequest) returns (stream StreamLogsResponse) {};
rpc Ping(PingRequest) returns (PingResponse) {};
}