Running batch job

This commit is contained in:
Tadgh 2020-06-02 16:08:19 -07:00
parent 31b7e862d4
commit e8970bce46
5 changed files with 12 additions and 16 deletions

View File

@ -50,10 +50,6 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 {
return new CircularQueueCaptureQueriesListener(); return new CircularQueueCaptureQueriesListener();
} }
@Bean
public IBatchJobSubmitter batchJobSubmitter() {
return new BatchJobSubmitterImpl();
}
@Bean @Bean
public BasicDataSource basicDataSource() { public BasicDataSource basicDataSource() {

View File

@ -1,5 +1,7 @@
package ca.uhn.fhir.jpa.config; package ca.uhn.fhir.jpa.config;
import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter;
import ca.uhn.fhir.jpa.batch.svc.BatchJobSubmitterImpl;
import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc; import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc;
import ca.uhn.fhir.jpa.binstore.MemoryBinaryStorageSvcImpl; import ca.uhn.fhir.jpa.binstore.MemoryBinaryStorageSvcImpl;
import ca.uhn.fhir.jpa.bulk.batch.BulkItemReader; import ca.uhn.fhir.jpa.bulk.batch.BulkItemReader;
@ -67,6 +69,11 @@ public class TestR4Config extends BaseJavaConfigR4 {
private Exception myLastStackTrace; private Exception myLastStackTrace;
@Bean
public IBatchJobSubmitter batchJobSubmitter() {
return new BatchJobSubmitterImpl();
}
@Bean @Bean
public CircularQueueCaptureQueriesListener captureQueriesListener() { public CircularQueueCaptureQueriesListener captureQueriesListener() {
return new CircularQueueCaptureQueriesListener(); return new CircularQueueCaptureQueriesListener();
@ -82,7 +89,7 @@ public class TestR4Config extends BaseJavaConfigR4 {
@Bean @Bean
public Step readPidsStep() { public Step readPidsStep() {
return myStepBuilderFactory.get("readPidsToBeExportedStep") return myStepBuilderFactory.get("readPidsToBeExportedStep")
.<ResourcePersistentId, ResourcePersistentId > chunk(100) .<ResourcePersistentId, ResourcePersistentId > chunk(2)
.reader(myBulkItemReader(null)) .reader(myBulkItemReader(null))
.writer(mySimplePrinter()) .writer(mySimplePrinter())
.build(); .build();
@ -103,6 +110,7 @@ public class TestR4Config extends BaseJavaConfigR4 {
public BulkItemReader myBulkItemReader(@Value("#{jobParameters['jobUUID']}") String theJobUUID) { public BulkItemReader myBulkItemReader(@Value("#{jobParameters['jobUUID']}") String theJobUUID) {
BulkItemReader bulkItemReader = new BulkItemReader(); BulkItemReader bulkItemReader = new BulkItemReader();
bulkItemReader.setJobUUID(theJobUUID); bulkItemReader.setJobUUID(theJobUUID);
bulkItemReader.setName("bulkItemReader");
return bulkItemReader; return bulkItemReader;
} }

View File

@ -123,8 +123,6 @@ public abstract class BaseJpaTest extends BaseTest {
protected IPartitionLookupSvc myPartitionConfigSvc; protected IPartitionLookupSvc myPartitionConfigSvc;
@Autowired @Autowired
private IdHelperService myIdHelperService; private IdHelperService myIdHelperService;
@Autowired
protected IBatchJobSubmitter myBatchJobSubmitter;
@After @After
public void afterPerformCleanup() { public void afterPerformCleanup() {

View File

@ -35,9 +35,6 @@ public class ExpungeHookTest extends BaseJpaDstu3Test {
@Autowired @Autowired
private DaoConfig myDaoConfig; private DaoConfig myDaoConfig;
@Autowired
private Job testJob;
PointcutLatch myEverythingLatch = new PointcutLatch(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING); PointcutLatch myEverythingLatch = new PointcutLatch(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING);
PointcutLatch myExpungeResourceLatch = new PointcutLatch(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_RESOURCE); PointcutLatch myExpungeResourceLatch = new PointcutLatch(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_RESOURCE);
@ -94,9 +91,4 @@ public class ExpungeHookTest extends BaseJpaDstu3Test {
IIdType hookId = hookParams.get(IIdType.class); IIdType hookId = hookParams.get(IIdType.class);
assertEquals(expungeId.getValue(), hookId.getValue()); assertEquals(expungeId.getValue(), hookId.getValue());
} }
@Test
public void testSubmitJob() {
myBatchJobSubmitter.runJob(testJob, new JobParameters());
}
} }

View File

@ -14,6 +14,7 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoSubscription;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc;
import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter;
import ca.uhn.fhir.jpa.binstore.BinaryAccessProvider; import ca.uhn.fhir.jpa.binstore.BinaryAccessProvider;
import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor; import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor;
import ca.uhn.fhir.jpa.bulk.IBulkDataExportSvc; import ca.uhn.fhir.jpa.bulk.IBulkDataExportSvc;
@ -181,7 +182,6 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBui
private static IValidationSupport ourJpaValidationSupportChainR4; private static IValidationSupport ourJpaValidationSupportChainR4;
private static IFhirResourceDaoValueSet<ValueSet, Coding, CodeableConcept> ourValueSetDao; private static IFhirResourceDaoValueSet<ValueSet, Coding, CodeableConcept> ourValueSetDao;
@Autowired @Autowired
protected IPartitionLookupSvc myPartitionConfigSvc; protected IPartitionLookupSvc myPartitionConfigSvc;
@Autowired @Autowired
@ -460,6 +460,8 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBui
private IBulkDataExportSvc myBulkDataExportSvc; private IBulkDataExportSvc myBulkDataExportSvc;
@Autowired @Autowired
private IdHelperService myIdHelperService; private IdHelperService myIdHelperService;
@Autowired
protected IBatchJobSubmitter myBatchJobSubmitter;
@After() @After()
public void afterCleanupDao() { public void afterCleanupDao() {