Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Script Cache Clearing to Dagger #5436

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -814,13 +814,13 @@ private void maybeCreateClasses(
final String tempDirAsString;
try {
rootPathAsString = getClassDestination().getAbsolutePath();
final Path tempPath =
Files.createTempDirectory(Paths.get(rootPathAsString), "temporaryCompilationDirectory");
tempDirAsString = tempPath.toFile().getAbsolutePath();

for (final CompilationRequestAttempt request : requests) {
request.ensureDirectories(rootPathAsString);
}

final Path tempPath =
Files.createTempDirectory(Paths.get(rootPathAsString), "temporaryCompilationDirectory");
tempDirAsString = tempPath.toFile().getAbsolutePath();
} catch (IOException ioe) {
Exception err = new UncheckedIOException(ioe);
for (final CompilationRequestAttempt request : requests) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.deephaven.server.session.TicketResolver;
import io.grpc.BindableService;

import javax.inject.Singleton;
import java.util.Collections;
import java.util.Set;

Expand All @@ -25,6 +26,12 @@ public interface ConsoleModule {
@IntoSet
TicketResolver bindConsoleTicketResolver(ScopeTicketResolver resolver);

@Provides
@Singleton
static ScriptSessionCacheInit bindScriptSessionCacheInit() {
return new ScriptSessionCacheInit();
}

@Provides
@ElementsIntoSet
static Set<CustomCompletion.Factory> primeCustomCompletions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ ScriptSession bindScriptSession(NoLanguageDeephavenSession noLanguageSession) {
@Provides
NoLanguageDeephavenSession bindNoLanguageSession(
@Named(PeriodicUpdateGraph.DEFAULT_UPDATE_GRAPH_NAME) final UpdateGraph updateGraph,
final OperationInitializer operationInitializer) {
final OperationInitializer operationInitializer,
final ScriptSessionCacheInit ignored) {
return new NoLanguageDeephavenSession(updateGraph, operationInitializer);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.server.console;

import io.deephaven.engine.util.AbstractScriptSession;

import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
public class ScriptSessionCacheInit {

@Inject
public ScriptSessionCacheInit() {
// create the script cache (or clear previous sessions)
AbstractScriptSession.createScriptCache();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.deephaven.engine.util.GroovyDeephavenSession.RunScripts;
import io.deephaven.engine.util.ScriptSession;
import io.deephaven.plugin.type.ObjectTypeLookup;
import io.deephaven.server.console.ScriptSessionCacheInit;

import javax.inject.Named;
import java.io.IOException;
Expand All @@ -34,7 +35,8 @@ GroovyDeephavenSession bindGroovySession(
final OperationInitializer operationInitializer,
final ObjectTypeLookup lookup,
final ScriptSession.Listener listener,
final RunScripts runScripts) {
final RunScripts runScripts,
final ScriptSessionCacheInit ignored) {
try {
return GroovyDeephavenSession.of(updateGraph, operationInitializer, lookup, listener, runScripts);
} catch (final IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.deephaven.engine.util.ScriptSession;
import io.deephaven.integrations.python.PythonDeephavenSession;
import io.deephaven.plugin.type.ObjectTypeLookup;
import io.deephaven.server.console.ScriptSessionCacheInit;
import io.deephaven.util.thread.ThreadInitializationFactory;

import javax.inject.Named;
Expand All @@ -36,7 +37,8 @@ PythonDeephavenSession bindPythonSession(
final OperationInitializer operationInitializer,
final ObjectTypeLookup lookup,
final ScriptSession.Listener listener,
final PythonEvaluatorJpy pythonEvaluator) {
final PythonEvaluatorJpy pythonEvaluator,
final ScriptSessionCacheInit ignored) {
try {
return new PythonDeephavenSession(
updateGraph, operationInitializer, threadInitializationFactory, lookup, listener,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ public DeephavenApiServer run() throws IOException, ClassNotFoundException, Time
log.info().append("Configuring logging...").endl();
logInit.run();

log.info().append("Creating/Clearing Script Cache...").endl();
AbstractScriptSession.createScriptCache();

for (BusinessCalendar calendar : calendars.get()) {
Calendars.addCalendar(calendar);
}
Expand Down
Loading