Skip to content

Commit 2d55198

Browse files
lmossmanjrhizor
authored andcommitted
fail zombie job attempts and add failure reason (#8709)
* fail zombie job attempts and add failure reason * remove failure reason
1 parent 559db88 commit 2d55198

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

airbyte-scheduler/app/src/main/java/io/airbyte/scheduler/app/SchedulerApp.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,20 @@ public void start() throws IOException {
167167

168168
private void cleanupZombies(final JobPersistence jobPersistence, final JobNotifier jobNotifier) throws IOException {
169169
for (final Job zombieJob : jobPersistence.listJobsWithStatus(JobStatus.RUNNING)) {
170-
jobNotifier.failJob("zombie job was cancelled", zombieJob);
170+
jobNotifier.failJob("zombie job was failed", zombieJob);
171+
172+
final int currentAttemptNumber = zombieJob.getAttemptsCount() - 1;
173+
171174
LOGGER.warn(
172-
"zombie clean up - job was cancelled. job id: {}, type: {}, scope: {}",
175+
"zombie clean up - job attempt was failed. job id: {}, attempt number: {}, type: {}, scope: {}",
173176
zombieJob.getId(),
177+
currentAttemptNumber,
174178
zombieJob.getConfigType(),
175179
zombieJob.getScope());
176180

177-
jobPersistence.cancelJob(zombieJob.getId());
181+
jobPersistence.failAttempt(
182+
zombieJob.getId(),
183+
currentAttemptNumber);
178184
}
179185
}
180186

airbyte-scheduler/persistence/src/main/java/io/airbyte/scheduler/persistence/JobPersistence.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ public interface JobPersistence {
8585
int createAttempt(long jobId, Path logPath) throws IOException;
8686

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

9797
/**
98-
* Sets an attempt to SUCCEEDED. Also attempts the parent job to SUCCEEDED. The job's status is
99-
* changed regardless of what state it is in.
98+
* Sets an attempt to SUCCEEDED. Also attempts to set the parent job to SUCCEEDED. The job's status
99+
* is changed regardless of what state it is in.
100100
*
101101
* @param jobId job id
102102
* @param attemptNumber attempt id

0 commit comments

Comments
 (0)