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

Bulk import job status not changed after activation #6452

Draft
wants to merge 1 commit into
base: rel_7_6
Choose a base branch
from
Draft
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
@@ -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."
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ private ActivateJobResult doActivateNextReadyJob() {
String biJobId = null;
try {
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) {
ourLog.error("Failure while preparing bulk export extract", e);
myTxTemplate.execute(t -> {
Expand Down Expand Up @@ -256,6 +262,7 @@ public BulkImportJobJson fetchJob(String theBiJobId) {
}

@Override
@Transactional
public JobInfo getJobStatus(String theBiJobId) {
BulkImportJobEntity theJob = findJobByBiJobId(theBiJobId);
return new JobInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
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.BulkImportJobJson;
import ca.uhn.fhir.jpa.bulk.imprt.model.BulkImportJobStatusEnum;
import ca.uhn.fhir.jpa.bulk.imprt.model.JobFileRowProcessingModeEnum;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.subscription.channel.api.ChannelConsumerSettings;
Expand Down Expand Up @@ -166,6 +167,8 @@ public void testFlow_TransactionRows() {

ActivateJobResult activateJobOutcome = mySvc.activateNextReadyJob();
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);
assertNotNull(instance);
Expand Down Expand Up @@ -196,6 +199,8 @@ public void testFlow_WithTenantNamesInInput() {

ActivateJobResult activateJobOutcome = mySvc.activateNextReadyJob();
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);
assertNotNull(instance);
Expand Down
Loading