You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/05/26 01:40:55 UTC

[04/16] mesos git commit: Updated mesos-local work directory structure.

Updated mesos-local work directory structure.

This combines the `--work_dir` and `--runtime_dir` flags for the
mesos-local helper (**not** the Agent flags, which have the same name).
Only the `--work_dir` will remain.

The new directory structure will be the following:

  work_dir (mesos-local flag)
  |-- agents
  |   |-- 0
  |   |   |-- fetch (Agent --fetcher_cache_dir flag)
  |   |   |-- run   (Agent --runtime_dir flag)
  |   |   |-- work  (Agent --work_dir flag)
  |   |-- 1
  |   |   ...
  |-- master

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


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

Branch: refs/heads/master
Commit: 7a8f864046ef1f668427d431aeb571cd723745c4
Parents: 145896b
Author: Joseph Wu <jo...@apache.org>
Authored: Mon May 15 11:20:43 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu May 25 18:37:06 2017 -0700

----------------------------------------------------------------------
 src/local/flags.hpp | 43 +++++++++++++++++++------------------------
 src/local/local.cpp | 10 ++++------
 2 files changed, 23 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7a8f8640/src/local/flags.hpp
----------------------------------------------------------------------
diff --git a/src/local/flags.hpp b/src/local/flags.hpp
index 0cef5ac..37eba7b 100644
--- a/src/local/flags.hpp
+++ b/src/local/flags.hpp
@@ -32,34 +32,30 @@ class Flags : public virtual logging::Flags
 public:
   Flags()
   {
-    // `work_dir` is passed from here to the agents/master.
-    // This is necessary because `work_dir` is a required flag
-    // in agents/master and without this, the load call for their
-    // flags will spit out an error unless they have an env
-    // variable for the `work_dir` explicitly set.
-    // Since local mode is used strictly for non-production
-    // purposes, it is the one case where we deem it acceptable
-    // to set a default value for `work_dir`.
     add(&Flags::work_dir,
         "work_dir",
         "Path of the master/agent work directory. This is where the\n"
-        "persistent information of the cluster will be stored.\n"
-        "Note that locations like `/tmp` which are cleaned\n"
-        "automatically are not suitable for the work directory\n"
-        "when running in production, since long-running masters\n"
-        "and agents could lose data when cleanup occurs.\n"
-        "(Example: `/var/lib/mesos`)",
+        "persistent information of the cluster will be stored.\n\n"
+        "NOTE: Locations like `/tmp` which are cleaned automatically\n"
+        "are not suitable for the work directory when running in\n"
+        "production, since long-running masters and agents could lose\n"
+        "data when cleanup occurs. Local mode is used explicitly for\n"
+        "non-production purposes, so this is the only case where having\n"
+        "a default `work_dir` flag is acceptable.\n"
+        "(Example: `/var/lib/mesos`)\n\n"
+        "Individual work directories for each master and agent will be\n"
+        "nested underneath the given work directory:\n"
+        "root (`work_dir` flag)\n"
+        "|-- agents\n"
+        "|   |-- 0\n"
+        "|   |   |-- fetch (--fetcher_cache_dir)\n"
+        "|   |   |-- run   (--runtime_dir)\n"
+        "|   |   |-- work  (--work_dir)\n"
+        "|   |-- 1\n"
+        "|   |   ...\n"
+        "|-- master",
         path::join(os::temp(), "mesos", "work"));
 
-    add(&Flags::runtime_dir,
-        "runtime_dir",
-        "Path of the agent runtime directory. This is where runtime\n"
-        "data is stored by an agent that it needs to persist across\n"
-        "crashes (but not across reboots). This directory will be\n"
-        "cleared on reboot.\n"
-        "(Example: `/var/run/mesos`)",
-        path::join(os::temp(), "mesos", "runtime"));
-
     add(&Flags::num_slaves,
         "num_slaves",
         "Number of agents to launch for local cluster",
@@ -67,7 +63,6 @@ public:
   }
 
   std::string work_dir;
-  std::string runtime_dir;
   int num_slaves;
 };
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/7a8f8640/src/local/local.cpp
----------------------------------------------------------------------
diff --git a/src/local/local.cpp b/src/local/local.cpp
index ad35723..99c1b08 100644
--- a/src/local/local.cpp
+++ b/src/local/local.cpp
@@ -364,17 +364,15 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
     // environment variables explicitly set.
     map<string, string> propagatedFlags;
 
-    // Use a different work directory for each agent.
+    // Use a different work/runtime/fetcher-cache directory for each agent.
     propagatedFlags["work_dir"] =
-      path::join(flags.work_dir, "agents", stringify(i));
+      path::join(flags.work_dir, "agents", stringify(i), "work");
 
-    // Use a different runtime directory for each agent.
     propagatedFlags["runtime_dir"] =
-      path::join(flags.runtime_dir, "agents", stringify(i));
+      path::join(flags.work_dir, "agents", stringify(i), "run");
 
-    // Use a different fetcher cache directory for each agent.
     propagatedFlags["fetcher_cache_dir"] =
-      path::join(os::temp(), "mesos", "fetch", "agents", stringify(i));
+      path::join(flags.work_dir, "agents", stringify(i), "fetch");
 
     slave::Flags slaveFlags;
     Try<flags::Warnings> load = slaveFlags.load(