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 npe error #4919

Merged
merged 3 commits into from
Oct 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 @@ -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