You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2013/06/25 03:52:06 UTC
git commit: Fixed slave to create work directory during
initialization.
Updated Branches:
refs/heads/master 822892ebd -> d0a7a6812
Fixed slave to create work directory during initialization.
Review: https://reviews.apache.org/r/12010
Project: http://git-wip-us.apache.org/repos/asf/incubator-mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mesos/commit/d0a7a681
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mesos/tree/d0a7a681
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mesos/diff/d0a7a681
Branch: refs/heads/master
Commit: d0a7a6812e17fb93088cfcab99a0194db5281a03
Parents: 822892e
Author: Vinod Kone <vi...@twitter.com>
Authored: Thu Jun 20 10:24:24 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Mon Jun 24 12:28:09 2013 -0700
----------------------------------------------------------------------
src/slave/slave.cpp | 68 ++++++++++++++++++++----------------------------
src/slave/slave.hpp | 5 ----
2 files changed, 28 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mesos/blob/d0a7a681/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 309d1ac..9985f14 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -76,15 +76,14 @@ namespace slave {
using namespace state;
-Slave::Slave(const Resources& _resources,
+Slave::Slave(const slave::Flags& _flags,
bool _local,
Isolator* _isolator,
Files* _files)
: ProcessBase(ID::generate("slave")),
state(RECOVERING),
- flags(),
+ flags(_flags),
local(_local),
- resources(_resources),
completedFrameworks(MAX_COMPLETED_FRAMEWORKS),
isolator(_isolator),
files(_files),
@@ -93,23 +92,32 @@ Slave::Slave(const Resources& _resources,
metaDir(paths::getMetaRootDir(flags.work_dir)) {}
-Slave::Slave(const slave::Flags& _flags,
- bool _local,
- Isolator* _isolator,
- Files* _files)
- : ProcessBase(ID::generate("slave")),
- state(RECOVERING),
- flags(_flags),
- local(_local),
- completedFrameworks(MAX_COMPLETED_FRAMEWORKS),
- isolator(_isolator),
- files(_files),
- monitor(_isolator),
- statusUpdateManager(new StatusUpdateManager()),
- metaDir(paths::getMetaRootDir(flags.work_dir))
+Slave::~Slave()
{
- // TODO(benh): Move this computation into Flags as the "default".
+ // TODO(benh): Shut down frameworks?
+
+ // TODO(benh): Shut down executors? The executor should get an "exited"
+ // event and initiate a shut down itself.
+ foreachvalue (Framework* framework, frameworks) {
+ delete framework;
+ }
+
+ delete statusUpdateManager;
+}
+
+
+void Slave::initialize()
+{
+ LOG(INFO) << "Slave started on " << string(self()).substr(6);
+
+ // Ensure slave work directory exists.
+ CHECK_SOME(os::mkdir(flags.work_dir))
+ << "Failed to create slave work directory '" << flags.work_dir << "'";
+
+ // Properly set up resources.
+ // TODO(benh): Move this computation into Flags as the "default".
+ // TODO(vinod): Move some of this computation into Resources.
resources = Resources::parse(
flags.resources.isSome() ? flags.resources.get() : "");
@@ -193,31 +201,11 @@ Slave::Slave(const slave::Flags& _flags,
resources = Resources::parse(defaults.get());
+ LOG(INFO) << "Slave resources: " << resources;
+
if (flags.attributes.isSome()) {
attributes = Attributes::parse(flags.attributes.get());
}
-}
-
-
-Slave::~Slave()
-{
- // TODO(benh): Shut down frameworks?
-
- // TODO(benh): Shut down executors? The executor should get an "exited"
- // event and initiate a shut down itself.
-
- foreachvalue (Framework* framework, frameworks) {
- delete framework;
- }
-
- delete statusUpdateManager;
-}
-
-
-void Slave::initialize()
-{
- LOG(INFO) << "Slave started on " << string(self()).substr(6);
- LOG(INFO) << "Slave resources: " << resources;
// Determine our hostname.
Try<string> result = os::hostname();
http://git-wip-us.apache.org/repos/asf/incubator-mesos/blob/d0a7a681/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index 7ef6ad8..3ac8933 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -74,11 +74,6 @@ struct Framework;
class Slave : public ProtobufProcess<Slave>
{
public:
- Slave(const Resources& resources,
- bool local,
- Isolator* isolator,
- Files* files);
-
Slave(const Flags& flags,
bool local,
Isolator *isolator,