You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by tu...@apache.org on 2016/11/28 09:21:36 UTC
[1/2] apex-core git commit: APEXCORE-310 - Apex cli support to kill
the app by appname
Repository: apex-core
Updated Branches:
refs/heads/master 0be03527e -> 891ed3ae9
APEXCORE-310 - Apex cli support to kill the app by appname
Project: http://git-wip-us.apache.org/repos/asf/apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-core/commit/0727ec58
Tree: http://git-wip-us.apache.org/repos/asf/apex-core/tree/0727ec58
Diff: http://git-wip-us.apache.org/repos/asf/apex-core/diff/0727ec58
Branch: refs/heads/master
Commit: 0727ec58039d9348b57c845be0ef40798a589bec
Parents: a54e0b7
Author: deepak-narkhede <ma...@gmail.com>
Authored: Thu Oct 13 16:03:41 2016 +0530
Committer: deepak-narkhede <ma...@gmail.com>
Committed: Thu Nov 24 11:00:34 2016 +0530
----------------------------------------------------------------------
docs/apex_cli.md | 4 +--
.../java/com/datatorrent/stram/cli/ApexCli.java | 33 +++++++++++++++++---
2 files changed, 31 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/apex-core/blob/0727ec58/docs/apex_cli.md
----------------------------------------------------------------------
diff --git a/docs/apex_cli.md b/docs/apex_cli.md
index 0d17645..da62a82 100644
--- a/docs/apex_cli.md
+++ b/docs/apex_cli.md
@@ -71,7 +71,7 @@ get-jar-operator-properties jar-files-comma-separated operator-class-name
help [command]
Show help
-kill-app app-id [app-id ...]
+kill-app app-id/app-name [app-id/app-name ...]
Kill an app
launch [options] jar-file/json-file/properties-file/app-package-file [matching-app-name]
@@ -166,7 +166,7 @@ get-port-attributes operator-name port-name [attribute-name]
Get attributes of a port
get-recording-info [operator-id] [start-time]
Get tuple recording info
-kill-app [app-id ...]
+kill-app [<app-id/app-name> ...]
Kill an app
kill-container container-id [container-id ...]
Kill a container
http://git-wip-us.apache.org/repos/asf/apex-core/blob/0727ec58/engine/src/main/java/com/datatorrent/stram/cli/ApexCli.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/cli/ApexCli.java b/engine/src/main/java/com/datatorrent/stram/cli/ApexCli.java
index 3218b22..8a3ea9e 100644
--- a/engine/src/main/java/com/datatorrent/stram/cli/ApexCli.java
+++ b/engine/src/main/java/com/datatorrent/stram/cli/ApexCli.java
@@ -609,8 +609,8 @@ public class ApexCli
new Arg[]{new Arg("pattern")},
"List applications"));
globalCommands.put("kill-app", new CommandSpec(new KillAppCommand(),
- new Arg[]{new Arg("app-id")},
- new Arg[]{new VarArg("app-id")},
+ new Arg[]{new Arg("app-id/app-name")},
+ new Arg[]{new VarArg("app-id/app-name")},
"Kill an app"));
globalCommands.put("show-logical-plan", new OptionsCommandSpec(new ShowLogicalPlanCommand(),
new Arg[]{new FileArg("jar-file/app-package-file")},
@@ -710,7 +710,7 @@ public class ApexCli
"Shutdown an app"));
connectedCommands.put("kill-app", new CommandSpec(new KillAppCommand(),
null,
- new Arg[]{new VarArg("app-id")},
+ new Arg[]{new VarArg("app-id/app-name")},
"Kill an app"));
connectedCommands.put("wait", new CommandSpec(new WaitCommand(),
new Arg[]{new Arg("timeout")},
@@ -961,6 +961,24 @@ public class ApexCli
return result.toString();
}
+ protected ApplicationReport getApplicationByName(String appName)
+ {
+ if (appName == null) {
+ throw new CliException("Invalid application name provided by user");
+ }
+ List<ApplicationReport> appList = getApplicationList();
+ for (ApplicationReport ar : appList) {
+ if ((ar.getName().equals(appName)) &&
+ (ar.getYarnApplicationState() != YarnApplicationState.KILLED) &&
+ (ar.getYarnApplicationState() != YarnApplicationState.FINISHED)) {
+ LOG.debug("Application Name: {} Application ID: {} Application State: {}",
+ ar.getName(), ar.getApplicationId().toString(), YarnApplicationState.FINISHED);
+ return ar;
+ }
+ }
+ return null;
+ }
+
protected ApplicationReport getApplication(String appId)
{
List<ApplicationReport> appList = getApplicationList();
@@ -2263,7 +2281,14 @@ public class ApexCli
while (++i < args.length) {
app = getApplication(args[i]);
if (app == null) {
- throw new CliException("Streaming application with id " + args[i] + " is not found.");
+
+ /*
+ * try once again with application name type.
+ */
+ app = getApplicationByName(args[i]);
+ if (app == null) {
+ throw new CliException("Streaming application with id or name " + args[i] + " is not found.");
+ }
}
yarnClient.killApplication(app.getApplicationId());
if (app == currentApp) {
[2/2] apex-core git commit: Merge branch 'master' of
https://github.com/deepak-narkhede/apex-core
Posted by tu...@apache.org.
Merge branch 'master' of https://github.com/deepak-narkhede/apex-core
Project: http://git-wip-us.apache.org/repos/asf/apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-core/commit/891ed3ae
Tree: http://git-wip-us.apache.org/repos/asf/apex-core/tree/891ed3ae
Diff: http://git-wip-us.apache.org/repos/asf/apex-core/diff/891ed3ae
Branch: refs/heads/master
Commit: 891ed3ae92c351f11e417b30a8ada5c6c56767fb
Parents: 0be0352 0727ec5
Author: Tushar R. Gosavi <tu...@apache.org>
Authored: Mon Nov 28 14:36:36 2016 +0530
Committer: Tushar R. Gosavi <tu...@apache.org>
Committed: Mon Nov 28 14:36:36 2016 +0530
----------------------------------------------------------------------
docs/apex_cli.md | 4 +--
.../java/com/datatorrent/stram/cli/ApexCli.java | 33 +++++++++++++++++---
2 files changed, 31 insertions(+), 6 deletions(-)
----------------------------------------------------------------------