You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2014/06/30 22:44:40 UTC
[1/3] git commit: STORM-266: Adding shell process pid and name in the
log message and pid, name,
exitcode and stderr in case te shell process encounters error.
Repository: incubator-storm
Updated Branches:
refs/heads/master 5f2d05a43 -> 004c05ebf
STORM-266: Adding shell process pid and name in the log message and pid,name,exitcode and stderr in case te shell process encounters error.
Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/0c43a37f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/0c43a37f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/0c43a37f
Branch: refs/heads/master
Commit: 0c43a37f000298af17a11b6fe6e78dbb35e27ee8
Parents: ecac64f
Author: Parth Brahmbhatt <br...@gmail.com>
Authored: Tue Jun 17 15:13:36 2014 -0700
Committer: Parth Brahmbhatt <br...@gmail.com>
Committed: Tue Jun 17 15:13:36 2014 -0700
----------------------------------------------------------------------
.../jvm/backtype/storm/spout/ShellSpout.java | 7 +--
.../src/jvm/backtype/storm/task/ShellBolt.java | 9 ++--
.../jvm/backtype/storm/utils/ShellProcess.java | 46 ++++++++++++++++++--
3 files changed, 52 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/0c43a37f/storm-core/src/jvm/backtype/storm/spout/ShellSpout.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/spout/ShellSpout.java b/storm-core/src/jvm/backtype/storm/spout/ShellSpout.java
index d6a18e7..0a37e6a 100644
--- a/storm-core/src/jvm/backtype/storm/spout/ShellSpout.java
+++ b/storm-core/src/jvm/backtype/storm/spout/ShellSpout.java
@@ -97,7 +97,7 @@ public class ShellSpout implements ISpout {
return;
} else if (command.equals("log")) {
String msg = shellMsg.getMsg();
- LOG.info("Shell msg: " + msg);
+ LOG.info("Shell msg: " + msg + _process.getProcessInfoString());
} else if (command.equals("emit")) {
String stream = shellMsg.getStream();
Long task = shellMsg.getTask();
@@ -115,8 +115,9 @@ public class ShellSpout implements ISpout {
throw new RuntimeException("Unknown command received: " + command);
}
}
- } catch (IOException e) {
- throw new RuntimeException(e);
+ } catch (Exception e) {
+ String processInfo = _process.getProcessInfoString() + _process.getProcessTerminationInfoString();
+ throw new RuntimeException(processInfo, e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/0c43a37f/storm-core/src/jvm/backtype/storm/task/ShellBolt.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/task/ShellBolt.java b/storm-core/src/jvm/backtype/storm/task/ShellBolt.java
index 81aca02..532545f 100644
--- a/storm-core/src/jvm/backtype/storm/task/ShellBolt.java
+++ b/storm-core/src/jvm/backtype/storm/task/ShellBolt.java
@@ -115,7 +115,7 @@ public class ShellBolt implements IBolt {
handleError(shellMsg.getMsg());
} else if (command.equals("log")) {
String msg = shellMsg.getMsg();
- LOG.info("Shell msg: " + msg);
+ LOG.info("Shell msg: " + msg + _process.getProcessInfoString());
} else if (command.equals("emit")) {
handleEmit(shellMsg);
}
@@ -170,7 +170,8 @@ public class ShellBolt implements IBolt {
_pendingWrites.put(boltMsg);
} catch(InterruptedException e) {
- throw new RuntimeException("Error during multilang processing", e);
+ String processInfo = _process.getProcessInfoString() + _process.getProcessTerminationInfoString();
+ throw new RuntimeException("Error during multilang processing " + processInfo, e);
}
}
@@ -225,6 +226,8 @@ public class ShellBolt implements IBolt {
}
private void die(Throwable exception) {
- _exception = exception;
+ String processInfo = _process.getProcessInfoString() + _process.getProcessTerminationInfoString();
+ _exception = new RuntimeException(processInfo, exception);
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/0c43a37f/storm-core/src/jvm/backtype/storm/utils/ShellProcess.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/utils/ShellProcess.java b/storm-core/src/jvm/backtype/storm/utils/ShellProcess.java
index 7455c9b..79e7d50 100644
--- a/storm-core/src/jvm/backtype/storm/utils/ShellProcess.java
+++ b/storm-core/src/jvm/backtype/storm/utils/ShellProcess.java
@@ -41,6 +41,8 @@ public class ShellProcess implements Serializable {
private InputStream processErrorStream;
private String[] command;
public ISerializer serializer;
+ public Number pid;
+ public String componentName;
public ShellProcess(String[] command) {
this.command = command;
@@ -52,14 +54,14 @@ public class ShellProcess implements Serializable {
ShellLogger = Logger.getLogger(context.getThisComponentId());
+ this.componentName = context.getThisComponentId();
this.serializer = getSerializer(conf);
- Number pid;
try {
_subprocess = builder.start();
processErrorStream = _subprocess.getErrorStream();
serializer.initialize(_subprocess.getOutputStream(), _subprocess.getInputStream());
- pid = serializer.connect(conf, context);
+ this.pid = serializer.connect(conf, context);
} catch (IOException e) {
throw new RuntimeException(
"Error when launching multilang subprocess\n"
@@ -67,7 +69,7 @@ public class ShellProcess implements Serializable {
} catch (NoOutputException e) {
throw new RuntimeException(e + getErrorsString() + "\n");
}
- return pid;
+ return this.pid;
}
private ISerializer getSerializer(Map conf) {
@@ -141,4 +143,40 @@ public class ShellProcess implements Serializable {
return "";
}
}
-}
+
+ /**
+ *
+ * @return pid, if the process has been launched, null otherwise.
+ */
+ public Number getPid() {
+ return this.pid;
+ }
+
+ /**
+ *
+ * @return the name of component.
+ */
+ public String getComponentName() {
+ return this.componentName;
+ }
+
+ /**
+ *
+ * @return exit code of the process if process is terminated, -1 if process is not started or terminated.
+ */
+ public int getExitCode() {
+ try {
+ return this._subprocess != null ? this._subprocess.exitValue() : -1;
+ } catch(IllegalThreadStateException e) {
+ return -1;
+ }
+ }
+
+ public String getProcessInfoString() {
+ return String.format(" pid:%s, name:%s ", pid, componentName);
+ }
+
+ public String getProcessTerminationInfoString() {
+ return String.format(" exitCode:%s, errorString:%s ", getExitCode(), getErrorsString());
+ }
+}
\ No newline at end of file
[3/3] git commit: Added STORM-266 to Changelog
Posted by bo...@apache.org.
Added STORM-266 to Changelog
Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/004c05eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/004c05eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/004c05eb
Branch: refs/heads/master
Commit: 004c05ebf9ec23426e5816eff9840da3172863d3
Parents: afbcfcf
Author: Robert (Bobby) Evans <bo...@apache.org>
Authored: Mon Jun 30 15:39:46 2014 -0500
Committer: Robert (Bobby) Evans <bo...@apache.org>
Committed: Mon Jun 30 15:39:46 2014 -0500
----------------------------------------------------------------------
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/004c05eb/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 57cae29..7028016 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@
* STORM-370: Add check for empty table before sorting dom in UI
* STORM-359: add logviewer paging and download
* STORM-372: Typo in storm_env.ini
+ * STORM-266: Adding shell process pid and name in the log message
## 0.9.2-incubating
* STORM-66: send taskid on initial handshake
[2/3] git commit: Merge branch 'STORM-266' of
https://github.com/Parth-Brahmbhatt/incubator-storm into STORM-266
Posted by bo...@apache.org.
Merge branch 'STORM-266' of https://github.com/Parth-Brahmbhatt/incubator-storm into STORM-266
STORM-266: Adding shell process pid and name in the log message
Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/afbcfcf8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/afbcfcf8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/afbcfcf8
Branch: refs/heads/master
Commit: afbcfcf82c8ffd305378d0312b4c28ea9c09300a
Parents: 5f2d05a 0c43a37
Author: Robert (Bobby) Evans <bo...@apache.org>
Authored: Mon Jun 30 15:39:15 2014 -0500
Committer: Robert (Bobby) Evans <bo...@apache.org>
Committed: Mon Jun 30 15:39:15 2014 -0500
----------------------------------------------------------------------
.../jvm/backtype/storm/spout/ShellSpout.java | 7 +--
.../src/jvm/backtype/storm/task/ShellBolt.java | 9 ++--
.../jvm/backtype/storm/utils/ShellProcess.java | 46 ++++++++++++++++++--
3 files changed, 52 insertions(+), 10 deletions(-)
----------------------------------------------------------------------