Hey Brenden, can you remove the '<< executor' in the line below?
+ CHECK(executor->launchedTasks.empty()) << executor;
This will print the pointer address:
➜ scratch cat output_operator.c
#include <iostream>
struct Executor {
};
int main() {
Executor* e = new Executor();
std::cout << e << std::endl;
}
➜ scratch g++ output_operator.c && ./a.out
0x7fca6b4000e0
On Tue, Jul 23, 2013 at 3:57 PM, <[email protected]> wrote:
> Updated Branches:
> refs/heads/master 35496d91a -> 765ff9bc2
>
>
> Terminate executors that aren't needed.
>
> If we launch an executor and then kill the task immediately after, make
> sure we also terminate the executor when there are no other tasks.
>
> Review: https://reviews.apache.org/r/11125
>
>
> Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
> Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/765ff9bc
> Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/765ff9bc
> Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/765ff9bc
>
> Branch: refs/heads/master
> Commit: 765ff9bc2ac5a12d4362f8235b572a37d646390a
> Parents: 35496d9
> Author: Brenden Matthews <[email protected]>
> Authored: Fri May 3 09:47:22 2013 -0700
> Committer: Brenden Matthews <[email protected]>
> Committed: Tue Jul 23 15:55:10 2013 -0700
>
> ----------------------------------------------------------------------
> src/slave/slave.cpp | 28 ++++++++++++++++++++++++----
> 1 file changed, 24 insertions(+), 4 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/mesos/blob/765ff9bc/src/slave/slave.cpp
> ----------------------------------------------------------------------
> diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
> index af1b487..54eaf8f 100644
> --- a/src/slave/slave.cpp
> +++ b/src/slave/slave.cpp
> @@ -1056,10 +1056,30 @@ void Slave::killTask(const FrameworkID&
> frameworkId, const TaskID& taskId)
>
> switch (executor->state) {
> case Executor::REGISTERING: {
> - LOG(WARNING) << "Removing queued task " << taskId
> - << " of framework " << frameworkId
> - << " because the executor '" << executor->id
> - << "' hasn't registered yet";
> + if (executor->queuedTasks.contains(taskId)) {
> + // We remove the task here so that if this executor registers at
> + // a later point in time it won't be sent this task.
> + LOG(WARNING) << "Removing queued task " << taskId
> + << " from executor '" << executor->id
> + << "' of framework " << frameworkId
> + << " because the executor hasn't registered yet";
> + executor->queuedTasks.erase(taskId);
> +
> + if (executor->queuedTasks.empty()) {
> + CHECK(executor->launchedTasks.empty()) << executor;
> + // This executor no longer has any running tasks, so kill it.
> + LOG(WARNING) << "Killing the unregistered executor '" <<
> executor->id
> + << "' of framework " << framework->id
> + << " because it has no tasks";
> + dispatch(
> + isolator, &Isolator::killExecutor, framework->id,
> executor->id);
> + }
> + } else {
> + LOG(WARNING) << "Cannot kill task " << taskId
> + << " of framework " << frameworkId
> + << " because the executor '" << executor->id
> + << "' hasn't registered yet";
> + }
>
> // NOTE: Sending a TASK_KILLED update removes the task from
> // Executor::queuedTasks, so that if the executor registers at
>
>