Bulk Import job status not changed after activation - failing test, fix, changelog (#6452)
This commit is contained in:
parent
7faf0f7731
commit
c0de4cd88b
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
type: fix
|
||||||
|
issue: 6451
|
||||||
|
jira: SMILE-9089
|
||||||
|
title: "Previously, activating `BulkDataImport` job would not change jobs status to `RUNNING`,
|
||||||
|
causing it to be processed multiple times instead of single time. This has been fixed."
|
|
@ -217,6 +217,12 @@ public class BulkDataImportSvcImpl implements IBulkDataImportSvc, IHasScheduledJ
|
||||||
String biJobId = null;
|
String biJobId = null;
|
||||||
try {
|
try {
|
||||||
biJobId = processJob(bulkImportJobEntity);
|
biJobId = processJob(bulkImportJobEntity);
|
||||||
|
// set job status to RUNNING so it would not be processed again
|
||||||
|
myTxTemplate.execute(t -> {
|
||||||
|
bulkImportJobEntity.setStatus(BulkImportJobStatusEnum.RUNNING);
|
||||||
|
myJobDao.save(bulkImportJobEntity);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ourLog.error("Failure while preparing bulk export extract", e);
|
ourLog.error("Failure while preparing bulk export extract", e);
|
||||||
myTxTemplate.execute(t -> {
|
myTxTemplate.execute(t -> {
|
||||||
|
@ -256,6 +262,7 @@ public class BulkDataImportSvcImpl implements IBulkDataImportSvc, IHasScheduledJ
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public JobInfo getJobStatus(String theBiJobId) {
|
public JobInfo getJobStatus(String theBiJobId) {
|
||||||
BulkImportJobEntity theJob = findJobByBiJobId(theBiJobId);
|
BulkImportJobEntity theJob = findJobByBiJobId(theBiJobId);
|
||||||
return new JobInfo()
|
return new JobInfo()
|
||||||
|
|
|
@ -17,6 +17,7 @@ import ca.uhn.fhir.jpa.bulk.imprt.api.IBulkDataImportSvc;
|
||||||
import ca.uhn.fhir.jpa.bulk.imprt.model.ActivateJobResult;
|
import ca.uhn.fhir.jpa.bulk.imprt.model.ActivateJobResult;
|
||||||
import ca.uhn.fhir.jpa.bulk.imprt.model.BulkImportJobFileJson;
|
import ca.uhn.fhir.jpa.bulk.imprt.model.BulkImportJobFileJson;
|
||||||
import ca.uhn.fhir.jpa.bulk.imprt.model.BulkImportJobJson;
|
import ca.uhn.fhir.jpa.bulk.imprt.model.BulkImportJobJson;
|
||||||
|
import ca.uhn.fhir.jpa.bulk.imprt.model.BulkImportJobStatusEnum;
|
||||||
import ca.uhn.fhir.jpa.bulk.imprt.model.JobFileRowProcessingModeEnum;
|
import ca.uhn.fhir.jpa.bulk.imprt.model.JobFileRowProcessingModeEnum;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.jpa.subscription.channel.api.ChannelConsumerSettings;
|
import ca.uhn.fhir.jpa.subscription.channel.api.ChannelConsumerSettings;
|
||||||
|
@ -166,6 +167,8 @@ public class BulkDataImportR4Test extends BaseJpaR4Test implements ITestDataBuil
|
||||||
|
|
||||||
ActivateJobResult activateJobOutcome = mySvc.activateNextReadyJob();
|
ActivateJobResult activateJobOutcome = mySvc.activateNextReadyJob();
|
||||||
assertTrue(activateJobOutcome.isActivated);
|
assertTrue(activateJobOutcome.isActivated);
|
||||||
|
// validate that job changed status from READY to RUNNING
|
||||||
|
assertEquals(BulkImportJobStatusEnum.RUNNING, mySvc.getJobStatus(jobId).getStatus());
|
||||||
|
|
||||||
JobInstance instance = myBatch2JobHelper.awaitJobCompletion(activateJobOutcome.jobId, 60);
|
JobInstance instance = myBatch2JobHelper.awaitJobCompletion(activateJobOutcome.jobId, 60);
|
||||||
assertNotNull(instance);
|
assertNotNull(instance);
|
||||||
|
@ -196,6 +199,8 @@ public class BulkDataImportR4Test extends BaseJpaR4Test implements ITestDataBuil
|
||||||
|
|
||||||
ActivateJobResult activateJobOutcome = mySvc.activateNextReadyJob();
|
ActivateJobResult activateJobOutcome = mySvc.activateNextReadyJob();
|
||||||
assertTrue(activateJobOutcome.isActivated);
|
assertTrue(activateJobOutcome.isActivated);
|
||||||
|
// validate that job changed status from READY to RUNNING
|
||||||
|
assertEquals(BulkImportJobStatusEnum.RUNNING, mySvc.getJobStatus(jobId).getStatus());
|
||||||
|
|
||||||
JobInstance instance = myBatch2JobHelper.awaitJobCompletion(activateJobOutcome.jobId);
|
JobInstance instance = myBatch2JobHelper.awaitJobCompletion(activateJobOutcome.jobId);
|
||||||
assertNotNull(instance);
|
assertNotNull(instance);
|
||||||
|
|
Loading…
Reference in New Issue