Unverified Commit 42b2178f authored by 高岩's avatar 高岩 Committed by GitHub

Fix the success info after a failed task submission (#1516)

parent 1d97f07d
...@@ -242,11 +242,11 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -242,11 +242,11 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
process.start(); process.start();
if (!config.isJarTask()) { if (!config.isJarTask()) {
JobResult jobResult = jobManager.executeSql(task.getStatement()); JobResult jobResult = jobManager.executeSql(task.getStatement());
process.finish("Submit Flink SQL succeed."); process.finish("Submit Flink SQL finished.");
return jobResult; return jobResult;
} else { } else {
JobResult jobResult = jobManager.executeJar(); JobResult jobResult = jobManager.executeJar();
process.finish("Submit Flink Jar succeed."); process.finish("Submit Flink Jar finished.");
return jobResult; return jobResult;
} }
} }
......
...@@ -542,6 +542,13 @@ public class JobManager { ...@@ -542,6 +542,13 @@ public class JobManager {
job.setJobId(gatewayResult.getAppId()); job.setJobId(gatewayResult.getAppId());
job.setJids(gatewayResult.getJids()); job.setJids(gatewayResult.getJids());
job.setJobManagerAddress(formatAddress(gatewayResult.getWebURL())); job.setJobManagerAddress(formatAddress(gatewayResult.getWebURL()));
if (gatewayResult.isSucess()){
job.setStatus(Job.JobStatus.SUCCESS);
}else {
job.setStatus(Job.JobStatus.FAILED);
job.setError(gatewayResult.getError());
}
} else { } else {
for (StatementParam item : jobParam.getExecute()) { for (StatementParam item : jobParam.getExecute()) {
executor.executeSql(item.getValue()); executor.executeSql(item.getValue());
...@@ -566,11 +573,15 @@ public class JobManager { ...@@ -566,11 +573,15 @@ public class JobManager {
.getResult(null); .getResult(null);
job.setResult(result); job.setResult(result);
} }
job.setStatus(Job.JobStatus.SUCCESS);
} }
} }
job.setEndTime(LocalDateTime.now()); job.setEndTime(LocalDateTime.now());
job.setStatus(Job.JobStatus.SUCCESS); if (job.getStatus().name().equals(Job.JobStatus.FAILED.name())){
failed();
}else {
success(); success();
}
} catch (Exception e) { } catch (Exception e) {
String error = LogUtil.getError("Exception in executing FlinkSQL:\n" + currentSql, e); String error = LogUtil.getError("Exception in executing FlinkSQL:\n" + currentSql, e);
job.setEndTime(LocalDateTime.now()); job.setEndTime(LocalDateTime.now());
...@@ -728,8 +739,16 @@ public class JobManager { ...@@ -728,8 +739,16 @@ public class JobManager {
job.setJids(gatewayResult.getJids()); job.setJids(gatewayResult.getJids());
job.setJobManagerAddress(formatAddress(gatewayResult.getWebURL())); job.setJobManagerAddress(formatAddress(gatewayResult.getWebURL()));
job.setEndTime(LocalDateTime.now()); job.setEndTime(LocalDateTime.now());
if (gatewayResult.isSucess()){
job.setStatus(Job.JobStatus.SUCCESS); job.setStatus(Job.JobStatus.SUCCESS);
success(); success();
}else {
job.setError(gatewayResult.getError());
job.setStatus(Job.JobStatus.FAILED);
failed();
}
} catch (Exception e) { } catch (Exception e) {
String error = LogUtil.getError( String error = LogUtil.getError(
"Exception in executing Jar:\n" + config.getGatewayConfig().getAppConfig().getUserJarPath(), e); "Exception in executing Jar:\n" + config.getGatewayConfig().getAppConfig().getUserJarPath(), e);
......
...@@ -65,4 +65,14 @@ public abstract class AbstractGatewayResult implements GatewayResult { ...@@ -65,4 +65,14 @@ public abstract class AbstractGatewayResult implements GatewayResult {
this.endTime = LocalDateTime.now(); this.endTime = LocalDateTime.now();
this.exceptionMsg = error; this.exceptionMsg = error;
} }
@Override
public boolean isSucess() {
return isSuccess;
}
@Override
public String getError() {
return exceptionMsg;
}
} }
...@@ -34,4 +34,8 @@ public interface GatewayResult { ...@@ -34,4 +34,8 @@ public interface GatewayResult {
String getWebURL(); String getWebURL();
List<String> getJids(); List<String> getJids();
String getError();
boolean isSucess();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment