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

[Improve] [Zeta] [Client] Fix Client Not Throw Exception When Error Msg Is Null #4107

Merged
merged 2 commits into from
Feb 13, 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 @@ -211,7 +211,8 @@ private String creatRandomClusterName(String namePrefix) {

private void shutdownHook(ClientJobProxy clientJobProxy) {
if (clientCommandArgs.isCloseJob()) {
if (jobStatus == null || !jobStatus.isEndState()) {
if (clientJobProxy.getJobResultCache() == null
&& (jobStatus == null || !jobStatus.isEndState())) {
log.warn("Task will be closed due to client shutdown.");
clientJobProxy.cancelJob();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class ClientJobProxy implements Job {
private static final ILogger LOGGER = Logger.getLogger(ClientJobProxy.class);
private final SeaTunnelHazelcastClient seaTunnelHazelcastClient;
private final JobImmutableInformation jobImmutableInformation;
private JobResult jobResult;

public ClientJobProxy(
@NonNull SeaTunnelHazelcastClient seaTunnelHazelcastClient,
Expand Down Expand Up @@ -81,7 +82,6 @@ private void submitJob() {
*/
@Override
public JobStatus waitForJobComplete() {
JobResult jobResult;
try {
jobResult =
RetryUtils.retryWithException(
Expand Down Expand Up @@ -113,12 +113,17 @@ public JobStatus waitForJobComplete() {
jobImmutableInformation.getJobConfig().getName(),
jobImmutableInformation.getJobId(),
jobResult.getStatus()));
if (StringUtils.isNotEmpty(jobResult.getError())) {
if (StringUtils.isNotEmpty(jobResult.getError())
|| jobResult.getStatus().equals(JobStatus.FAILED)) {
throw new SeaTunnelEngineException(jobResult.getError());
}
return jobResult.getStatus();
}

public JobResult getJobResultCache() {
return jobResult;
}

@Override
public PassiveCompletableFuture<JobResult> doWaitForJobComplete() {
return new PassiveCompletableFuture<>(
Expand Down