Skip to content

Commit

Permalink
Fix thread blocking issue, confirmed with integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ramari16 committed Dec 18, 2023
1 parent 1a505a6 commit 83640e7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ public GenomicProcessor localDistributedGenomicProcessor() {
return new GenomicProcessorParentImpl(processorNodes);
}

@Bean(name = "integrationTestGenomicProcessor")
@ConditionalOnProperty(prefix = "hpds.genomicProcessor", name = "impl", havingValue = "integrationTest")
public GenomicProcessor integrationTestGenomicProcessor() {
// todo: parameterize these
return new GenomicProcessorParentImpl(List.of(
new GenomicProcessorNodeImpl("/Users/ryan/dev/pic-sure-hpds-test/data/orchestration/1040.22/all/"),
new GenomicProcessorNodeImpl("/Users/ryan/dev/pic-sure-hpds-test/data/orchestration/1040.20/all/")
));
}

@Bean(name = "remoteGenomicProcessor")
@ConditionalOnProperty(prefix = "hpds.genomicProcessor", name = "impl", havingValue = "remote")
public GenomicProcessor remoteGenomicProcessor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public GenomicProcessorNodeImpl(String genomicDataDirectory) {

@Override
public Mono<BigInteger> getPatientMask(DistributableQuery distributableQuery) {
return Mono.fromCallable(() -> runGetPatientMask(distributableQuery));
return Mono.fromCallable(() -> runGetPatientMask(distributableQuery)).subscribeOn(Schedulers.boundedElastic());
}
public BigInteger runGetPatientMask(DistributableQuery distributableQuery) {
// log.debug("filterdIDSets START size: " + filteredIdSets.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public GenomicProcessorParentImpl(List<GenomicProcessor> nodes) {
@Override
public Mono<BigInteger> getPatientMask(DistributableQuery distributableQuery) {
Mono<BigInteger> result = Flux.just(nodes.toArray(GenomicProcessor[]::new))
.publishOn(Schedulers.boundedElastic())
.flatMap(node -> node.getPatientMask(distributableQuery))
.reduce(BigInteger::or);
return result;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SMALL_JOB_LIMIT = 100
SMALL_TASK_THREADS = 1
LARGE_TASK_THREADS = 1

hpds.genomicProcessor.impl=integrationTest
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.util.*;
Expand All @@ -24,6 +24,7 @@
@ExtendWith(SpringExtension.class)
@EnableAutoConfiguration
@SpringBootTest(classes = HpdsApplication.class)
@ActiveProfiles("integration-test")
public class AbstractProcessorIntegrationTest {

@Autowired
Expand Down

0 comments on commit 83640e7

Please sign in to comment.