Repository: mesos
Updated Branches:
refs/heads/master b74d07229 -> 1b5851a8c
Marked RunTaskMessage::framework_id as optional.
The new preferred location for FrameworkID is FrameworkInfo.id. This
patchset achieves this goal by incrementally deprecating other locations
for FrameworkID.
Here is a plan to deal with the upgrade path:
For this release (N), we still keep setting RunTaskMessage::framework_id
- this would handle older Slaves with newer Master.
- added code to handle it being unset in the Slave (handles older
Master with newer Slaves).
In the following release (N+1), stop reading/setting
RunTaskMessage::framework_id
- the previous version would handle the unset case.
In release N+2, remove the field altogether:
- the previous release is not setting/reading it.
Review: https://reviews.apache.org/r/32583
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9db15635
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9db15635
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9db15635
Branch: refs/heads/master
Commit: 9db15635e4b17ac65e7a3897c587f8cd5d5a6fa5
Parents: b74d072
Author: Kapil Arya <[email protected]>
Authored: Sat Apr 11 01:18:07 2015 -0700
Committer: Adam B <[email protected]>
Committed: Sat Apr 11 01:18:07 2015 -0700
----------------------------------------------------------------------
src/messages/messages.proto | 3 ++-
src/slave/slave.cpp | 13 +++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/9db15635/src/messages/messages.proto
----------------------------------------------------------------------
diff --git a/src/messages/messages.proto b/src/messages/messages.proto
index 97c45c0..2d242dc 100644
--- a/src/messages/messages.proto
+++ b/src/messages/messages.proto
@@ -195,7 +195,8 @@ message ReviveOffersMessage {
message RunTaskMessage {
- required FrameworkID framework_id = 1;
+ // TODO(karya): Remove framework_id after MESOS-2559 has shipped.
+ optional FrameworkID framework_id = 1 [deprecated = true];
required FrameworkInfo framework = 2;
required string pid = 3;
required TaskInfo task = 4;
http://git-wip-us.apache.org/repos/asf/mesos/blob/9db15635/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 9fec023..082f97a 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -1107,8 +1107,8 @@ Future<bool> Slave::unschedule(const string& path)
// send TASK_LOST to the framework.
void Slave::runTask(
const UPID& from,
- const FrameworkInfo& frameworkInfo,
- const FrameworkID& frameworkId,
+ const FrameworkInfo& frameworkInfo_,
+ const FrameworkID& frameworkId_,
const string& pid,
const TaskInfo& task)
{
@@ -1119,6 +1119,15 @@ void Slave::runTask(
return;
}
+ // Merge frameworkId_ into frameworkInfo.
+ FrameworkInfo frameworkInfo = frameworkInfo_;
+ if (!frameworkInfo.has_id()) {
+ frameworkInfo.mutable_id()->CopyFrom(frameworkId_);
+ }
+
+ // Create frameworkId alias to use in the rest of the function.
+ const FrameworkID frameworkId = frameworkInfo.id();
+
LOG(INFO) << "Got assigned task " << task.task_id()
<< " for framework " << frameworkId;