This is an automated email from the ASF dual-hosted git repository.

bmahler 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 2453aa4  Added an UPDATE_FRAMEWORK scheduler::Call.
2453aa4 is described below

commit 2453aa4f2dd19b861b082e10caef73f7747fd0c4
Author: Andrei Sekretenko <asekrete...@mesosphere.io>
AuthorDate: Mon May 20 09:10:34 2019 -0400

    Added an UPDATE_FRAMEWORK scheduler::Call.
    
    This patch definies the call to be used by a framework for updating its
    FrameworkInfo fields without re-subscribing.
    
    It is based on the previous implementation attempt:
    https://reviews.apache.org/r/66228/
    
    Review: https://reviews.apache.org/r/70532/
---
 include/mesos/scheduler/scheduler.proto            | 30 ++++++++++++++++++++++
 include/mesos/v1/scheduler/scheduler.proto         | 30 ++++++++++++++++++++++
 .../jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp  |  3 ++-
 src/master/http.cpp                                |  3 +++
 src/master/master.cpp                              |  7 +++++
 src/master/validation.cpp                          |  3 +++
 6 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/include/mesos/scheduler/scheduler.proto 
b/include/mesos/scheduler/scheduler.proto
index b6d79b1..6e1639a 100644
--- a/include/mesos/scheduler/scheduler.proto
+++ b/include/mesos/scheduler/scheduler.proto
@@ -267,6 +267,7 @@ message Call {
     MESSAGE = 10;    // See 'Message' below.
     REQUEST = 11;    // See 'Request' below.
     SUPPRESS = 12;   // Inform master to stop sending offers to the framework.
+    UPDATE_FRAMEWORK = 17; // See `UpdateFramework` below.
 
     // TODO(benh): Consider adding an 'ACTIVATE' and 'DEACTIVATE' for
     // already subscribed frameworks as a way of stopping offers from
@@ -488,6 +489,34 @@ message Call {
     repeated string roles = 1;
   }
 
+  // Updates the FrameworkInfo. All fields can be updated except for:
+  //
+  // * FrameworkInfo.checkpoint
+  // * FrameworkInfo.principal
+  // * FrameworkInfo.user
+  //
+  // The call returns after the update is either applied completely or
+  // not applied at all. No incomplete updates occur.
+  //
+  // The HTTP response codes specific to this call are:
+  //
+  // * 200 OK: update operation was successfully completed.
+  // * 400 Bad Request: the requested update is not valid.
+  // * 403 Forbidden: framework is not authorized to use some entities
+  //   requested by the update (e.g. not authorized to use some of the
+  //   supplied roles).
+  // * 409 Conflict: framework disappeared while this call was being processed
+  //   (example: the framework was removed by a concurrent TEARDOWN call).
+  //
+  message UpdateFramework {
+    required FrameworkInfo framework_info = 1;
+
+    // List of suppressed roles for which the framework does not wish to be
+    // offered resources. The framework can decide to suppress all or a subset
+    // of roles provided in the new `framework_info`.
+    repeated string suppressed_roles = 2;
+  }
+
   // Identifies who generated this call. Master assigns a framework id
   // when a new scheduler subscribes for the first time. Once assigned,
   // the scheduler must set the 'framework_id' here and within its
@@ -517,4 +546,5 @@ message Call {
   optional Message message = 10;
   optional Request request = 11;
   optional Suppress suppress = 16;
+  optional UpdateFramework update_framework = 19;
 }
diff --git a/include/mesos/v1/scheduler/scheduler.proto 
b/include/mesos/v1/scheduler/scheduler.proto
index bddd5c4..eb5fdeb 100644
--- a/include/mesos/v1/scheduler/scheduler.proto
+++ b/include/mesos/v1/scheduler/scheduler.proto
@@ -265,6 +265,7 @@ message Call {
     MESSAGE = 10;    // See 'Message' below.
     REQUEST = 11;    // See 'Request' below.
     SUPPRESS = 12;   // Inform master to stop sending offers to the framework.
+    UPDATE_FRAMEWORK = 17; // See 'UpdateFramework' below.
 
     // TODO(benh): Consider adding an 'ACTIVATE' and 'DEACTIVATE' for
     // already subscribed frameworks as a way of stopping offers from
@@ -480,6 +481,34 @@ message Call {
     repeated string roles = 1;
   }
 
+  // Updates the FrameworkInfo. All fields can be updated except for:
+  //
+  // * FrameworkInfo.checkpoint
+  // * FrameworkInfo.principal
+  // * FrameworkInfo.user
+  //
+  // The call returns after the update is either applied completely or
+  // not applied at all. No incomplete updates occur.
+  //
+  // The HTTP response codes specific to this call are:
+  //
+  // * 200 OK: update operation was successfully completed.
+  // * 400 Bad Request: the requested update is not valid.
+  // * 403 Forbidden: framework is not authorized to use some entities
+  //   requested by the update (e.g. not authorized to use some of the
+  //   supplied roles).
+  // * 409 Conflict: framework disappeared while this call was being processed
+  //   (example: the framework was removed by a concurrent TEARDOWN call).
+  //
+  message UpdateFramework {
+    required FrameworkInfo framework_info = 1;
+
+    // List of suppressed roles for which the framework does not wish to be
+    // offered resources. The framework can decide to suppress all or a subset
+    // of roles provided in the new `framework_info`.
+    repeated string suppressed_roles = 2;
+  }
+
   // Identifies who generated this call. Master assigns a framework id
   // when a new scheduler subscribes for the first time. Once assigned,
   // the scheduler must set the 'framework_id' here and within its
@@ -509,6 +538,7 @@ message Call {
   optional Message message = 10;
   optional Request request = 11;
   optional Suppress suppress = 16;
+  optional UpdateFramework update_framework = 19;
 }
 
 /**
diff --git a/src/java/jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp 
b/src/java/jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp
index 35a04a3..7afd0e9 100644
--- a/src/java/jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp
+++ b/src/java/jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp
@@ -600,7 +600,8 @@ void V0ToV1AdapterProcess::send(SchedulerDriver* driver, 
const Call& _call)
 
     case scheduler::Call::ACCEPT_INVERSE_OFFERS:
     case scheduler::Call::DECLINE_INVERSE_OFFERS:
-    case scheduler::Call::SHUTDOWN: {
+    case scheduler::Call::SHUTDOWN:
+    case scheduler::Call::UPDATE_FRAMEWORK: {
       // TODO(anand): Throw java error.
       LOG(ERROR) << "Received an unexpected " << call.type() << " call";
       break;
diff --git a/src/master/http.cpp b/src/master/http.cpp
index c2c7b9b..1618794 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -715,6 +715,9 @@ Future<Response> Master::Http::scheduler(
       master->request(framework, call.request());
       return Accepted();
 
+    case scheduler::Call::UPDATE_FRAMEWORK:
+      return NotImplemented();
+
     case scheduler::Call::UNKNOWN:
       LOG(WARNING) << "Received 'UNKNOWN' call";
       return NotImplemented();
diff --git a/src/master/master.cpp b/src/master/master.cpp
index c72b926..657a7e9 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -2490,6 +2490,13 @@ void Master::receive(
       suppress(framework, call.suppress());
       break;
 
+    case scheduler::Call::UPDATE_FRAMEWORK:
+      drop(
+          from,
+          call,
+          "'UPDATE_FRAMEWORK' is not supported by the v0 API");
+      break;
+
     case scheduler::Call::UNKNOWN:
       LOG(WARNING) << "'UNKNOWN' call";
       break;
diff --git a/src/master/validation.cpp b/src/master/validation.cpp
index 9fb0850..764c846 100644
--- a/src/master/validation.cpp
+++ b/src/master/validation.cpp
@@ -725,6 +725,9 @@ Option<Error> validate(
       }
       return None();
 
+    case mesos::scheduler::Call::UPDATE_FRAMEWORK:
+      return Error("Call not implemented");
+
     case mesos::scheduler::Call::UNKNOWN:
       return None();
   }

Reply via email to