Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linkis cli async exeute throw npe #4870

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.commons.lang3.exception.ExceptionUtils;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -116,7 +117,7 @@ public JobResult run() {
// async job, return
if (isAsync) {
return new InteractiveJobResult(
submitResult.getJobStatus().isJobSubmitted(),
jobInfoResult.getJobStatus().isJobSubmitted(),
"Async Submission Success",
new HashMap<>());
}
Expand Down Expand Up @@ -171,7 +172,14 @@ private JobResult getResult(
"Job status is not success but \'"
+ jobInfoResult.getJobStatus()
+ "\'. Will not try to retrieve any Result");
return new InteractiveJobResult(false, "Execute Error!!!", new HashMap<>());
Map<String, String> extraMap = new HashMap<>();
if (jobInfoResult.getErrCode() != null) {
extraMap.put("errorCode", String.valueOf(jobInfoResult.getErrCode()));
}
if (StringUtils.isNotBlank(jobInfoResult.getErrDesc())) {
extraMap.put("errorDesc", jobInfoResult.getErrDesc());
}
return new InteractiveJobResult(false, "Execute Error!!!", extraMap);
}
InteractiveJobResult result =
new InteractiveJobResult(true, "Execute Success!!!", new HashMap<>());
Expand Down Expand Up @@ -246,6 +254,9 @@ public void onDestroy() {
logger.warn("Failed to kill job username or jobId is blank");
return;
}
if (isAsync) {
return;
}
try {
new JobKiller(oper).doKill(username, jobId);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,11 @@ public Message executeECMOperation(HttpServletRequest req, @RequestBody JsonNode
"Fail to process the operation parameters, cased by "
+ ExceptionUtils.getRootCauseMessage(e));
}
String engineConnInstance = (String) parameters.get("engineConnInstance");

return executeECMOperation(
ecmNode, engineConnInstance, new ECMOperateRequest(userName, parameters));
ecmNode,
parameters.getOrDefault("engineConnInstance", "").toString(),
new ECMOperateRequest(userName, parameters));
}

@ApiOperation(value = "openEngineLog", notes = "open Engine log", response = Message.class)
Expand Down
Loading