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/03/21 19:19:41 UTC
svn commit: r1459438 - in /incubator/mesos/trunk/src: launcher/launcher.cpp
slave/cgroups_isolator.cpp slave/process_isolator.cpp slave/state.cpp
Author: vinodkone
Date: Thu Mar 21 18:19:40 2013
New Revision: 1459438
URL: http://svn.apache.org/r1459438
Log:
Fixed launcher to flush std::cout when copying local resource.
Review: https://reviews.apache.org/r/10054
Modified:
incubator/mesos/trunk/src/launcher/launcher.cpp
incubator/mesos/trunk/src/slave/cgroups_isolator.cpp
incubator/mesos/trunk/src/slave/process_isolator.cpp
incubator/mesos/trunk/src/slave/state.cpp
Modified: incubator/mesos/trunk/src/launcher/launcher.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/launcher/launcher.cpp?rev=1459438&r1=1459437&r2=1459438&view=diff
==============================================================================
--- incubator/mesos/trunk/src/launcher/launcher.cpp (original)
+++ incubator/mesos/trunk/src/launcher/launcher.cpp Thu Mar 21 18:19:40 2013
@@ -166,13 +166,13 @@ int ExecutorLauncher::run()
// if requested.
int ExecutorLauncher::fetchExecutors()
{
- cerr << "Fetching resources into " << workDirectory << endl;
+ cout << "Fetching resources into '" << workDirectory << "'" << endl;
foreach(const CommandInfo::URI& uri, commandInfo.uris()) {
string resource = uri.value();
bool executable = uri.has_executable() && uri.executable();
- cerr << "Fetching resource " << resource << endl;
+ cout << "Fetching resource '" << resource << "'" << endl;
// Some checks to make sure using the URI value in shell commands
// is safe. TODO(benh): These should be pushed into the scheduler
@@ -211,7 +211,7 @@ int ExecutorLauncher::fetchExecutors()
ostringstream command;
command << hadoopScript << " fs -copyToLocal '" << resource
<< "' '" << localFile << "'";
- cout << "Downloading resource from " << resource << endl;
+ cout << "Downloading resource from '" << resource << "'" << endl;
cout << "HDFS command: " << command.str() << endl;
int ret = os::system(command.str());
@@ -236,7 +236,7 @@ int ExecutorLauncher::fetchExecutors()
}
path = path::join(".", path.substr(path.find_last_of("/") + 1));
- cout << "Downloading " << resource << " to " << path << endl;
+ cout << "Downloading '" << resource << "' to '" << path << "'" << endl;
Try<int> code = net::download(resource, path);
if (code.isError()) {
cerr << "Error downloading resource: " << code.error().c_str() << endl;
@@ -253,7 +253,7 @@ int ExecutorLauncher::fetchExecutors()
if (frameworksHome != "") {
resource = path::join(frameworksHome, resource);
cout << "Prepended configuration option frameworks_home to resource "
- << "path, making it: " << resource << endl;
+ << "path, making it: '" << resource << "'" << endl;
} else {
cerr << "A relative path was passed for the resource, but "
<< "the configuration option frameworks_home is not set. "
@@ -266,11 +266,12 @@ int ExecutorLauncher::fetchExecutors()
// Copy the resource to the current working directory.
ostringstream command;
command << "cp '" << resource << "' .";
- cout << "Copying resource from " << resource << " to .";
+ cout << "Copying resource from '" << resource << "' to ." << endl;
- int ret = os::system(command.str());
- if (ret != 0) {
- cerr << "Failed to copy " << resource << ": Exit code " << ret << endl;
+ int status = os::system(command.str());
+ if (status != 0) {
+ cerr << "Failed to copy '" << resource
+ << "' : Exit status " << status << endl;
return -1;
}
@@ -287,7 +288,7 @@ int ExecutorLauncher::fetchExecutors()
Try<Nothing> chown = os::chown(user, resource);
if (chown.isError()) {
- cerr << "Failed to chown " << resource << " to user " << user << ": "
+ cerr << "Failed to chown '" << resource << "' to user " << user << ": "
<< chown.error() << endl;
return -1;
}
@@ -295,7 +296,7 @@ int ExecutorLauncher::fetchExecutors()
if (executable &&
!os::chmod(resource, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- cerr << "Failed to chmod " << resource << endl;
+ cerr << "Failed to chmod '" << resource << "'" << endl;
return -1;
}
Modified: incubator/mesos/trunk/src/slave/cgroups_isolator.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/cgroups_isolator.cpp?rev=1459438&r1=1459437&r2=1459438&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/cgroups_isolator.cpp (original)
+++ incubator/mesos/trunk/src/slave/cgroups_isolator.cpp Thu Mar 21 18:19:40 2013
@@ -543,8 +543,8 @@ void CgroupsIsolator::launchExecutor(
// First fetch the executor.
if (launcher.setup() < 0) {
- EXIT(1) << "Error setting up executor " << executorId
- << " for framework " << frameworkId;
+ EXIT(1) << "Failed to setup executor '" << executorId
+ << "' for framework " << frameworkId;
}
@@ -555,7 +555,7 @@ void CgroupsIsolator::launchExecutor(
// orphaned executor process unknown to the slave when doing
// recovery.
if (checkpoint) {
- std::cerr << "Checkpointing forked pid " << getpid() << std::endl;
+ std::cout << "Checkpointing forked pid " << getpid() << std::endl;
state::checkpoint(path.get(), stringify(getpid()));
}
@@ -568,9 +568,10 @@ void CgroupsIsolator::launchExecutor(
// http://www.kernel.org/doc/Documentation/cgroups/memory.txt
Try<Nothing> assign = cgroups::assign(hierarchy, info->name(), ::getpid());
if (assign.isError()) {
- LOG(FATAL) << "Failed to assign for executor " << executorId
- << " of framework " << frameworkId
- << ": " << assign.error();
+ EXIT(1) << "Failed to assign executor '" << executorId
+ << "' of framework " << frameworkId
+ << " to its own cgroup '" << paths::join(hierarchy, info->name())
+ << "' : " << assign.error();
}
// Now launch the executor (this function should not return).
Modified: incubator/mesos/trunk/src/slave/process_isolator.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/process_isolator.cpp?rev=1459438&r1=1459437&r2=1459438&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/process_isolator.cpp (original)
+++ incubator/mesos/trunk/src/slave/process_isolator.cpp Thu Mar 21 18:19:40 2013
@@ -176,7 +176,7 @@ void ProcessIsolator::launchExecutor(
while ((pid = setsid()) == -1) {
perror("Could not put executor in own session");
- std::cerr << "Forking another process and retrying ..." << std::endl;
+ std::cout << "Forking another process and retrying ..." << std::endl;
if ((pid = fork()) == -1) {
perror("Failed to fork to launch executor");
@@ -205,7 +205,7 @@ void ProcessIsolator::launchExecutor(
// orphaned executor process unknown to the slave when doing
// recovery.
if (checkpoint) {
- std::cerr << "Checkpointing forked pid " << getpid() << std::endl;
+ std::cout << "Checkpointing forked pid " << getpid() << std::endl;
state::checkpoint(path.get(), stringify(getpid()));
}
Modified: incubator/mesos/trunk/src/slave/state.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/state.cpp?rev=1459438&r1=1459437&r2=1459438&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/state.cpp (original)
+++ incubator/mesos/trunk/src/slave/state.cpp Thu Mar 21 18:19:40 2013
@@ -494,7 +494,7 @@ Try<Nothing> checkpoint(
const string& path,
const google::protobuf::Message& message)
{
- std::cerr << "Checkpointing " << message.GetDescriptor()->name()
+ std::cout << "Checkpointing " << message.GetDescriptor()->name()
<< " to '" << path << "'" << std::endl;
// Create the base directory.
@@ -517,7 +517,8 @@ Try<Nothing> checkpoint(
Try<Nothing> checkpoint(const std::string& path, const std::string& message)
{
- std::cerr << "Checkpointing '" << message << "' to " << path << std::endl;
+ std::cout << "Checkpointing '" << message << "' to '" << path << "'"
+ << std::endl;
// Create the base directory.
Try<Nothing> result = os::mkdir(os::dirname(path).get());