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

Added forced stopped job status #1780

Merged
merged 1 commit into from
Jan 6, 2025
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 @@ -4,11 +4,11 @@ public enum JobStatus {

SCHEDULED_PENDING, SCHEDULED_STARTED, SCHEDULED_RUNNING,

FORCED_PENDING, FORCED_STARTED, FORCED_RUNNING,
FORCED_PENDING, FORCED_STARTED, FORCED_RUNNING, FORCED_STOPPED,

MANUAL_PENDING, MANUAL_STARTED, MANUAL_RUNNING,

FAILED, STOPPED, FINISHED,
FAILED, STOPPED, FINISHED

;

Expand All @@ -25,7 +25,7 @@ public boolean isStarted() {
}

public boolean isNotRunning() {
return this == FAILED || this == STOPPED || this == FINISHED;
return this == FAILED || this == STOPPED || this == FINISHED || this == FORCED_STOPPED;
}

public JobStatus getNextStatus() {
Expand Down Expand Up @@ -54,6 +54,6 @@ public JobStatus getNextStatus() {
}

public boolean isForced() {
return this == FORCED_PENDING || this == FORCED_STARTED || this == FORCED_RUNNING;
return this == FORCED_PENDING || this == FORCED_STARTED || this == FORCED_RUNNING || this == FORCED_STOPPED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ protected <E extends AuditedObject, T extends BaseDTO> boolean runLoad(BaseUpser
}

protected <E extends AuditedObject, T extends BaseDTO> boolean runLoad(BaseUpsertServiceInterface<E, T> service, BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List<T> objectList, List<Long> idsAdded, Boolean terminateFailing, String countType, String dataType) {
if (Thread.currentThread().isInterrupted()) {
return false;
}
ProcessDisplayHelper ph = new ProcessDisplayHelper();
ph.addDisplayHandler(loadProcessDisplayService);
if (CollectionUtils.isNotEmpty(objectList)) {
Expand Down Expand Up @@ -256,6 +259,7 @@ protected <E extends AuditedObject, T extends BaseDTO> boolean runLoad(BaseUpser
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
history.setBulkloadStatus(JobStatus.FORCED_STOPPED);
Log.info("Thread Interrupted:");
break;
}
Expand All @@ -273,6 +277,9 @@ protected <E extends AuditedObject, T extends BaseDTO> boolean runLoad(BaseUpser

// The following methods are for bulk validation
protected <S extends BaseEntityCrudService<?, ?>> void runCleanup(S service, BulkLoadFileHistory history, String dataProviderName, List<Long> annotationIdsBefore, List<Long> annotationIdsAfter, String loadTypeString, Boolean deprecate) {
if (Thread.currentThread().isInterrupted()) {
return;
}
Log.debug("runLoad: After: " + dataProviderName + " " + annotationIdsAfter.size());

List<Long> distinctAfter = annotationIdsAfter.stream().distinct().collect(Collectors.toList());
Expand Down Expand Up @@ -307,6 +314,7 @@ protected <E extends AuditedObject, T extends BaseDTO> boolean runLoad(BaseUpser
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
history.setBulkloadStatus(JobStatus.FORCED_STOPPED);
Log.info("Thread Interrupted:");
break;
}
Expand Down
Loading