-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathjob.proto
237 lines (197 loc) · 6.28 KB
/
job.proto
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
option go_package = "github.com/kubeflow/pipelines/backend/api/go_client";
package api;
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "backend/api/parameter.proto";
import "backend/api/pipeline_spec.proto";
import "backend/api/resource_reference.proto";
import "backend/api/run.proto";
import "protoc-gen-swagger/options/annotations.proto";
import "backend/api/error.proto";
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
responses: {
key: "default";
value: {
schema: {
json_schema: {
ref: ".api.Status";
}
}
}
}
// Use bearer token for authorizing access to job service.
// Kubernetes client library(https://kubernetes.io/docs/reference/using-api/client-libraries/)
// uses bearer token as default for authorization. The section below
// ensures security definition object is generated in the swagger definition.
// For more details see https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject
security_definitions: {
security: {
key: "Bearer";
value: {
type: TYPE_API_KEY;
in: IN_HEADER;
name: "authorization";
}
}
}
security: {
security_requirement: {
key: "Bearer";
value: {};
}
}
};
service JobService {
rpc CreateJob(CreateJobRequest) returns (Job) {
option (google.api.http) = {
post: "/apis/v1beta1/jobs"
body: "job"
};
}
rpc GetJob(GetJobRequest) returns (Job) {
option (google.api.http) = {
get: "/apis/v1beta1/jobs/{id}"
};
}
rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/jobs"
};
}
rpc EnableJob(EnableJobRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/apis/v1beta1/jobs/{id}/enable"
};
}
rpc DisableJob(DisableJobRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/apis/v1beta1/jobs/{id}/disable"
};
}
rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/apis/v1beta1/jobs/{id}"
};
}
}
message CreateJobRequest {
// The job to be created
Job job = 1;
}
message GetJobRequest {
// The ID of the job to be retrieved
string id = 1;
}
message ListJobsRequest {
string page_token = 1;
int32 page_size = 2;
// Can be format of "field_name", "field_name asc" or "field_name des"
// Ascending by default.
string sort_by = 3;
// What resource reference to filter on.
// E.g. If listing job for an experiment, the query string would be
// resource_reference_key.type=EXPERIMENT&resource_reference_key.id=123
ResourceKey resource_reference_key = 4;
// A base-64 encoded, JSON-serialized Filter protocol buffer (see
// filter.proto).
string filter = 5;
}
message ListJobsResponse {
// A list of jobs returned.
repeated Job jobs = 1;
int32 total_size = 3;
string next_page_token = 2;
}
message DeleteJobRequest {
// The ID of the job to be deleted
string id = 1;
}
message EnableJobRequest {
// The ID of the job to be enabled
string id = 1;
}
message DisableJobRequest {
// The ID of the job to be disabled
string id = 1;
}
// CronSchedule allow scheduling the job with unix-like cron
message CronSchedule {
// The start time of the cron job
google.protobuf.Timestamp start_time = 1;
// The end time of the cron job
google.protobuf.Timestamp end_time = 2;
// The cron string. For details how to compose a cron, visit ttps://en.wikipedia.org/wiki/Cron
string cron = 3;
}
// PeriodicSchedule allow scheduling the job periodically with certain interval
message PeriodicSchedule {
// The start time of the periodic job
google.protobuf.Timestamp start_time = 1;
// The end time of the periodic job
google.protobuf.Timestamp end_time = 2;
// The time interval between the starting time of consecutive jobs
int64 interval_second = 3;
}
// Trigger defines what starts a pipeline run.
message Trigger {
oneof trigger {
CronSchedule cron_schedule = 1;
PeriodicSchedule periodic_schedule = 2;
}
}
message Job {
// Output. Unique run ID. Generated by API server.
string id = 1;
// Required input field. Job name provided by user. Not unique.
string name = 2;
// Optional input field. Describing the purpose of the job
string description = 3;
// Required input field.
// Describing what the pipeline manifest and parameters to use
// for the scheduled job.
PipelineSpec pipeline_spec = 4;
// Optional input field. Specify which resource this run belongs to.
repeated ResourceReference resource_references = 5;
// Required input field.
// Specify how many runs can be executed concurrently. Rage [1-10]
int64 max_concurrency = 6;
// Required input field.
// Specify how a run is triggered. Support cron mode or periodic mode.
Trigger trigger = 7;
// Required input.
enum Mode {
UNKNOWN_MODE = 0;
ENABLED = 1;
// The job won't schedule any run if disabled.
DISABLED = 2;
}
Mode mode = 8;
// Output. The time this job is created.
google.protobuf.Timestamp created_at = 9;
// Output. The last time this job is updated.
google.protobuf.Timestamp updated_at = 10;
// Output. The status of the job.
// One of [Enable, Disable, Error]
string status = 11;
// In case any error happens retrieving a job field, only job ID
// and the error message is returned. Client has the flexibility of choosing
// how to handle error. This is especially useful during listing call.
string error = 12;
// Input. Whether the job is enabled or not.
bool enabled = 16;
}