shaofengshi closed pull request #227: KYLIN-3551 check spark counter path exists
URL: https://github.com/apache/kylin/pull/227
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/engine-spark/src/main/java/org/apache/kylin/engine/spark/SparkExecutable.java
b/engine-spark/src/main/java/org/apache/kylin/engine/spark/SparkExecutable.java
index c49f8a0cad..f4f06be299 100644
---
a/engine-spark/src/main/java/org/apache/kylin/engine/spark/SparkExecutable.java
+++
b/engine-spark/src/main/java/org/apache/kylin/engine/spark/SparkExecutable.java
@@ -31,6 +31,7 @@
import java.util.concurrent.Future;
import org.apache.commons.lang.StringUtils;
+import org.apache.hadoop.fs.Path;
import org.apache.hadoop.util.Shell;
import org.apache.kylin.common.KylinConfig;
import org.apache.kylin.common.KylinConfigExt;
@@ -311,24 +312,25 @@ public void onLogEvent(String infoKey, Map<String,
String> info) {
throw new IllegalStateException();
}
- // done, update all properties
- Map<String, String> joblogInfo = patternedLogger.getInfo();
-
- // read counter from hdfs
- String counterOutput =
getParam(BatchConstants.ARG_COUNTER_OUPUT);
- if (counterOutput != null) {
- Map<String, String> counterMap =
HadoopUtil.readFromSequenceFile(counterOutput);
- joblogInfo.putAll(counterMap);
- }
-
- readCounters(joblogInfo);
- getManager().addJobInfo(getId(), joblogInfo);
if (result == null) {
result = future.get();
}
-
if (result != null && result.getFirst() == 0) {
+ // done, update all properties
+ Map<String, String> joblogInfo = patternedLogger.getInfo();
+ // read counter from hdfs
+ String counterOutput =
getParam(BatchConstants.ARG_COUNTER_OUPUT);
+ if (counterOutput != null) {
+ if (HadoopUtil.getWorkingFileSystem().exists(new
Path(counterOutput))) {
+ Map<String, String> counterMap =
HadoopUtil.readFromSequenceFile(counterOutput);
+ joblogInfo.putAll(counterMap);
+ } else {
+ logger.warn("Spark counter output path not
exists");
+ }
+ }
+ readCounters(joblogInfo);
+ getManager().addJobInfo(getId(), joblogInfo);
return new ExecuteResult(ExecuteResult.State.SUCCEED,
patternedLogger.getBufferedLog());
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services