You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2018/12/05 22:06:09 UTC
[mesos] 03/05: Added agent and resource provider IDs to operation
status messages.
This is an automated email from the ASF dual-hosted git repository.
chhsiao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit d5577c52587f9bad0bc98eba4b5cf0206022c42a
Author: Benjamin Bannier <be...@mesosphere.io>
AuthorDate: Wed Dec 5 13:03:06 2018 -0800
Added agent and resource provider IDs to operation status messages.
This patch adds agent and resource provider IDs to
`UpdateOperationStatus` and `UpdateOperationStatusMessage`. With that
frameworks are able to reconcile enough information after failover to
construct operation acknowledgements.
We will add code to populate these fields in a follow-up patch.
Review: https://reviews.apache.org/r/69162/
---
include/mesos/mesos.proto | 12 ++++++++++++
include/mesos/v1/mesos.proto | 12 ++++++++++++
src/common/type_utils.cpp | 17 +++++++++++++++++
src/internal/devolve.cpp | 8 +++++++-
src/internal/evolve.cpp | 8 +++++++-
5 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index c822cc7..ef4d785 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -2431,6 +2431,18 @@ message OperationStatus {
// include a `uuid`. The status is considered delivered once
// it is acknowledged by the scheduler.
optional UUID uuid = 5;
+
+ // If the operation affects resources from a local resource provider,
+ // both `slave_id` and `resource_provider_id` will be set.
+ //
+ // If the operation affects resources that belong to an external
+ // resource provider, only `resource_provider_id` will be set.
+ //
+ // In certain cases, e.g., invalid operations, neither `uuid`,
+ // `slave_id` nor `resource_provider_id` will be set, and the
+ // scheduler does not need to acknowledge this status update.
+ optional SlaveID slave_id = 6;
+ optional ResourceProviderID resource_provider_id = 7;
}
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index 51c1bfd..4e8f7a1 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -2424,6 +2424,18 @@ message OperationStatus {
// include a `uuid`. The status is considered delivered once
// it is acknowledged by the scheduler.
optional UUID uuid = 5;
+
+ // If the operation affects resources from a local resource provider,
+ // both `agent_id` and `resource_provider_id` will be set.
+ //
+ // If the operation affects resources that belong to an external
+ // resource provider, only `resource_provider_id` will be set.
+ //
+ // In certain cases, e.g., invalid operations, neither `uuid`,
+ // `slave_id` nor `resource_provider_id` will be set, and the
+ // scheduler does not need to acknowledge this status update.
+ optional AgentID agent_id = 6;
+ optional ResourceProviderID resource_provider_id = 7;
}
diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp
index ef13eae..df888ef 100644
--- a/src/common/type_utils.cpp
+++ b/src/common/type_utils.cpp
@@ -492,6 +492,23 @@ bool operator==(const OperationStatus& left, const OperationStatus& right)
return false;
}
+ if (left.has_slave_id() != right.has_slave_id()) {
+ return false;
+ }
+
+ if (left.has_slave_id() && left.slave_id() != right.slave_id()) {
+ return false;
+ }
+
+ if (left.has_resource_provider_id() != right.has_resource_provider_id()) {
+ return false;
+ }
+
+ if (left.has_resource_provider_id() &&
+ left.resource_provider_id() != right.resource_provider_id()) {
+ return false;
+ }
+
return true;
}
diff --git a/src/internal/devolve.cpp b/src/internal/devolve.cpp
index 491ed2a..e23ed3c 100644
--- a/src/internal/devolve.cpp
+++ b/src/internal/devolve.cpp
@@ -106,7 +106,13 @@ Offer devolve(const v1::Offer& offer)
OperationStatus devolve(const v1::OperationStatus& status)
{
- return devolve<OperationStatus>(status);
+ OperationStatus _status = devolve<OperationStatus>(status);
+
+ if (status.has_agent_id()) {
+ *_status.mutable_slave_id() = devolve<SlaveID>(status.agent_id());
+ }
+
+ return _status;
}
diff --git a/src/internal/evolve.cpp b/src/internal/evolve.cpp
index aa60efe..19c1559 100644
--- a/src/internal/evolve.cpp
+++ b/src/internal/evolve.cpp
@@ -160,7 +160,13 @@ v1::OfferID evolve(const OfferID& offerId)
v1::OperationStatus evolve(const OperationStatus& status)
{
- return evolve<v1::OperationStatus>(status);
+ v1::OperationStatus _status = evolve<v1::OperationStatus>(status);
+
+ if (status.has_slave_id()) {
+ *_status.mutable_agent_id() = evolve<v1::AgentID>(status.slave_id());
+ }
+
+ return _status;
}