Skip to content

Commit

Permalink
Merge pull request #1780 from alliance-genome/SCRUM-2726
Browse files Browse the repository at this point in the history
Added forced stopped job status
  • Loading branch information
oblodgett authored Jan 6, 2025
2 parents 55f4c59 + 316baa3 commit cdea6b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
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

0 comments on commit cdea6b2

Please sign in to comment.