Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit b3ca776

Browse files
committed
more printin
1 parent e028080 commit b3ca776

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

core/src/main/java/org/neo4j/graphalgo/core/neo4jview/GraphView.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import java.util.Arrays;
4545
import java.util.Collection;
4646
import java.util.Collections;
47+
import java.util.Random;
4748
import java.util.function.Consumer;
4849
import java.util.function.IntPredicate;
4950
import java.util.function.ToDoubleFunction;

core/src/main/java/org/neo4j/graphalgo/core/utils/ParallelUtil.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,6 @@ private static void runWithConcurrency(
701701
return;
702702
}
703703

704-
705704
System.out.println("[ParallelUtil#runWithConcurrency] submit more tasks");
706705
// submit all remaining tasks
707706
int tries = 0;
@@ -719,7 +718,7 @@ private static void runWithConcurrency(
719718
}
720719
if (!completionService.trySubmit(ts) && !completionService.hasTasks()) {
721720
if (++tries >= maxWaitRetries) {
722-
System.out.println("[ParallelUtil#runWithConcurrency] exceeded max wait retriesS");
721+
System.out.println("[ParallelUtil#runWithConcurrency] exceeded max wait retries");
723722
break;
724723
}
725724
LockSupport.parkNanos(waitNanos);
@@ -890,6 +889,7 @@ protected void done() {
890889
pool = (ThreadPoolExecutor) executor;
891890
availableConcurrency = pool.getCorePoolSize();
892891
int capacity = Math.max(targetConcurrency, availableConcurrency) + 1;
892+
System.out.println("[ParallelUtil#runWithConcurrency] capacity = " + capacity + " [target:" + targetConcurrency + ",available:" + availableConcurrency + "]");
893893
completionQueue = new ArrayBlockingQueue<>(capacity);
894894
} else {
895895
pool = null;
@@ -937,11 +937,13 @@ void cancelAll() {
937937
}
938938

939939
private boolean canSubmit() {
940-
int activeCount = pool.getActiveCount();
941-
boolean canSubmit = pool == null || activeCount < availableConcurrency;
940+
int activeCount = 0;
941+
boolean canSubmit = pool == null || (activeCount = pool.getActiveCount()) < availableConcurrency;
942942

943943
if(!canSubmit) {
944944
System.out.println("[ParallelUtil#runWithConcurrency] unable to submit task and pool:" + pool + ", activeCount:" + activeCount + ", availableConcurrency:" + availableConcurrency);
945+
} else {
946+
System.out.println("[ParallelUtil#runWithConcurrency] submitted task and pool:" + pool + ", activeCount:" + activeCount + ", availableConcurrency:" + availableConcurrency);
945947
}
946948

947949
return canSubmit;
@@ -996,6 +998,7 @@ public T next() {
996998

997999
void pushBack(T element) {
9981000
if (pushedElement != null) {
1001+
System.out.println("[ParallelUtil#runWithConcurrency] unable to reschedule task");
9991002
throw new IllegalArgumentException("Cannot push back twice");
10001003
}
10011004
pushedElement = element;

tests/src/test/java/org/neo4j/graphalgo/algo/EigenvectorCentralityProcIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public void testWriteBackUnderDifferentProperty() throws Exception {
219219
@Test
220220
public void testParallelWriteBack() throws Exception {
221221
runQuery(
222-
"CALL algo.eigenvector('Character', 'INTERACTS_SEASON1', {batchSize:3, concurrency:2, write:true, graph:'"+graphImpl+"', direction: 'BOTH'}) YIELD writeMillis, write, writeProperty, iterations",
222+
"CALL algo.eigenvector('Character', 'INTERACTS_SEASON1', {batchSize:50, concurrency:2, write:true, graph:'"+graphImpl+"', direction: 'BOTH'}) YIELD writeMillis, write, writeProperty, iterations",
223223
row -> {
224224
assertTrue(
225225
"write time not set",
@@ -232,7 +232,7 @@ public void testParallelWriteBack() throws Exception {
232232
public void testParallelExecution() throws Exception {
233233
final Map<Long, Double> actual = new HashMap<>();
234234
runQuery(
235-
"CALL algo.eigenvector.stream('Character', 'INTERACTS_SEASON1', {batchSize:2, concurrency:2, graph:'"+graphImpl+"', direction: 'BOTH'}) " +
235+
"CALL algo.eigenvector.stream('Character', 'INTERACTS_SEASON1', {batchSize:100, concurrency:2, graph:'"+graphImpl+"', direction: 'BOTH'}) " +
236236
"YIELD nodeId, score " +
237237
"RETURN nodeId, score " +
238238
"ORDER BY score DESC " +

0 commit comments

Comments
 (0)