编程语言
首页 > 编程语言> > 在java里向spark请求处理

在java里向spark请求处理

作者:互联网

打印spark处理失败的日志

SparkLauncher launcher = sparkJobUtil.buildSparkLauncher(feedConfig, appName, params);
SparkAppHandle handler = launcher.startApplication();
int exitCode = -1;
while (handler.getState() == null || !handler.getState().isFinal()) {
if (handler.getState() != null) {
if (handler.getState().equals(SparkAppHandle.State.FINISHED)) {
log.info("instance id {} App id: {} is finished ", omFeed.getInstanceId(), handler.getAppId());
exitCode = 0;
}
}
}
if (handler.getError().isPresent()) {
log.error("instance id {} app id fail fail ", omFeed.getInstanceId(), handler.getAppId());
handler.getError().get().printStackTrace();
}else{
log.error("instance id {} app id run success ", omFeed.getInstanceId(), handler.getAppId());
exitCode = 0 ;
}

标签:omFeed,getState,java,请求,getInstanceId,handler,spark,id,log
来源: https://www.cnblogs.com/ivyJ/p/16375855.html