mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From al...@apache.org
Subject [mesos] branch master updated: Changed operator API to notify subscribers on every status change.
Date Tue, 21 Aug 2018 09:04:58 GMT
This is an automated email from the ASF dual-hosted git repository.

alexr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 6137411  Changed operator API to notify subscribers on every status change.
6137411 is described below

commit 613741147123563f7b68e900c321e7f5db8236fe
Author: Benno Evers <bevers@mesosphere.com>
AuthorDate: Tue Aug 21 10:58:35 2018 +0200

    Changed operator API to notify subscribers on every status change.
    
    Prior to this change, the master would only send `TaskUpdated`
    messages to subscribers when the latest known task state on the
    agent changed.
    
    This implied that schedulers could not reliably wait for the status
    information corresponding to specific state updates, i.e.,
    `TASK_RUNNING`, since there is no guarantee that subscribers get
    notified during the time when this status update will be included in
    the status field.
    
    After this change, `TaskUpdated` messages are sent whenever the latest
    acknowledged state of the task changes.
    
    Review: https://reviews.apache.org/r/67575/
---
 include/mesos/master/master.proto    | 5 ++++-
 include/mesos/v1/master/master.proto | 5 ++++-
 src/master/master.cpp                | 7 +++----
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/mesos/master/master.proto b/include/mesos/master/master.proto
index 54f8412..ddb531f 100644
--- a/include/mesos/master/master.proto
+++ b/include/mesos/master/master.proto
@@ -602,7 +602,10 @@ message Event {
     // status update acknowledged by the scheduler.
     required TaskStatus status = 2;
 
-    // This is the latest state of the task according to the agent.
+    // This is the latest state of the task according to the agent,
+    // which can be more recent than `status` above but intermediate
+    // state changes may be skipped if they happen faster than the
+    // scheduler can acknowledge them.
     required TaskState state = 3;
   }
 
diff --git a/include/mesos/v1/master/master.proto b/include/mesos/v1/master/master.proto
index 12f019d..1367b48 100644
--- a/include/mesos/v1/master/master.proto
+++ b/include/mesos/v1/master/master.proto
@@ -598,7 +598,10 @@ message Event {
     // status update acknowledged by the scheduler.
     required TaskStatus status = 2;
 
-    // This is the latest state of the task according to the agent.
+    // This is the latest state of the task according to the agent,
+    // which can be more recent than `status` above but intermediate
+    // state changes may be skipped if they happen faster than the
+    // scheduler can acknowledge them.
     required TaskState state = 3;
   }
 
diff --git a/src/master/master.cpp b/src/master/master.cpp
index cc38a37..cec2041 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -10826,10 +10826,6 @@ void Master::updateTask(Task* task, const StatusUpdate& update)
   // TODO(bmahler): Check that we're not transitioning from
   // TASK_UNREACHABLE to another state.
   if (!protobuf::isTerminalState(task->state())) {
-    if (status.state() != task->state()) {
-      sendSubscribersUpdate = true;
-    }
-
     if (task->state() != updateState && framework != nullptr) {
       // When we observe a transition away from a non-terminal state,
       // decrement the relevant metric.
@@ -10852,6 +10848,9 @@ void Master::updateTask(Task* task, const StatusUpdate& update)
   if (task->statuses_size() > 0 &&
       task->statuses(task->statuses_size() - 1).state() == status.state()) {
     task->mutable_statuses()->RemoveLast();
+  } else {
+    // Send a `TASK_UPDATED` event for every new task state.
+    sendSubscribersUpdate = true;
   }
   task->add_statuses()->CopyFrom(status);
 


Mime
View raw message