Repository: mesos
Updated Branches:
  refs/heads/master 2cea83653 -> 4e200e55d


Added name flag to balloon and disk full frameworks.

Allows to distinguish the framework between different instances.

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


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

Branch: refs/heads/master
Commit: 90c4b70bf5031aceefcc819521c28e63f0a002b8
Parents: 2cea836
Author: Armand Grillet <agril...@mesosphere.io>
Authored: Thu Aug 10 16:52:10 2017 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Thu Aug 10 16:52:10 2017 +0200

----------------------------------------------------------------------
 src/examples/balloon_framework.cpp   | 12 +++++++++---
 src/examples/disk_full_framework.cpp | 10 ++++++++--
 2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/90c4b70b/src/examples/balloon_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/balloon_framework.cpp 
b/src/examples/balloon_framework.cpp
index dfd049b..1045333 100644
--- a/src/examples/balloon_framework.cpp
+++ b/src/examples/balloon_framework.cpp
@@ -68,6 +68,11 @@ class Flags : public virtual flags::FlagsBase
 public:
   Flags()
   {
+    add(&Flags::name,
+        "name",
+        "Name to be used by the framework.",
+        "Balloon Framework");
+
     add(&Flags::master,
         "master",
         "Master to connect to.");
@@ -143,6 +148,7 @@ public:
         false);
   }
 
+  string name;
   string master;
   Bytes task_memory_usage_limit;
   Bytes task_memory;
@@ -223,7 +229,7 @@ public:
       LOG(INFO) << "Launching task " << taskId;
 
       TaskInfo task;
-      task.set_name("Balloon Task");
+      task.set_name(flags.name + " Task");
       task.mutable_task_id()->set_value(stringify(taskId));
       task.mutable_slave_id()->MergeFrom(offer.slave_id());
       task.mutable_resources()->CopyFrom(taskResources);
@@ -493,7 +499,7 @@ int main(int argc, char** argv)
 
   ExecutorInfo executor;
   executor.mutable_resources()->CopyFrom(resources);
-  executor.set_name("Balloon Executor");
+  executor.set_name(flags.name + " Executor");
 
   // Determine the command to run the executor based on three possibilities:
   //   1) `--executor_command` was set, which overrides the below cases.
@@ -548,7 +554,7 @@ int main(int argc, char** argv)
 
   FrameworkInfo framework;
   framework.set_user(os::user().get());
-  framework.set_name("Balloon Framework (C++)");
+  framework.set_name(flags.name);
   framework.set_checkpoint(flags.checkpoint);
   framework.set_role("*");
   framework.add_capabilities()->set_type(

http://git-wip-us.apache.org/repos/asf/mesos/blob/90c4b70b/src/examples/disk_full_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/disk_full_framework.cpp 
b/src/examples/disk_full_framework.cpp
index 215b6d2..5639024 100644
--- a/src/examples/disk_full_framework.cpp
+++ b/src/examples/disk_full_framework.cpp
@@ -62,6 +62,11 @@ class Flags : public virtual flags::FlagsBase
 public:
   Flags()
   {
+    add(&Flags::name,
+        "name",
+        "Name to be used by the framework.",
+        "Disk Full Framework");
+
     add(&Flags::master,
         "master",
         "Master to connect to.");
@@ -98,6 +103,7 @@ public:
         "and the task will terminated.\n");
   }
 
+  string name;
   string master;
   bool run_once;
   Duration pre_sleep_duration;
@@ -178,7 +184,7 @@ public:
           " && sleep " + stringify(flags.post_sleep_duration.secs());
 
       TaskInfo task;
-      task.set_name("Disk full framework task");
+      task.set_name(flags.name + " Task");
       task.mutable_task_id()->set_value(stringify(taskId));
       task.mutable_slave_id()->MergeFrom(offer.slave_id());
       task.mutable_resources()->CopyFrom(taskResources);
@@ -438,7 +444,7 @@ int main(int argc, char** argv)
 
   FrameworkInfo framework;
   framework.set_user(""); // Have Mesos fill the current user.
-  framework.set_name("Disk Full Framework (C++)");
+  framework.set_name(flags.name);
   framework.set_checkpoint(true);
   framework.add_capabilities()->set_type(
       FrameworkInfo::Capability::RESERVATION_REFINEMENT);

Reply via email to