You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2016/03/31 15:32:02 UTC
[5/6] mesos git commit: WIP: mesos-execute.
WIP: mesos-execute.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c0f6ae86
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c0f6ae86
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c0f6ae86
Branch: refs/heads/master
Commit: c0f6ae86e69f4a8f4735407d3b0134672b0f531f
Parents: 1bbe485
Author: Alexander Rukletsov <al...@apache.org>
Authored: Wed Mar 30 16:54:30 2016 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Thu Mar 31 14:35:53 2016 +0200
----------------------------------------------------------------------
src/cli/execute.cpp | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c0f6ae86/src/cli/execute.cpp
----------------------------------------------------------------------
diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp
index af62f41..7ced232 100644
--- a/src/cli/execute.cpp
+++ b/src/cli/execute.cpp
@@ -262,6 +262,15 @@ protected:
task.mutable_agent_id()->MergeFrom(offer.agent_id());
task.mutable_resources()->CopyFrom(TASK_RESOURCES.get());
+
+ // Inject `KillPolicy` for testing.
+ task.mutable_kill_policy()->mutable_grace_period()->
+ set_nanoseconds(Seconds(11).ns());
+
+
+
+
+
CommandInfo* commandInfo = task.mutable_command();
if (shell) {
@@ -271,7 +280,12 @@ protected:
commandInfo->set_value(command.get());
} else {
// TODO(gilbert): Treat 'command' as executable value and arguments.
+ // TODO(alexr): Add support for arguments.
+
commandInfo->set_shell(false);
+
+ commandInfo->set_value(command.get());
+ commandInfo->add_arguments()->assign(command.get());
}
if (environment.isSome()) {
@@ -412,6 +426,23 @@ protected:
cout << "Received status update " << status.state()
<< " for task " << status.task_id() << endl;
+
+ if (mesos::v1::TASK_RUNNING == status.state()) {
+ Call call;
+ call.set_type(Call::KILL);
+
+ CHECK(frameworkInfo.has_id());
+ call.mutable_framework_id()->CopyFrom(frameworkInfo.id());
+
+ Call::Kill* kill = call.mutable_kill();
+ kill->mutable_task_id()->CopyFrom(status.task_id());
+ kill->mutable_agent_id()->CopyFrom(status.agent_id());
+
+ mesos->send(call);
+ }
+
+
+
if (status.has_uuid()) {
Call call;
call.set_type(Call::ACKNOWLEDGE);
Re: [5/6] mesos git commit: WIP: mesos-execute.
Posted by Alex R <al...@apache.org>.
Folks,
my apologies for this. The rogue patch has been reverted, all culprits are
punished.
AlexR.
On 31 March 2016 at 15:32, <al...@apache.org> wrote:
> WIP: mesos-execute.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
> Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c0f6ae86
> Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c0f6ae86
> Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c0f6ae86
>
> Branch: refs/heads/master
> Commit: c0f6ae86e69f4a8f4735407d3b0134672b0f531f
> Parents: 1bbe485
> Author: Alexander Rukletsov <al...@apache.org>
> Authored: Wed Mar 30 16:54:30 2016 +0200
> Committer: Alexander Rukletsov <al...@apache.org>
> Committed: Thu Mar 31 14:35:53 2016 +0200
>
> ----------------------------------------------------------------------
> src/cli/execute.cpp | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/mesos/blob/c0f6ae86/src/cli/execute.cpp
> ----------------------------------------------------------------------
> diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp
> index af62f41..7ced232 100644
> --- a/src/cli/execute.cpp
> +++ b/src/cli/execute.cpp
> @@ -262,6 +262,15 @@ protected:
> task.mutable_agent_id()->MergeFrom(offer.agent_id());
> task.mutable_resources()->CopyFrom(TASK_RESOURCES.get());
>
> +
> + // Inject `KillPolicy` for testing.
> + task.mutable_kill_policy()->mutable_grace_period()->
> + set_nanoseconds(Seconds(11).ns());
> +
> +
> +
> +
> +
> CommandInfo* commandInfo = task.mutable_command();
>
> if (shell) {
> @@ -271,7 +280,12 @@ protected:
> commandInfo->set_value(command.get());
> } else {
> // TODO(gilbert): Treat 'command' as executable value and
> arguments.
> + // TODO(alexr): Add support for arguments.
> +
> commandInfo->set_shell(false);
> +
> + commandInfo->set_value(command.get());
> + commandInfo->add_arguments()->assign(command.get());
> }
>
> if (environment.isSome()) {
> @@ -412,6 +426,23 @@ protected:
> cout << "Received status update " << status.state()
> << " for task " << status.task_id() << endl;
>
> +
> + if (mesos::v1::TASK_RUNNING == status.state()) {
> + Call call;
> + call.set_type(Call::KILL);
> +
> + CHECK(frameworkInfo.has_id());
> + call.mutable_framework_id()->CopyFrom(frameworkInfo.id());
> +
> + Call::Kill* kill = call.mutable_kill();
> + kill->mutable_task_id()->CopyFrom(status.task_id());
> + kill->mutable_agent_id()->CopyFrom(status.agent_id());
> +
> + mesos->send(call);
> + }
> +
> +
> +
> if (status.has_uuid()) {
> Call call;
> call.set_type(Call::ACKNOWLEDGE);
>
>
Re: [5/6] mesos git commit: WIP: mesos-execute.
Posted by Alex R <al...@apache.org>.
Folks,
my apologies for this. The rogue patch has been reverted, all culprits are
punished.
AlexR.
On 31 March 2016 at 15:32, <al...@apache.org> wrote:
> WIP: mesos-execute.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
> Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c0f6ae86
> Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c0f6ae86
> Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c0f6ae86
>
> Branch: refs/heads/master
> Commit: c0f6ae86e69f4a8f4735407d3b0134672b0f531f
> Parents: 1bbe485
> Author: Alexander Rukletsov <al...@apache.org>
> Authored: Wed Mar 30 16:54:30 2016 +0200
> Committer: Alexander Rukletsov <al...@apache.org>
> Committed: Thu Mar 31 14:35:53 2016 +0200
>
> ----------------------------------------------------------------------
> src/cli/execute.cpp | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/mesos/blob/c0f6ae86/src/cli/execute.cpp
> ----------------------------------------------------------------------
> diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp
> index af62f41..7ced232 100644
> --- a/src/cli/execute.cpp
> +++ b/src/cli/execute.cpp
> @@ -262,6 +262,15 @@ protected:
> task.mutable_agent_id()->MergeFrom(offer.agent_id());
> task.mutable_resources()->CopyFrom(TASK_RESOURCES.get());
>
> +
> + // Inject `KillPolicy` for testing.
> + task.mutable_kill_policy()->mutable_grace_period()->
> + set_nanoseconds(Seconds(11).ns());
> +
> +
> +
> +
> +
> CommandInfo* commandInfo = task.mutable_command();
>
> if (shell) {
> @@ -271,7 +280,12 @@ protected:
> commandInfo->set_value(command.get());
> } else {
> // TODO(gilbert): Treat 'command' as executable value and
> arguments.
> + // TODO(alexr): Add support for arguments.
> +
> commandInfo->set_shell(false);
> +
> + commandInfo->set_value(command.get());
> + commandInfo->add_arguments()->assign(command.get());
> }
>
> if (environment.isSome()) {
> @@ -412,6 +426,23 @@ protected:
> cout << "Received status update " << status.state()
> << " for task " << status.task_id() << endl;
>
> +
> + if (mesos::v1::TASK_RUNNING == status.state()) {
> + Call call;
> + call.set_type(Call::KILL);
> +
> + CHECK(frameworkInfo.has_id());
> + call.mutable_framework_id()->CopyFrom(frameworkInfo.id());
> +
> + Call::Kill* kill = call.mutable_kill();
> + kill->mutable_task_id()->CopyFrom(status.task_id());
> + kill->mutable_agent_id()->CopyFrom(status.agent_id());
> +
> + mesos->send(call);
> + }
> +
> +
> +
> if (status.has_uuid()) {
> Call call;
> call.set_type(Call::ACKNOWLEDGE);
>
>