Debian Codegraph @

api/v0/mesosproto/messages.proto

raw
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package mesosproto;
20
21 import "mesos.proto";
22 import "github.com/gogo/protobuf/gogoproto/gogo.proto";
23
24 option (gogoproto.gostring_all) = true;
25 option (gogoproto.equal_all) = true;
26 option (gogoproto.verbose_equal_all) = true;
27 option (gogoproto.goproto_stringer_all) = false;
28 option (gogoproto.stringer_all) = true;
29 option (gogoproto.populate_all) = true;
30 option (gogoproto.testgen_all) = true;
31 option (gogoproto.benchgen_all) = true;
32 option (gogoproto.marshaler_all) = true;
33 option (gogoproto.sizer_all) = true;
34 option (gogoproto.unmarshaler_all) = true;
35
36 // TODO(benh): Consider splitting these messages into different "packages"
37 // which represent which messages get handled by which components (e.g., the
38 // "mesos.executor" package includes messages that the executor handles).
39
40
41 // TODO(bmahler): Add executor_uuid here, and send it to the master. This will
42 // allow us to expose executor work directories for tasks in the webui when
43 // looking from the master level. Currently only the slave knows which run the
44 // task belongs to.
45 /**
46 * Describes a task, similar to `TaskInfo`.
47 *
48 * `Task` is used in some of the Mesos messages found below.
49 * `Task` is used instead of `TaskInfo` if:
50 * 1) we need additional IDs, such as a specific
51 * framework, executor, or agent; or
52 * 2) we do not need the additional data, such as the command run by the
53 * task, the specific containerization, or health checks. These
54 * additional fields may be large and unnecessary for some Mesos messages.
55 *
56 * `Task` is generally constructed from a `TaskInfo`. See protobuf::createTask.
57 */
58 message Task {
59 required string name = 1;
60 required TaskID task_id = 2;
61 required FrameworkID framework_id = 3;
62 optional ExecutorID executor_id = 4;
63 required SlaveID slave_id = 5;
64 required TaskState state = 6; // Latest state of the task.
65 repeated Resource resources = 7;
66 repeated TaskStatus statuses = 8;
67
68 // These fields correspond to the state and uuid of the latest
69 // status update forwarded to the master.
70 // NOTE: Either both the fields must be set or both must be unset.
71 optional TaskState status_update_state = 9;
72 optional bytes status_update_uuid = 10;
73
74 optional Labels labels = 11;
75
76 // Service discovery information for the task. It is not interpreted
77 // or acted upon by Mesos. It is up to a service discovery system
78 // to use this information as needed and to handle tasks without
79 // service discovery information.
80 optional DiscoveryInfo discovery = 12;
81 }
82
83
84 // TODO(vinod): Create a new UUID message type.
85 /**
86 * Describes a task's status.
87 *
88 * `StatusUpdate` is used in some of the Mesos messages found below.
89 * The master and agent use `StatusUpdate` to wrap a `TaskStatus` when
90 * passing it from the agent to the framework that spawned the task.
91 *
92 * See protobuf::createStatusUpdate.
93 */
94 message StatusUpdate {
95 required FrameworkID framework_id = 1;
96 optional ExecutorID executor_id = 2;
97 optional SlaveID slave_id = 3;
98
99 // Since 0.23.0 we set 'status.uuid' in the executor
100 // driver for all retryable status updates.
101 required TaskStatus status = 4;
102
103 required double timestamp = 5;
104
105 // Since 0.26.0 this is deprecated in favor of 'status.uuid'.
106 optional bytes uuid = 6;
107
108 // This corresponds to the latest state of the task according to the
109 // agent. Note that this state might be different than the state in
110 // 'status' because status update manager queues updates. In other
111 // words, 'status' corresponds to the update at top of the queue and
112 // 'latest_state' corresponds to the update at bottom of the queue.
113 optional TaskState latest_state = 7;
114 }
115
116
117 /**
118 * Encapsulates how we checkpoint a `StatusUpdate` to disk.
119 *
120 * See the StatusUpdateManager and slave/state.cpp.
121 */
122 message StatusUpdateRecord {
123 enum Type {
124 UPDATE = 0;
125 ACK = 1;
126 }
127
128 required Type type = 1;
129
130 // Required if type == UPDATE.
131 optional StatusUpdate update = 2;
132
133 // Required if type == ACK.
134 optional bytes uuid = 3;
135 }
136
137
138 // TODO(josephw): Check if this can be removed. This appears to be
139 // for backwards compatibility with very early versions of Mesos.
140 message SubmitSchedulerRequest
141 {
142 required string name = 1;
143 }
144
145
146 // TODO(josephw): Remove for the same reason as `SubmitSchedulerRequest`.
147 message SubmitSchedulerResponse
148 {
149 required bool okay = 1;
150 }
151
152
153 /**
154 * Sends a free-form message from the executor to the framework.
155 * Mesos forwards the message, if necessary, via the agents and the master.
156 *
157 * See scheduler::Event::Message.
158 */
159 message ExecutorToFrameworkMessage {
160 required SlaveID slave_id = 1;
161 required FrameworkID framework_id = 2;
162 required ExecutorID executor_id = 3;
163 required bytes data = 4;
164 }
165
166
167 /**
168 * Sends a free-form message from the framework to the executor.
169 * Mesos forwards the message, if necessary, via the agents and the master.
170 *
171 * See scheduler::Call::Message.
172 */
173 message FrameworkToExecutorMessage {
174 required SlaveID slave_id = 1;
175 required FrameworkID framework_id = 2;
176 required ExecutorID executor_id = 3;
177 required bytes data = 4;
178 }
179
180
181 /**
182 * Subscribes the framework with the master to receive events.
183 *
184 * Used by the pre-Event/Call Mesos scheduler driver.
185 * See scheduler::Call::Subscribe.
186 */
187 message RegisterFrameworkMessage {
188 required FrameworkInfo framework = 1;
189 }
190
191
192 /**
193 * Subscribes the framework with the master to receive events.
194 * This is used when the framework has previously registered and
195 * the master changes to a newly elected master.
196 *
197 * Used by the pre-Event/Call Mesos scheduler driver.
198 * See scheduler::Call::Subscribe.
199 */
200 message ReregisterFrameworkMessage {
201 required FrameworkInfo framework = 2;
202 required bool failover = 3;
203 }
204
205
206 /**
207 * Notifies the framework that the master has registered it.
208 * The `framework_id` holds a unique ID for distinguishing this framework.
209 *
210 * See scheduler::Event::Subscribed.
211 */
212 message FrameworkRegisteredMessage {
213 required FrameworkID framework_id = 1;
214 required MasterInfo master_info = 2;
215 }
216
217
218 /**
219 * Notifies the framework that the master has reregistered it.
220 * This message is used in the same conditions as `ReregisterFrameworkMessage`.
221 *
222 * See scheduler::Event::Subscribed.
223 */
224 message FrameworkReregisteredMessage {
225 required FrameworkID framework_id = 1;
226 required MasterInfo master_info = 2;
227 }
228
229
230 /**
231 * Stops the framework and shuts down all its tasks and executors.
232 *
233 * Used by the pre-Event/Call Mesos scheduler driver.
234 * See scheduler::Call::Teardown.
235 */
236 message UnregisterFrameworkMessage {
237 required FrameworkID framework_id = 1;
238 }
239
240
241 /**
242 * Aborts the scheduler driver and prevents further callbacks to the driver.
243 *
244 * Used exclusively by the pre-Event/Call Mesos scheduler driver.
245 */
246 message DeactivateFrameworkMessage {
247 required FrameworkID framework_id = 1;
248 }
249
250
251 /**
252 * Requests specific resources from Mesos's allocator.
253 * If the allocator supports resource requests, any corresponding
254 * resources will be sent like a normal resource offer.
255 *
256 * Used by the pre-Event/Call Mesos scheduler driver.
257 * See scheduler::Call::Request.
258 */
259 message ResourceRequestMessage {
260 required FrameworkID framework_id = 1;
261 repeated Request requests = 2;
262 }
263
264
265 /**
266 * Sends resources offers to the scheduler.
267 *
268 * See scheduler::Event::Offers.
269 */
270 message ResourceOffersMessage {
271 repeated Offer offers = 1;
272 repeated string pids = 2;
273
274 // The `inverse_offers` field is added here because we currently use it in
275 // `master.cpp` when constructing the message to send to schedulers. We use
276 // the original version of the proto API until we do a full refactor of all
277 // the messages being sent.
278 // It is not fully implemented in the old scheduler; only the V1 scheduler
279 // currently implements inverse offers.
280 repeated InverseOffer inverse_offers = 3;
281 }
282
283
284 /**
285 * Launches tasks using resources from the specified offers.
286 *
287 * Used by the pre-Event/Call Mesos scheduler driver.
288 * See scheduler::Call::Accept and scheduler::Call::Decline.
289 */
290 message LaunchTasksMessage {
291 required FrameworkID framework_id = 1;
292 repeated TaskInfo tasks = 3;
293 required Filters filters = 5;
294 repeated OfferID offer_ids = 6;
295 }
296
297
298 /**
299 * Notifies the scheduler that a particular offer is not longer valid.
300 *
301 * See scheduler::Event::Rescind.
302 */
303 message RescindResourceOfferMessage {
304 required OfferID offer_id = 1;
305 }
306
307
308 /**
309 * Removes all filters previously set by the scheduler.
310 *
311 * Used by the pre-Event/Call Mesos scheduler driver.
312 * See scheduler::Call::Revive.
313 */
314 message ReviveOffersMessage {
315 required FrameworkID framework_id = 1;
316 }
317
318
319 /**
320 * Depending on the `TaskInfo`, this message either notifies an existing
321 * executor to run the task, or starts a new executor and runs the task.
322 * This message is sent when scheduler::Call::Accept is sent with
323 * Offer::Operation::Launch.
324 *
325 * See executor::Event::Launch.
326 */
327 message RunTaskMessage {
328 // TODO(karya): Remove framework_id after MESOS-2559 has shipped.
329 optional FrameworkID framework_id = 1 [deprecated = true];
330 required FrameworkInfo framework = 2;
331 required TaskInfo task = 4;
332
333 // The pid of the framework. This was moved to 'optional' in
334 // 0.24.0 to support schedulers using the HTTP API. For now, we
335 // continue to always set pid since it was required in 0.23.x.
336 // When 'pid' is unset, or set to empty string, the agent will
337 // forward executor messages through the master. For schedulers
338 // still using the driver, this will remain set.
339 optional string pid = 3;
340 }
341
342
343 /**
344 * Kills a specific task.
345 *
346 * See scheduler::Call::Kill and executor::Event::Kill.
347 */
348 message KillTaskMessage {
349 // TODO(bmahler): Include the SlaveID here to improve the Master's
350 // ability to respond for non-activated agents.
351 required FrameworkID framework_id = 1;
352 required TaskID task_id = 2;
353 }
354
355
356 /**
357 * Sends a task status update to the scheduler.
358 *
359 * See scheduler::Event::Update.
360 */
361 message StatusUpdateMessage {
362 required StatusUpdate update = 1;
363
364 // If present, scheduler driver automatically sends an acknowledgement
365 // to the `pid`. This only applies to the pre-Event/Call Mesos
366 // scheduler driver.
367 optional string pid = 2;
368 }
369
370
371 /**
372 * This message is used by the scheduler to acknowledge the receipt of a status
373 * update. Mesos forwards the acknowledgement to the executor running the task.
374 *
375 * See scheduler::Call::Acknowledge and executor::Event::Acknowledged.
376 */
377 message StatusUpdateAcknowledgementMessage {
378 required SlaveID slave_id = 1;
379 required FrameworkID framework_id = 2;
380 required TaskID task_id = 3;
381 required bytes uuid = 4;
382 }
383
384
385 /**
386 * Notifies the scheduler that the agent was lost.
387 *
388 * See scheduler::Event::Failure.
389 */
390 message LostSlaveMessage {
391 required SlaveID slave_id = 1;
392 }
393
394
395 /**
396 * Allows the scheduler to query the status for non-terminal tasks.
397 * This causes the master to send back the latest task status for
398 * each task in `statuses`, if possible. Tasks that are no longer
399 * known will result in a `TASK_LOST` update. If `statuses` is empty,
400 * then the master will send the latest status for each task
401 * currently known.
402 */
403 message ReconcileTasksMessage {
404 required FrameworkID framework_id = 1;
405 repeated TaskStatus statuses = 2; // Should be non-terminal only.
406 }
407
408
409 /**
410 * Notifies the framework about errors during registration.
411 *
412 * See scheduler::Event::Error.
413 */
414 message FrameworkErrorMessage {
415 required string message = 2;
416 }
417
418
419 /**
420 * Registers the agent with the master.
421 *
422 * If registration fails, a `ShutdownMessage` is sent to the agent.
423 * Failure conditions are documented inline in Master::registerSlave.
424 */
425 message RegisterSlaveMessage {
426 required SlaveInfo slave = 1;
427
428 // Resources that are checkpointed by the agent (e.g., persistent
429 // volume or dynamic reservation). Frameworks need to release
430 // checkpointed resources explicitly.
431 repeated Resource checkpointed_resources = 3;
432
433 // NOTE: This is a hack for the master to detect the agent's
434 // version. If unset the agent is < 0.21.0.
435 // TODO(bmahler): Do proper versioning: MESOS-986.
436 optional string version = 2;
437 }
438
439
440 /**
441 * Registers the agent with the master.
442 * This is used when the agent has previously registered and
443 * the master changes to a newly elected master.
444 *
445 * If registration fails, a `ShutdownMessage` is sent to the agent.
446 * Failure conditions are documented inline in Master::reregisterSlave.
447 */
448 message ReregisterSlaveMessage {
449 required SlaveInfo slave = 2;
450
451 // Resources that are checkpointed by the agent (e.g., persistent
452 // volume or dynamic reservation). Frameworks need to release
453 // checkpointed resources explicitly.
454 repeated Resource checkpointed_resources = 7;
455
456 repeated ExecutorInfo executor_infos = 4;
457 repeated Task tasks = 3;
458 repeated Archive.Framework completed_frameworks = 5;
459
460 // NOTE: This is a hack for the master to detect the agent's
461 // version. If unset the agent is < 0.21.0.
462 // TODO(bmahler): Do proper versioning: MESOS-986.
463 optional string version = 6;
464 }
465
466
467 /**
468 * Notifies the agent that the master has registered it.
469 * The `slave_id` holds a unique ID for distinguishing this agent.
470 */
471 message SlaveRegisteredMessage {
472 required SlaveID slave_id = 1;
473 optional MasterSlaveConnection connection = 2;
474 }
475
476
477 /**
478 * Notifies the agent that the master has reregistered it.
479 * This message is used in the same conditions as `ReregisterSlaveMessage`.
480 */
481 message SlaveReregisteredMessage {
482 required SlaveID slave_id = 1;
483
484 // Contains a list of non-terminal tasks that the master believes to
485 // be running on the agent. The agent should respond `TASK_LOST` to
486 // any tasks that are unknown, so the master knows to remove those.
487 repeated ReconcileTasksMessage reconciliations = 2;
488
489 optional MasterSlaveConnection connection = 3;
490 }
491
492
493 /**
494 * This message is sent by the agent to the master during agent shutdown.
495 * The master updates its state to reflect the removed agent.
496 */
497 message UnregisterSlaveMessage {
498 required SlaveID slave_id = 1;
499 }
500
501
502 /**
503 * Describes the connection between the master and agent.
504 */
505 message MasterSlaveConnection {
506 // Product of max_slave_ping_timeouts * slave_ping_timeout.
507 // If no pings are received within the total timeout,
508 // the master will remove the agent.
509 optional double total_ping_timeout_seconds = 1;
510 }
511
512
513 /**
514 * This message is periodically sent by the master to the agent.
515 * If the agent is connected to the master, "connected" is true.
516 */
517 message PingSlaveMessage {
518 required bool connected = 1;
519 }
520
521
522 /**
523 * This message is sent by the agent to the master in response to the
524 * `PingSlaveMessage`.
525 */
526 message PongSlaveMessage {}
527
528
529 /**
530 * Tells an agent to shut down all executors of the given framework.
531 */
532 message ShutdownFrameworkMessage {
533 required FrameworkID framework_id = 1;
534 }
535
536
537 /**
538 * Tells an agent (and consequently the executor) to shutdown an executor.
539 */
540 message ShutdownExecutorMessage {
541 // TODO(vinod): Make these fields required. These are made optional
542 // for backwards compatibility between 0.23.0 agent and pre 0.23.0
543 // executor driver.
544 optional ExecutorID executor_id = 1;
545 optional FrameworkID framework_id = 2;
546 }
547
548
549 /**
550 * Broadcasts updated framework information from master to all agents.
551 */
552 message UpdateFrameworkMessage {
553 required FrameworkID framework_id = 1;
554
555 // See the comment on RunTaskMessage.pid.
556 optional string pid = 2;
557 }
558
559
560 /**
561 * This message is sent to the agent whenever there is an update of
562 * the resources that need to be checkpointed (e.g., persistent volume
563 * or dynamic reservation).
564 */
565 message CheckpointResourcesMessage {
566 repeated Resource resources = 1;
567 }
568
569
570 /**
571 * This message is sent by the agent to the master to inform the
572 * master about the total amount of oversubscribed (allocated and
573 * allocatable) resources.
574 */
575 message UpdateSlaveMessage {
576 required SlaveID slave_id = 1;
577 repeated Resource oversubscribed_resources = 2;
578 }
579
580
581 /**
582 * Subscribes the executor with the agent to receive events.
583 *
584 * See executor::Call::Subscribe.
585 */
586 message RegisterExecutorMessage {
587 required FrameworkID framework_id = 1;
588 required ExecutorID executor_id = 2;
589 }
590
591
592 /**
593 * Notifies the executor that the agent has registered it.
594 *
595 * See executor::Event::Subscribed.
596 */
597 message ExecutorRegisteredMessage {
598 required ExecutorInfo executor_info = 2;
599 required FrameworkID framework_id = 3;
600 required FrameworkInfo framework_info = 4;
601 required SlaveID slave_id = 5;
602 required SlaveInfo slave_info = 6;
603 }
604
605
606 /**
607 * Notifies the executor that the agent has reregistered it.
608 *
609 * See executor::Event::Subscribed.
610 */
611 message ExecutorReregisteredMessage {
612 required SlaveID slave_id = 1;
613 required SlaveInfo slave_info = 2;
614 }
615
616
617 /**
618 * Notifies the scheduler about terminated executors.
619 *
620 * See scheduler::Event::Failure.
621 */
622 message ExitedExecutorMessage {
623 required SlaveID slave_id = 1;
624 required FrameworkID framework_id = 2;
625 required ExecutorID executor_id = 3;
626 required int32 status = 4;
627 }
628
629
630 /**
631 * Reestablishes the connection between executor and agent after agent failover.
632 * This message originates from the agent.
633 */
634 message ReconnectExecutorMessage {
635 required SlaveID slave_id = 1;
636 }
637
638
639 /**
640 * Subscribes the executor with the agent to receive events.
641 * This is used after a disconnection. The executor must include
642 * any unacknowledged tasks or updates.
643 *
644 * See executor::Call::Subscribe.
645 */
646 message ReregisterExecutorMessage {
647 required ExecutorID executor_id = 1;
648 required FrameworkID framework_id = 2;
649 repeated TaskInfo tasks = 3;
650 repeated StatusUpdate updates = 4;
651 }
652
653
654 /**
655 * Sends a free-form message from the master to an agent.
656 * The agent should gracefully terminate in response, which includes
657 * shutting down all executors and tasks on the agent.
658 */
659 message ShutdownMessage {
660 optional string message = 1;
661 }
662
663
664 // TODO(adam-mesos): Move this to an 'archive' package.
665 /**
666 * Describes Completed Frameworks, etc. for archival.
667 */
668 message Archive {
669 message Framework {
670 required FrameworkInfo framework_info = 1;
671 optional string pid = 2;
672 repeated Task tasks = 3;
673 }
674 repeated Framework frameworks = 1;
675 }
676
677
678 /**
679 * Message describing task current health status that is sent by
680 * the task health checker to the command executor.
681 * The command executor reports the task status back to the
682 * on each receive. If the health checker configured failure
683 * condition meets, then `kill_task` flag will be set to true which
684 * the executor on message receive will kill the task.
685 */
686 message TaskHealthStatus {
687 required TaskID task_id = 1;
688
689 required bool healthy = 2;
690
691 // Flag to initiate task kill.
692 optional bool kill_task = 3 [default = false];
693
694 // Number of consecutive counts in current status.
695 // This will not be populated if task is healthy.
696 optional int32 consecutive_failures = 4;
697 }
698
699
700 /**
701 * Message to signal completion of an event within a module.
702 */
703 message HookExecuted {
704 optional string module = 1;
705 }