Debian Codegraph @

api/v1/lib/executor/executor.proto

raw
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16
17 syntax = "proto2";
18
19 package mesos.executor;
20
21 import "github.com/mesos/mesos-go/api/v1/lib/mesos.proto";
22 import "github.com/gogo/protobuf/gogoproto/gogo.proto";
23
24 option go_package = "executor";
25 option (gogoproto.benchgen_all) = true;
26 option (gogoproto.enum_stringer_all) = true;
27 option (gogoproto.equal_all) = true;
28 option (gogoproto.goproto_enum_prefix_all) = false;
29 option (gogoproto.goproto_enum_stringer_all) = false;
30 option (gogoproto.goproto_stringer_all) = false;
31 option (gogoproto.goproto_unrecognized_all) = false;
32 option (gogoproto.gostring_all) = true;
33 option (gogoproto.marshaler_all) = true;
34 option (gogoproto.populate_all) = true;
35 option (gogoproto.protosizer_all) = true;
36 option (gogoproto.stringer_all) = true;
37 option (gogoproto.testgen_all) = true;
38 option (gogoproto.unmarshaler_all) = true;
39 option (gogoproto.verbose_equal_all) = true;
40
41 /**
42 * Executor event API.
43 *
44 * An event is described using the standard protocol buffer "union"
45 * trick, see https://developers.google.com/protocol-buffers/docs/techniques#union.
46 */
47 message Event {
48 // Possible event types, followed by message definitions if
49 // applicable.
50 enum Type {
51 // This must be the first enum value in this list, to
52 // ensure that if 'type' is not set, the default value
53 // is UNKNOWN. This enables enum values to be added
54 // in a backwards-compatible way. See: MESOS-4997.
55 UNKNOWN = 0;
56
57 SUBSCRIBED = 1; // See 'Subscribed' below.
58 LAUNCH = 2; // See 'Launch' below.
59 LAUNCH_GROUP = 8; // See 'LaunchGroup' below.
60 KILL = 3; // See 'Kill' below.
61 ACKNOWLEDGED = 4; // See 'Acknowledged' below.
62 MESSAGE = 5; // See 'Message' below.
63 ERROR = 6; // See 'Error' below.
64
65 // Received when the agent asks the executor to shutdown/kill itself.
66 // The executor is then required to kill all its active tasks, send
67 // `TASK_KILLED` status updates and gracefully exit. The executor
68 // should terminate within a `MESOS_EXECUTOR_SHUTDOWN_GRACE_PERIOD`
69 // (an environment variable set by the agent upon executor startup);
70 // it can be configured via `ExecutorInfo.shutdown_grace_period`. If
71 // the executor fails to do so, the agent will forcefully destroy the
72 // container where the executor is running. The agent would then send
73 // `TASK_LOST` updates for any remaining active tasks of this executor.
74 //
75 // NOTE: The executor must not assume that it will always be allotted
76 // the full grace period, as the agent may decide to allot a shorter
77 // period and failures / forcible terminations may occur.
78 //
79 // TODO(alexr): Consider adding a duration field into the `Shutdown`
80 // message so that the agent can communicate when a shorter period
81 // has been allotted.
82 SHUTDOWN = 7;
83
84 option (gogoproto.goproto_enum_prefix) = true;
85 }
86
87 // First event received when the executor subscribes.
88 // The 'id' field in the 'framework_info' will be set.
89 message Subscribed {
90 required ExecutorInfo executor_info = 1 [(gogoproto.nullable) = false];
91 required FrameworkInfo framework_info = 2 [(gogoproto.nullable) = false];
92 required AgentInfo agent_info = 3 [(gogoproto.nullable) = false];
93
94 // Uniquely identifies the container of an executor run.
95 optional ContainerID container_id = 4 [(gogoproto.customname) = "ContainerID"];
96 }
97
98 // Received when the framework attempts to launch a task. Once
99 // the task is successfully launched, the executor must respond with
100 // a TASK_RUNNING update (See TaskState in v1/mesos.proto).
101 message Launch {
102 required TaskInfo task = 1 [(gogoproto.nullable) = false];
103 }
104
105 // Received when the framework attempts to launch a group of tasks atomically.
106 // Similar to `Launch` above the executor must send TASK_RUNNING updates for
107 // tasks that are successfully launched.
108 message LaunchGroup {
109 required TaskGroupInfo task_group = 1 [(gogoproto.nullable) = false];
110 }
111
112 // Received when the scheduler wants to kill a specific task. Once
113 // the task is terminated, the executor should send a TASK_KILLED
114 // (or TASK_FAILED) update. The terminal update is necessary so
115 // Mesos can release the resources associated with the task.
116 message Kill {
117 required TaskID task_id = 1 [(gogoproto.nullable) = false, (gogoproto.customname) = "TaskID"];
118
119 // If set, overrides any previously specified kill policy for this task.
120 // This includes 'TaskInfo.kill_policy' and 'Executor.kill.kill_policy'.
121 // Can be used to forcefully kill a task which is already being killed.
122 optional KillPolicy kill_policy = 2;
123 }
124
125 // Received when the agent acknowledges the receipt of status
126 // update. Schedulers are responsible for explicitly acknowledging
127 // the receipt of status updates that have 'update.status().uuid()'
128 // field set. Unacknowledged updates can be retried by the executor.
129 // They should also be sent by the executor whenever it
130 // re-subscribes.
131 message Acknowledged {
132 required TaskID task_id = 1 [(gogoproto.nullable) = false, (gogoproto.customname) = "TaskID"];
133 required bytes uuid = 2 [(gogoproto.customname) = "UUID"];
134 }
135
136 // Received when a custom message generated by the scheduler is
137 // forwarded by the agent. Note that this message is not
138 // interpreted by Mesos and is only forwarded (without reliability
139 // guarantees) to the executor. It is up to the scheduler to retry
140 // if the message is dropped for any reason.
141 message Message {
142 required bytes data = 1;
143 }
144
145 // Received in case the executor sends invalid calls (e.g.,
146 // required values not set).
147 // TODO(arojas): Remove this once the old executor driver is no
148 // longer supported. With HTTP API all errors will be signaled via
149 // HTTP response codes.
150 message Error {
151 required string message = 1 [(gogoproto.nullable) = false];
152 }
153
154 // Type of the event, indicates which optional field below should be
155 // present if that type has a nested message definition.
156 // Enum fields should be optional, see: MESOS-4997.
157 optional Type type = 1 [(gogoproto.nullable) = false];
158
159 optional Subscribed subscribed = 2;
160 optional Acknowledged acknowledged = 3;
161 optional Launch launch = 4;
162 optional LaunchGroup launch_group = 8;
163 optional Kill kill = 5;
164 optional Message message = 6;
165 optional Error error = 7;
166 }
167
168
169 /**
170 * Executor call API.
171 *
172 * Like Event, a Call is described using the standard protocol buffer
173 * "union" trick (see above).
174 */
175 message Call {
176 // Possible call types, followed by message definitions if
177 // applicable.
178 enum Type {
179 // See comments above on `Event::Type` for more details on this enum value.
180 UNKNOWN = 0;
181
182 SUBSCRIBE = 1; // See 'Subscribe' below.
183 UPDATE = 2; // See 'Update' below.
184 MESSAGE = 3; // See 'Message' below.
185
186 option (gogoproto.goproto_enum_prefix) = true;
187 }
188
189 // Request to subscribe with the agent. If subscribing after a disconnection,
190 // it must include a list of all the tasks and updates which haven't been
191 // acknowledged by the scheduler.
192 message Subscribe {
193 repeated TaskInfo unacknowledged_tasks = 1 [(gogoproto.nullable) = false];
194 repeated Update unacknowledged_updates = 2 [(gogoproto.nullable) = false];
195 }
196
197 // Notifies the scheduler that a task has transitioned from one
198 // state to another. Status updates should be used by executors
199 // to reliably communicate the status of the tasks that they
200 // manage. It is crucial that a terminal update (see TaskState
201 // in v1/mesos.proto) is sent to the scheduler as soon as the task
202 // terminates, in order for Mesos to release the resources allocated
203 // to the task. It is the responsibility of the scheduler to
204 // explicitly acknowledge the receipt of a status update. See
205 // 'Acknowledged' in the 'Events' section above for the semantics.
206 message Update {
207 required TaskStatus status = 1 [(gogoproto.nullable) = false];
208 }
209
210 // Sends arbitrary binary data to the scheduler. Note that Mesos
211 // neither interprets this data nor makes any guarantees about the
212 // delivery of this message to the scheduler.
213 // See 'Message' in the 'Events' section.
214 message Message {
215 required bytes data = 2;
216 }
217
218 // Identifies the executor which generated this call.
219 required ExecutorID executor_id = 1 [(gogoproto.nullable) = false, (gogoproto.customname) = "ExecutorID"];
220 required FrameworkID framework_id = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "FrameworkID"];
221
222 // Type of the call, indicates which optional field below should be
223 // present if that type has a nested message definition.
224 // In case type is SUBSCRIBED, no message needs to be set.
225 // See comments on `Event::Type` above on the reasoning behind this
226 // field being optional.
227 optional Type type = 3 [(gogoproto.nullable) = false];
228
229 optional Subscribe subscribe = 4;
230 optional Update update = 5;
231 optional Message message = 6;
232 }