Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Dec 6, 2023
1 parent 6ee4c84 commit 6581536
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ public static class Builder {
private OperationInitializer operationInitializer = PoisonedOperationInitializer.INSTANCE;

private Builder() {
// why automatically propagate this, but not other things?
// propagate the auth context from the current context
this(getContext().authContext);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,4 @@ public Future<?> submit(Runnable runnable) {
public int parallelismFactor() {
return fail();
}

@Override
public void start() {
fail();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public Thread newThread(@NotNull final Runnable r) {
};
executorService = new ThreadPoolExecutor(
NUM_THREADS, NUM_THREADS, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), threadFactory);

executorService.prestartAllCoreThreads();
}

@Override
Expand All @@ -72,11 +74,4 @@ public Future<?> submit(Runnable runnable) {
public int parallelismFactor() {
return NUM_THREADS;
}

/**
* Start the OperationInitializationThreadPool. In practice, this just pre-starts all threads.
*/
public void start() {
executorService.prestartAllCoreThreads();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public PeriodicUpdateGraph(
this.allowUnitTestMode = allowUnitTestMode;
this.defaultTargetCycleDurationMillis = targetCycleDurationMillis;
this.targetCycleDurationMillis = targetCycleDurationMillis;
this.threadInitializationFactory = threadInitializationFactory;
this.threadInitializationFactory = threadInitializationFactory;

if (numUpdateThreads <= 0) {
this.updateThreads = Runtime.getRuntime().availableProcessors();
Expand Down Expand Up @@ -1211,9 +1211,9 @@ public Builder numUpdateThreads(int numUpdateThreads) {
}

/**
*
* @param threadInitializationFactory
* @return
* Sets a functional interface that adds custom initialization for threads started by this UpdateGraph.
* @param threadInitializationFactory the function to invoke on any runnables that will be used to start threads
* @return this builder
*/
public Builder threadInitializationFactory(ThreadInitializationFactory threadInitializationFactory) {
this.threadInitializationFactory = threadInitializationFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import io.deephaven.util.thread.ThreadInitializationFactory;

public class TestExecutionContext {
private static final ControlledUpdateGraph UPDATE_GRAPH =
new ControlledUpdateGraph("TEST", true, 1000, 25, -1, ThreadInitializationFactory.NO_OP);
private static final ControlledUpdateGraph UPDATE_GRAPH = new ControlledUpdateGraph();

private static final OperationInitializationThreadPool OPERATION_INITIALIZATION =
new OperationInitializationThreadPool(ThreadInitializationFactory.NO_OP);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@

// TODO (deephaven-core#3886): Extract test functionality from PeriodicUpdateGraph
public class ControlledUpdateGraph extends PeriodicUpdateGraph {
public ControlledUpdateGraph(String name, boolean allowUnitTestMode, long targetCycleDurationMillis,
long minimumCycleDurationToLogNanos, int numUpdateThreads,
ThreadInitializationFactory threadInitializationFactory) {
super(name, allowUnitTestMode, targetCycleDurationMillis, minimumCycleDurationToLogNanos, numUpdateThreads,
threadInitializationFactory);
public ControlledUpdateGraph() {
super("TEST", true, 1000, 25, -1, ThreadInitializationFactory.NO_OP);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import io.deephaven.engine.table.impl.ShiftObliviousInstrumentedListenerAdapter;
import io.deephaven.engine.table.impl.util.ShiftObliviousUpdateCoalescer;
import io.deephaven.engine.testutil.testcase.RefreshingTableTestCase;
import io.deephaven.engine.updategraph.impl.PeriodicUpdateGraph;
import io.deephaven.engine.util.TableDiff;
import io.deephaven.engine.util.TableTools;
import org.apache.commons.lang3.mutable.MutableInt;
Expand Down Expand Up @@ -119,7 +118,7 @@ public String toString() {
public void step(int leftSize, int rightSize, QueryTable leftTable, QueryTable rightTable,
ColumnInfo<?, ?>[] leftColumnInfo, ColumnInfo<?, ?>[] rightColumnInfo, EvalNuggetInterface[] en,
Random random) {
final PeriodicUpdateGraph updateGraph = ExecutionContext.getContext().getUpdateGraph().cast();
final ControlledUpdateGraph updateGraph = ExecutionContext.getContext().getUpdateGraph().cast();
updateGraph.runWithinUnitTestCycle(() -> {
GenerateTableUpdates.generateShiftAwareTableUpdates(GenerateTableUpdates.DEFAULT_PROFILE, leftSize,
random, leftTable, leftColumnInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ public Future<?> submit(Runnable runnable) {

@Override
public int parallelismFactor() {
return 0;
}

@Override
public void start() {
// no-op
return 1;
}
};

Expand All @@ -48,9 +43,4 @@ public void start() {
* @return
*/
int parallelismFactor();

/**
*
*/
void start();
}

0 comments on commit 6581536

Please sign in to comment.