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

fail zombie job attempts and add failure reason #8709

Merged
merged 2 commits into from
Dec 10, 2021
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 @@ -167,14 +167,20 @@ public void start() throws IOException {

private void cleanupZombies(final JobPersistence jobPersistence, final JobNotifier jobNotifier) throws IOException {
for (final Job zombieJob : jobPersistence.listJobsWithStatus(JobStatus.RUNNING)) {
jobNotifier.failJob("zombie job was cancelled", zombieJob);
jobNotifier.failJob("zombie job was failed", zombieJob);

final int currentAttemptNumber = zombieJob.getAttemptsCount() - 1;

LOGGER.warn(
"zombie clean up - job was cancelled. job id: {}, type: {}, scope: {}",
"zombie clean up - job attempt was failed. job id: {}, attempt number: {}, type: {}, scope: {}",
zombieJob.getId(),
currentAttemptNumber,
zombieJob.getConfigType(),
zombieJob.getScope());

jobPersistence.cancelJob(zombieJob.getId());
jobPersistence.failAttempt(
zombieJob.getId(),
currentAttemptNumber);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public interface JobPersistence {
int createAttempt(long jobId, Path logPath) throws IOException;

/**
* Sets an attempt to FAILED. Also attempts the parent job to FAILED. The job's status will not be
* changed if it is already in a terminal state.
* Sets an attempt to FAILED. Also attempts to set the parent job to INCOMPLETE. The job's status
* will not be changed if it is already in a terminal state.
*
* @param jobId job id
* @param attemptNumber attempt id
Expand All @@ -95,8 +95,8 @@ public interface JobPersistence {
void failAttempt(long jobId, int attemptNumber) throws IOException;

/**
* Sets an attempt to SUCCEEDED. Also attempts the parent job to SUCCEEDED. The job's status is
* changed regardless of what state it is in.
* Sets an attempt to SUCCEEDED. Also attempts to set the parent job to SUCCEEDED. The job's status
* is changed regardless of what state it is in.
*
* @param jobId job id
* @param attemptNumber attempt id
Expand Down