deephaven / deephaven-core

Deephaven Community Core
Other
256 stars 80 forks source link

Remove hard-dependency on groovy #2542

Open devinrsmith opened 2 years ago

devinrsmith commented 2 years ago

We've currently got a hard-dependency on groovy. Unlike our normal server deployment, which can be configured at startup time for either groovy or python, we shouldn't need groovy for the embedded python server (which will always have a classpath explicitly for a python session script session).

Some of our public apis have groovy:

Some of our implementation details have groovy:

And of course, the script session itself:

By presenting proper script session abstractions, we should be able to remove the hard-dependency on groovy-language specifics. This may have benefits of allowing us to remove python-specific dependencies when we know we only want to have a classpath for groovy, and it may have other benefits for potential future script session types (Scala, et al).

When starting up a python embedded server w/ the groovy.jar manually removed, we run into classloading errors:

java.lang.NoClassDefFoundError: groovy/lang/Closure
        at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
        at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3191)
        at java.base/java.lang.Class.getMethods(Class.java:1904)
        at org.jpy.PyLib.importModule(Native Method)
        at org.jpy.PyModule.importModule(PyModule.java:94)
        at io.deephaven.engine.util.PythonDeephavenSession.<init>(PythonDeephavenSession.java:86)
        at io.deephaven.server.console.python.PythonConsoleSessionModule.bindPythonSession(PythonConsoleSessionModule.java:31)
        at io.deephaven.server.console.python.PythonConsoleSessionModule_BindPythonSessionFactory.bindPythonSession(PythonConsoleSessionModule_BindPythonSessionFactory.java:53)
        at io.deephaven.server.console.python.PythonConsoleSessionModule_BindPythonSessionFactory.get(PythonConsoleSessionModule_BindPythonSessionFactory.java:40)
        at io.deephaven.server.console.python.PythonConsoleSessionModule_BindPythonSessionFactory.get(PythonConsoleSessionModule_BindPythonSessionFactory.java:12)
        at io.deephaven.server.console.python.PythonConsoleSessionModule_BindScriptSessionFactory.get(PythonConsoleSessionModule_BindScriptSessionFactory.java:31)
        at io.deephaven.server.console.python.PythonConsoleSessionModule_BindScriptSessionFactory.get(PythonConsoleSessionModule_BindScriptSessionFactory.java:10)
        at io.deephaven.server.runner.DeephavenApiServerModule.provideScriptSession(DeephavenApiServerModule.java:94)
        at io.deephaven.server.runner.DeephavenApiServerModule_ProvideScriptSessionFactory.provideScriptSession(DeephavenApiServerModule_ProvideScriptSessionFactory.java:42)
        at io.deephaven.server.runner.DeephavenApiServerModule_ProvideScriptSessionFactory.get(DeephavenApiServerModule_ProvideScriptSessionFactory.java:31)
        at io.deephaven.server.runner.DeephavenApiServerModule_ProvideScriptSessionFactory.get(DeephavenApiServerModule_ProvideScriptSessionFactory.java:10)
        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at io.deephaven.server.runner.DeephavenApiServer.run(DeephavenApiServer.java:113)
        at io.deephaven.python.server.EmbeddedServer.start(EmbeddedServer.java:79)
rcaudy commented 2 years ago

We can delete ToMapListener and its test class. SourceClosure can move anywhere GroovyDeephavenSession does.