Skip to content

Commit

Permalink
#4918 fix bug:linkis cli npe error
Browse files Browse the repository at this point in the history
  • Loading branch information
sjgllgh committed Sep 26, 2023
1 parent 9b3080d commit 442fc53
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,17 @@ public JobResult run() {
LinkisOperResultAdapter jobInfoResult =
oper.queryJobInfo(submitResult.getUser(), submitResult.getJobID());
oper.queryJobStatus(
jobInfoResult.getUser(), jobInfoResult.getJobID(), jobInfoResult.getStrongerExecId());
submitResult.getUser(), submitResult.getJobID(), submitResult.getStrongerExecId());
infoBuilder.setLength(0);
infoBuilder
.append("JobId:")
.append(jobInfoResult.getJobID())
.append(submitResult.getJobID())
.append(System.lineSeparator())
.append("TaskId:")
.append(jobInfoResult.getJobID())
.append(submitResult.getJobID())
.append(System.lineSeparator())
.append("ExecId:")
.append(jobInfoResult.getStrongerExecId());
.append(submitResult.getStrongerExecId());
LoggerManager.getPlaintTextLogger().info(infoBuilder.toString());
infoBuilder.setLength(0);

Expand Down Expand Up @@ -137,7 +137,9 @@ public JobResult run() {
logRetriever.retrieveLogAsync();

// wait complete
jobInfoResult = waitJobComplete(submitResult.getUser(), submitResult.getJobID());
jobInfoResult =
waitJobComplete(
submitResult.getUser(), submitResult.getJobID(), submitResult.getStrongerExecId());
logRetriever.waitIncLogComplete();

// get result-set
Expand Down Expand Up @@ -205,19 +207,19 @@ private JobResult getResult(
return result;
}

private LinkisOperResultAdapter waitJobComplete(String user, String jobId)
private LinkisOperResultAdapter waitJobComplete(String user, String jobId, String execId)
throws LinkisClientRuntimeException {
int retryCnt = 0;
final int MAX_RETRY = 30;

LinkisOperResultAdapter jobInfoResult = oper.queryJobInfo(user, jobId);
oper.queryJobStatus(user, jobId, jobInfoResult.getStrongerExecId());
oper.queryJobStatus(user, jobId, execId);

while (!jobInfoResult.getJobStatus().isJobFinishedState()) {
// query progress
try {
jobInfoResult = oper.queryJobInfo(user, jobId);
oper.queryJobStatus(user, jobId, jobInfoResult.getStrongerExecId());
oper.queryJobStatus(user, jobId, execId);
} catch (Exception e) {
logger.warn("", e);
retryCnt++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public LinkisOperResultAdapter submit(InteractiveJobDesc jobDesc)
// jobExecuteResult = client.execute(jobExecuteAction);

jobSubmitResult = client.submit(jobSubmitAction);
logger.info("Response info from Linkis: \n{}", CliUtils.GSON.toJson(jobSubmitAction));
logger.info("Response info from Linkis: \n{}", CliUtils.GSON.toJson(jobSubmitResult));

} catch (Exception e) {
// must throw if exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ public String getStrongerExecId() {
return null;
}
String execId = null;

if (result instanceof JobSubmitResult) {
execId = ((JobSubmitResult) result).getExecID();
}
if (result instanceof JobInfoResult) {
if (result != null
&& ((JobInfoResult) result).getTask() != null
Expand Down

0 comments on commit 442fc53

Please sign in to comment.