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
process.start();
if (!config.isJarTask()) {
JobResult jobResult = jobManager.executeSql(task.getStatement());
process.finish("Submit Flink SQL succeed.");
process.finish("Submit Flink SQL finished.");
return jobResult;
} else {
JobResult jobResult = jobManager.executeJar();
process.finish("Submit Flink Jar succeed.");
process.finish("Submit Flink Jar finished.");
return jobResult;
}
}
......
......@@ -542,6 +542,13 @@ public class JobManager {
job.setJobId(gatewayResult.getAppId());
job.setJids(gatewayResult.getJids());
job.setJobManagerAddress(formatAddress(gatewayResult.getWebURL()));
if (gatewayResult.isSucess()){
job.setStatus(Job.JobStatus.SUCCESS);
}else {
job.setStatus(Job.JobStatus.FAILED);
job.setError(gatewayResult.getError());
}
} else {
for (StatementParam item : jobParam.getExecute()) {
executor.executeSql(item.getValue());
......@@ -566,11 +573,15 @@ public class JobManager {
.getResult(null);
job.setResult(result);
}
job.setStatus(Job.JobStatus.SUCCESS);
}
}
job.setEndTime(LocalDateTime.now());
job.setStatus(Job.JobStatus.SUCCESS);
success();
if (job.getStatus().name().equals(Job.JobStatus.FAILED.name())){
failed();
}else {
success();
}
} catch (Exception e) {
String error = LogUtil.getError("Exception in executing FlinkSQL:\n" + currentSql, e);
job.setEndTime(LocalDateTime.now());
......@@ -728,8 +739,16 @@ public class JobManager {
job.setJids(gatewayResult.getJids());
job.setJobManagerAddress(formatAddress(gatewayResult.getWebURL()));
job.setEndTime(LocalDateTime.now());
job.setStatus(Job.JobStatus.SUCCESS);
success();
if (gatewayResult.isSucess()){
job.setStatus(Job.JobStatus.SUCCESS);
success();
}else {
job.setError(gatewayResult.getError());
job.setStatus(Job.JobStatus.FAILED);
failed();
}
} catch (Exception e) {
String error = LogUtil.getError(
"Exception in executing Jar:\n" + config.getGatewayConfig().getAppConfig().getUserJarPath(), e);
......
......@@ -65,4 +65,14 @@ public abstract class AbstractGatewayResult implements GatewayResult {
this.endTime = LocalDateTime.now();
this.exceptionMsg = error;
}
@Override
public boolean isSucess() {
return isSuccess;
}
@Override
public String getError() {
return exceptionMsg;
}
}
......@@ -34,4 +34,8 @@ public interface GatewayResult {
String getWebURL();
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