diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportJobCloser.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportJobCloser.java index e04b7ef6fcd..3c2fc0e91a7 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportJobCloser.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportJobCloser.java @@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.bulk.job; import ca.uhn.fhir.jpa.bulk.model.BulkJobStatusEnum; import ca.uhn.fhir.jpa.bulk.svc.BulkExportDaoSvc; +import org.slf4j.Logger; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.StepContribution; import org.springframework.batch.core.scope.context.ChunkContext; @@ -30,10 +31,14 @@ import org.springframework.batch.repeat.RepeatStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import static org.slf4j.LoggerFactory.getLogger; + /** * Will run before and after a job to set the status to whatever is appropriate. */ public class BulkExportJobCloser implements Tasklet { + private static final Logger ourLog = getLogger(BulkExportJobCloser.class); + @Value("#{jobExecutionContext['jobUUID']}") private String myJobUUID; @@ -44,8 +49,10 @@ public class BulkExportJobCloser implements Tasklet { @Override public RepeatStatus execute(StepContribution theStepContribution, ChunkContext theChunkContext) throws Exception { if (theChunkContext.getStepContext().getStepExecution().getJobExecution().getStatus() == BatchStatus.STARTED) { + ourLog.warn("Job Closer is setting job to COMPLETE!"); myBulkExportDaoSvc.setJobToStatus(myJobUUID, BulkJobStatusEnum.COMPLETE); } else { + ourLog.error("Job Closer is setting job to ERROR!"); myBulkExportDaoSvc.setJobToStatus(myJobUUID, BulkJobStatusEnum.ERROR); } return RepeatStatus.FINISHED; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportSvcImplR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportSvcImplR4Test.java index 2eb16764c3f..7d6ce91f87d 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportSvcImplR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportSvcImplR4Test.java @@ -340,7 +340,9 @@ public class BulkDataExportSvcImplR4Test extends BaseJpaR4Test { //create one itself, which means that its jobUUID isnt known until it starts. to get around this, we move public void awaitJobCompletion(JobExecution theJobExecution) throws InterruptedException { await().until(() -> { + ourLog.warn("Checking to see if jobExecution {} is finished", theJobExecution.getId()); JobExecution jobExecution = myJobExplorer.getJobExecution(theJobExecution.getId()); + ourLog.warn("That jobExecution currently has status: {}", jobExecution.getStatus()); return jobExecution.getStatus() == BatchStatus.COMPLETED; }); }