You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/10/10 01:59:28 UTC
svn commit: r1396416 - in /incubator/mesos/trunk/src: master/master.cpp
master/master.hpp slave/slave.cpp slave/slave.hpp
Author: benh
Date: Tue Oct 9 23:59:22 2012
New Revision: 1396416
URL: http://svn.apache.org/viewvc?rev=1396416&view=rev
Log:
Attached executor work directories so they can be accessed via the
webui (contributed by Ben Mahler, https://reviews.apache.org/r/7202).
Modified:
incubator/mesos/trunk/src/master/master.cpp
incubator/mesos/trunk/src/master/master.hpp
incubator/mesos/trunk/src/slave/slave.cpp
incubator/mesos/trunk/src/slave/slave.hpp
Modified: incubator/mesos/trunk/src/master/master.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master/master.cpp?rev=1396416&r1=1396415&r2=1396416&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master/master.cpp (original)
+++ incubator/mesos/trunk/src/master/master.cpp Tue Oct 9 23:59:22 2012
@@ -459,10 +459,9 @@ void Master::initialize()
// Blocked on http://code.google.com/p/google-glog/issues/detail?id=116
// Alternatively, initialize() could take the executable name.
if (flags.log_dir.isSome()) {
- Future<Nothing> result = files->attach(
- path::join(flags.log_dir.get(), "mesos-master.INFO"),
- "/log");
- result.onAny(defer(self(), &Self::fileAttached, result));
+ string logPath = path::join(flags.log_dir.get(), "mesos-master.INFO");
+ Future<Nothing> result = files->attach(logPath, "/log");
+ result.onAny(defer(self(), &Self::fileAttached, result, logPath));
}
}
@@ -526,13 +525,14 @@ void Master::exited(const UPID& pid)
}
-void Master::fileAttached(const Future<Nothing>& result)
+void Master::fileAttached(const Future<Nothing>& result, const string& path)
{
CHECK(!result.isDiscarded());
if (result.isReady()) {
- LOG(INFO) << "Master attached log file successfully";
+ VLOG(1) << "Successfully attached file '" << path << "'";
} else {
- LOG(ERROR) << "Failed to attach log file: " << result.failure();
+ LOG(ERROR) << "Failed to attach file '" << path << "': "
+ << result.failure();
}
}
Modified: incubator/mesos/trunk/src/master/master.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master/master.hpp?rev=1396416&r1=1396415&r2=1396416&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master/master.hpp (original)
+++ incubator/mesos/trunk/src/master/master.hpp Tue Oct 9 23:59:22 2012
@@ -123,7 +123,7 @@ protected:
virtual void finalize();
virtual void exited(const UPID& pid);
- void fileAttached(const Future<Nothing>& result);
+ void fileAttached(const Future<Nothing>& result, const std::string& path);
// Return connected frameworks that are not in the process of being removed
std::vector<Framework*> getActiveFrameworks() const;
Modified: incubator/mesos/trunk/src/slave/slave.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/slave.cpp?rev=1396416&r1=1396415&r2=1396416&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/slave.cpp (original)
+++ incubator/mesos/trunk/src/slave/slave.cpp Tue Oct 9 23:59:22 2012
@@ -300,10 +300,9 @@ void Slave::initialize()
// Blocked on http://code.google.com/p/google-glog/issues/detail?id=116
// Alternatively, initialize() could take the executable name.
if (flags.log_dir.isSome()) {
- Future<Nothing> result = files->attach(
- path::join(flags.log_dir.get(), "mesos-slave.INFO"),
- "/log");
- result.onAny(defer(self(), &Self::fileAttached, result));
+ string logPath = path::join(flags.log_dir.get(), "mesos-slave.INFO");
+ Future<Nothing> result = files->attach(logPath, "/log");
+ result.onAny(defer(self(), &Self::fileAttached, result, logPath));
}
}
@@ -345,13 +344,14 @@ void Slave::shutdown()
}
-void Slave::fileAttached(const Future<Nothing>& result)
+void Slave::fileAttached(const Future<Nothing>& result, const string& path)
{
CHECK(!result.isDiscarded());
if (result.isReady()) {
- LOG(INFO) << "Master attached log file successfully";
+ VLOG(1) << "Successfully attached file '" << path << "'";
} else {
- LOG(ERROR) << "Failed to attach log file: " << result.failure();
+ LOG(ERROR) << "Failed to attach file '" << path << "': "
+ << result.failure();
}
}
@@ -536,6 +536,14 @@ void Slave::runTask(const FrameworkInfo&
paths::createUniqueExecutorWorkDirectory(flags.work_dir, id,
framework->id, executorId);
+ // NOTE: This constant "virtual path" format is shared with the webui.
+ // TODO(bmahler): Pass this to the webui explicitly via the existing JSON.
+ string attached =
+ strings::format("/slaves/%s/frameworks/%s/executors/%s",
+ id.value(), framework->id.value(), executorId.value()).get();
+ Future<Nothing> result = files->attach(directory, attached);
+ result.onAny(defer(self(), &Self::fileAttached, result, directory));
+
LOG(INFO) << "Using '" << directory
<< "' as work directory for executor '" << executorId
<< "' of framework " << framework->id;
Modified: incubator/mesos/trunk/src/slave/slave.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/slave.hpp?rev=1396416&r1=1396415&r2=1396416&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/slave.hpp (original)
+++ incubator/mesos/trunk/src/slave/slave.hpp Tue Oct 9 23:59:22 2012
@@ -138,7 +138,7 @@ protected:
virtual void finalize();
virtual void exited(const UPID& pid);
- void fileAttached(const Future<Nothing>& result);
+ void fileAttached(const Future<Nothing>& result, const std::string& path);
// Helper routine to lookup a framework.
Framework* getFramework(const FrameworkID& frameworkId);