mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [1/5] mesos git commit: Made the 'SchedulerDriver' abort when operation's 'id' field is set.
Date Tue, 08 May 2018 01:39:00 GMT
Repository: mesos
Updated Branches:
  refs/heads/1.6.x 3eb52bf49 -> c7df5eadc


Made the 'SchedulerDriver' abort when operation's 'id' field is set.

Since the 'SchedulerDriver' does not support operation status updates,
this patch adds a check to the driver which will abort the scheduler
if the 'id' field is set in an offer operation.

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


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

Branch: refs/heads/1.6.x
Commit: 634941fdb9e3ecc59f1b8a83bce4a05a949920d2
Parents: 3eb52bf
Author: Greg Mann <greg@mesosphere.io>
Authored: Mon May 7 17:31:55 2018 -0700
Committer: Greg Mann <gregorywmann@gmail.com>
Committed: Mon May 7 18:21:23 2018 -0700

----------------------------------------------------------------------
 src/sched/sched.cpp           |  6 ++++
 src/tests/scheduler_tests.cpp | 63 --------------------------------------
 2 files changed, 6 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/634941fd/src/sched/sched.cpp
----------------------------------------------------------------------
diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp
index 620a3b2..baa6b0c 100644
--- a/src/sched/sched.cpp
+++ b/src/sched/sched.cpp
@@ -1342,6 +1342,12 @@ protected:
 
     // Setting accept.operations.
     foreach (const Offer::Operation& _operation, operations) {
+      if (_operation.has_id()) {
+        ABORT("An offer operation's 'id' field was set, which is disallowed"
+              " because the SchedulerDriver cannot handle offer operation"
+              " status updates");
+      }
+
       Offer::Operation* operation = accept->add_operations();
       operation->CopyFrom(_operation);
     }

http://git-wip-us.apache.org/repos/asf/mesos/blob/634941fd/src/tests/scheduler_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/scheduler_tests.cpp b/src/tests/scheduler_tests.cpp
index 749420a..5474907 100644
--- a/src/tests/scheduler_tests.cpp
+++ b/src/tests/scheduler_tests.cpp
@@ -1193,69 +1193,6 @@ TEST_P(SchedulerTest, OperationFeedbackValidationNoResourceProviderCapability)
 }
 
 
-// Verifies invalidation of RESERVE operations with `id` set, when sent by a
-// `SchedulerDriver` framework.
-TEST_P(SchedulerTest, OperationFeedbackValidationSchedulerDriverFramework)
-{
-  Clock::pause();
-
-  master::Flags masterFlags = CreateMasterFlags();
-  Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
-  ASSERT_SOME(master);
-
-  Owned<MasterDetector> detector = master.get()->createDetector();
-
-  Try<Owned<cluster::Slave>> slave = StartSlave(detector.get());
-  ASSERT_SOME(slave);
-
-  FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
-  frameworkInfo.add_roles("framework-role");
-
-  MockScheduler scheduler;
-  MesosSchedulerDriver driver(
-      &scheduler,
-      frameworkInfo,
-      master.get()->pid,
-      DEFAULT_CREDENTIAL);
-
-  Future<FrameworkID> frameworkId;
-  EXPECT_CALL(scheduler, registered(&driver, _, _))
-    .WillOnce(FutureArg<1>(&frameworkId));
-
-  Future<vector<Offer>> offers;
-  EXPECT_CALL(scheduler, resourceOffers(&driver, _))
-    .WillOnce(FutureArg<1>(&offers));
-
-  driver.start();
-
-  AWAIT_READY(frameworkId);
-
-  Clock::advance(masterFlags.allocation_interval);
-  Clock::settle();
-
-  AWAIT_READY(offers);
-  ASSERT_FALSE(offers->empty());
-
-  Future<Nothing> schedulerError;
-  EXPECT_CALL(scheduler, error(_, _))
-    .WillOnce(FutureSatisfy(&schedulerError));
-
-  const Offer& offer = offers->at(0);
-
-  Resources resources = Resources::parse("cpus:0.1").get();
-  resources.pushReservation(createDynamicReservationInfo(
-      frameworkInfo.roles(1),
-      frameworkInfo.principal()));
-
-  Offer::Operation operation = RESERVE(resources);
-  operation.mutable_id()->set_value("RESERVE_OPERATION");
-
-  driver.acceptOffers({offer.id()}, {operation});
-
-  AWAIT_READY(schedulerError);
-}
-
-
 TEST_P(SchedulerTest, ShutdownExecutor)
 {
   Try<Owned<cluster::Master>> master = StartMaster();


Mime
View raw message