Updated the default executor to not automatically send TASK_FINISHED.

Also updated the test accordingly.

Review: https://reviews.apache.org/r/52106


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a6dfbbb8
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a6dfbbb8
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a6dfbbb8

Branch: refs/heads/master
Commit: a6dfbbb825d3318e0b5ac5cbfd9cdf86da509dab
Parents: 9303db6
Author: Vinod Kone <vinodk...@gmail.com>
Authored: Tue Sep 20 17:34:23 2016 -0700
Committer: Vinod Kone <vinodk...@gmail.com>
Committed: Tue Sep 20 20:27:11 2016 -0700

----------------------------------------------------------------------
 src/launcher/default_executor.cpp    | 10 ----------
 src/tests/default_executor_tests.cpp | 33 +++++--------------------------
 2 files changed, 5 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a6dfbbb8/src/launcher/default_executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/default_executor.cpp 
b/src/launcher/default_executor.cpp
index f0feb95..53e27c9 100644
--- a/src/launcher/default_executor.cpp
+++ b/src/launcher/default_executor.cpp
@@ -219,16 +219,6 @@ protected:
     foreach (const TaskInfo& task, _taskGroup.tasks()) {
       update(task.task_id(), TASK_RUNNING);
     }
-
-    foreach (const TaskInfo& task, _taskGroup.tasks()) {
-      update(task.task_id(), TASK_FINISHED);
-    }
-
-    // TODO(qianzhang): Remove this hack since the executor now receives
-    // acknowledgements for status updates. The executor can terminate
-    // after it receives an ACK for a terminal status update.
-    os::sleep(Seconds(1));
-    terminate(self());
   }
 
 private:

http://git-wip-us.apache.org/repos/asf/mesos/blob/a6dfbbb8/src/tests/default_executor_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/default_executor_tests.cpp 
b/src/tests/default_executor_tests.cpp
index 055a3d7..b39877c 100644
--- a/src/tests/default_executor_tests.cpp
+++ b/src/tests/default_executor_tests.cpp
@@ -105,9 +105,9 @@ TEST_F(DefaultExecutorTest, TaskRunning)
   AWAIT_READY(offers);
   EXPECT_NE(0, offers->offers().size());
 
-  Future<v1::scheduler::Event::Update> update1;
+  Future<v1::scheduler::Event::Update> update;
   EXPECT_CALL(*scheduler, update(_, _))
-    .WillOnce(FutureArg<1>(&update1));
+    .WillOnce(FutureArg<1>(&update));
 
   const v1::Offer& offer = offers->offers(0);
   const SlaveID slaveId = devolve(offer.agent_id());
@@ -138,33 +138,10 @@ TEST_F(DefaultExecutorTest, TaskRunning)
     mesos.send(call);
   }
 
-  AWAIT_READY(update1);
+  AWAIT_READY(update);
 
-  ASSERT_EQ(TASK_RUNNING, update1->status().state());
-  EXPECT_EQ(taskInfo.task_id(), update1->status().task_id());
-
-  Future<v1::scheduler::Event::Update> update2;
-  EXPECT_CALL(*scheduler, update(_, _))
-    .WillOnce(FutureArg<1>(&update2));
-
-  {
-    // Acknowledge TASK_RUNNING update.
-    Call call;
-    call.mutable_framework_id()->CopyFrom(frameworkId);
-    call.set_type(Call::ACKNOWLEDGE);
-
-    Call::Acknowledge* acknowledge = call.mutable_acknowledge();
-    acknowledge->mutable_task_id()->CopyFrom(taskInfo.task_id());
-    acknowledge->mutable_agent_id()->CopyFrom(offer.agent_id());
-    acknowledge->set_uuid(update1->status().uuid());
-
-    mesos.send(call);
-  }
-
-  AWAIT_READY(update2);
-
-  ASSERT_EQ(TASK_FINISHED, update2->status().state());
-  EXPECT_EQ(taskInfo.task_id(), update2->status().task_id());
+  ASSERT_EQ(TASK_RUNNING, update->status().state());
+  EXPECT_EQ(taskInfo.task_id(), update->status().task_id());
 }
 
 } // namespace tests {

Reply via email to