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

Update server-base and server-slim-base to production-like images #3336

Merged
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 2 additions & 2 deletions docker/registry/server-base/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
io.deephaven.project.ProjectType=DOCKER_REGISTRY
deephaven.registry.imageName=ghcr.io/deephaven/server-base:latest
deephaven.registry.imageId=ghcr.io/deephaven/server-base@sha256:2d165b43d07bad9a7996cda04c114b381d0db342d740ac4f02ab5dd814eb25b6
deephaven.registry.imageName=ghcr.io/deephaven/server-base:edge
deephaven.registry.imageId=ghcr.io/deephaven/server-base@sha256:c9413a0b02287ccd16dd586c67fa42f526e68011d879795f5abd104c76ce4b42
4 changes: 2 additions & 2 deletions docker/registry/slim-base/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
io.deephaven.project.ProjectType=DOCKER_REGISTRY
deephaven.registry.imageName=ghcr.io/deephaven/slim-base:latest
deephaven.registry.imageId=ghcr.io/deephaven/slim-base@sha256:8d3bdb5499a9286c9de19443b6281f6efeb81920003f0f931a23e5de136e8dce
deephaven.registry.imageName=ghcr.io/deephaven/server-slim-base:edge
deephaven.registry.imageId=ghcr.io/deephaven/server-slim-base@sha256:9db84913893f373158244327cb1c0ea0b1085908bfccf13ca679706585923525
2 changes: 1 addition & 1 deletion docker/server-jetty/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ FROM $BASE
COPY --from=install / /
VOLUME /data
VOLUME /cache
HEALTHCHECK --interval=3s --retries=3 --timeout=11s CMD /bin/grpc_health_probe -addr=localhost:10000 -connect-timeout=10s || exit 1
HEALTHCHECK --interval=3s --retries=3 --timeout=11s CMD /opt/grpc_health_probe/grpc_health_probe -addr=localhost:10000 -connect-timeout=10s || exit 1
ENV \
DEEPHAVEN_CACHE_DIR="/cache" \
DEEPHAVEN_CONFIG_DIR="/opt/deephaven/config" \
Expand Down
11 changes: 4 additions & 7 deletions docker/server-jetty/src/main/server-jetty/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
deephaven-plugin==0.3.0
importlib-metadata==5.2.0
java-utilities==0.2.0
jedi==0.18.2
jpy==0.13.0
llvmlite==0.39.1
numba==0.56.4
numpy==1.21.6
pandas==1.3.5
numpy==1.23.5
pandas==1.5.3
parso==0.8.3
pyarrow==9.0.0
pyarrow==10.0.1
python-dateutil==2.8.2
pytz==2022.7
pytz==2022.7.1
six==1.16.0
typing_extensions==4.4.0
zipp==3.11.0
2 changes: 1 addition & 1 deletion docker/server-slim/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ VOLUME /cache
# will not attempt to start). If the server is running but trying to shut down, failure will
# occur within about 9s, as the port will connect correctly, but respond that it isn't
# available.
HEALTHCHECK --interval=3s --retries=3 --timeout=11s CMD /bin/grpc_health_probe -addr=localhost:8080 -connect-timeout=10s || exit 1
HEALTHCHECK --interval=3s --retries=3 --timeout=11s CMD /opt/grpc_health_probe/grpc_health_probe -addr=localhost:8080 -connect-timeout=10s || exit 1
ENV \
DEEPHAVEN_CACHE_DIR="/cache" \
DEEPHAVEN_CONFIG_DIR="/opt/deephaven/config" \
Expand Down
2 changes: 1 addition & 1 deletion docker/server/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ FROM $BASE
COPY --from=install / /
VOLUME /data
VOLUME /cache
HEALTHCHECK --interval=3s --retries=3 --timeout=11s CMD /bin/grpc_health_probe -addr=localhost:8080 -connect-timeout=10s || exit 1
HEALTHCHECK --interval=3s --retries=3 --timeout=11s CMD /opt/grpc_health_probe/grpc_health_probe -addr=localhost:8080 -connect-timeout=10s || exit 1
ENV \
DEEPHAVEN_CACHE_DIR="/cache" \
DEEPHAVEN_CONFIG_DIR="/opt/deephaven/config" \
Expand Down
11 changes: 4 additions & 7 deletions docker/server/src/main/server-netty/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
deephaven-plugin==0.3.0
importlib-metadata==5.2.0
java-utilities==0.2.0
jedi==0.18.2
jpy==0.13.0
llvmlite==0.39.1
numba==0.56.4
numpy==1.21.6
pandas==1.3.5
numpy==1.23.5
pandas==1.5.3
parso==0.8.3
pyarrow==9.0.0
pyarrow==10.0.1
python-dateutil==2.8.2
pytz==2022.7
pytz==2022.7.1
six==1.16.0
typing_extensions==4.4.0
zipp==3.11.0
6 changes: 3 additions & 3 deletions py/jpy-integration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ Closure<TaskProvider<Task>> javaMainInDocker = { String taskName, String javaMai
copyFile 'classpath', '/classpath'
}
entrypoint = ['java', '-cp', '/classpath:/classpath/*',
'-Djpy.jpyLib=/opt/deephaven-venv/lib/python3.7/site-packages/jpy.cpython-37m-x86_64-linux-gnu.so',
'-Djpy.jdlLib=/opt/deephaven-venv/lib/python3.7/site-packages/jdl.cpython-37m-x86_64-linux-gnu.so',
'-Djpy.pythonLib=/usr/lib/x86_64-linux-gnu/libpython3.7m.so.1.0'
'-Djpy.jpyLib=/opt/deephaven/venv/lib/python3.10/site-packages/jpy.cpython-310-x86_64-linux-gnu.so',
'-Djpy.jdlLib=/opt/deephaven/venv/lib/python3.10/site-packages/jdl.cpython-310-x86_64-linux-gnu.so',
'-Djpy.pythonLib=/usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.so'
] + jvmArgs + javaMain

showLogsOnSuccess = true
Expand Down
6 changes: 3 additions & 3 deletions py/jpy-integration/src/javaToPython/build.gradle.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ test.classpath = fileTree('/classpath/').plus(files('/classpath'))
test.testClassesDirs = files('/classes')

test.systemProperties([
'jpy.jpyLib':'/opt/deephaven-venv/lib/python3.7/site-packages/jpy.cpython-37m-x86_64-linux-gnu.so',
'jpy.jdlLib':'/opt/deephaven-venv/lib/python3.7/site-packages/jdl.cpython-37m-x86_64-linux-gnu.so',
'jpy.pythonLib':'/usr/lib/x86_64-linux-gnu/libpython3.7m.so.1.0',
'jpy.jpyLib':'/opt/deephaven/venv/lib/python3.10/site-packages/jpy.cpython-310-x86_64-linux-gnu.so',
'jpy.jdlLib':'/opt/deephaven/venv/lib/python3.10/site-packages/jdl.cpython-310-x86_64-linux-gnu.so',
'jpy.pythonLib':'/usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.so',
// Cleaning up on a dedicated thread has some issues when there is frequent starting
// and stopping of the python virtual environment. We'll rely on cleaning up inline
// when necessary.
Expand Down
17 changes: 10 additions & 7 deletions py/jpy-integration/src/pythonToJava/python/test/test_jpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,16 @@ def test_numpy_array(self):
np_array = None
self.assertEqual(get_refcount(jpy_array_id), jpy_array_refcount)

mv = memoryview(b'123412341234')
mv_id = id(mv)
mv_refcount = get_refcount(mv_id)
np_array = numpy.frombuffer(mv, numpy.int32)
self.assertEqual(get_refcount(mv_id), mv_refcount + 1)
np_array = None
self.assertEqual(get_refcount(mv_id), mv_refcount)
# The refcounting seems to work different in the memoryview case as we update from 3.7 to 3.10; either cpython or
devinrsmith marked this conversation as resolved.
Show resolved Hide resolved
# numpy (or both) may be interacting differently. Without digging down more into the details (if this is still an
# efficient use of the buffer protocol) there may be hooks to reference count different viewers differently.
# mv = memoryview(b'123412341234')
# mv_id = id(mv)
# mv_refcount = get_refcount(mv_id)
# np_array = numpy.frombuffer(mv, numpy.int32)
# self.assertEqual(get_refcount(mv_id), mv_refcount + 1)
# np_array = None
# self.assertEqual(get_refcount(mv_id), mv_refcount)

def test_pyobject_unwrap(self):
import jpy
Expand Down
17 changes: 17 additions & 0 deletions sphinx/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,34 @@
'deephaven.dataDir': os.path.realpath(workspace),
}

jvm_options = {
'-XX:InitialRAMPercentage=25.0',
'-XX:MinRAMPercentage=70.0',
'-XX:MaxRAMPercentage=80.0',

# Allow netty to (reflectively) access java.nio.Buffer fields
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this valid? Only netty? Does sphinx still use netty?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the netty part is too specific. It looks like it's also required by arrow, and potentially other low-level components. I've removed the explicit reference to "netty".

'--add-opens=java.base/java.nio=ALL-UNNAMED',

# Allow our hotspot-impl project to access internals
'--add-exports=java.management/sun.management=ALL-UNNAMED',

# Allow our clock-impl project to access internals
'--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED',
}

from deephaven_internal import jvm
jvm.init_jvm(
jvm_classpath=glob(os.environ.get('DEEPHAVEN_CLASSPATH')),
jvm_properties=jvm_properties,
jvm_options=jvm_options,
)

import jpy
py_scope_jpy = jpy.get_type("io.deephaven.engine.util.PythonScopeJpyImpl").ofMainGlobals()
py_dh_session = jpy.get_type("io.deephaven.integrations.python.PythonDeephavenSession")(py_scope_jpy)
py_dh_session.getExecutionContext().open()


import deephaven
docs_title = "Deephaven python modules."
package_roots = [jpy, deephaven]
Expand Down
4 changes: 2 additions & 2 deletions sphinx/sphinx.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def sphinxDockerfile = tasks.register('sphinxDockerfile', Dockerfile) {
from 'deephaven/server-netty:local-build'

copyFile "./wheel", "/wheel"
copyFile "./lib", '${VIRTUAL_ENV}/lib/python3.7/site-packages/'
copyFile "./lib", '${VIRTUAL_ENV}/lib/python3.10/site-packages/'

environmentVariable 'DEEPHAVEN_CLASSPATH', "/opt/deephaven/server/lib/*.jar"
environmentVariable 'DEEPHAVEN_WORKSPACE', '/tmp/workspace'
Expand All @@ -41,7 +41,7 @@ def sphinxDockerfile = tasks.register('sphinxDockerfile', Dockerfile) {

runCommand '''set -eux; \\
mkdir /tmp/workspace; \\
python -m pip install sphinx==4.0.3 sphinx-autodoc-typehints==1.12.0 pyarrow==7.0.0 protobuf==3.20.1 grpcio==1.46.0 bitstring==3.1.9 /wheel/*.whl breathe==4.31.0 furo==2021.9.8
python -m pip install sphinx sphinx-autodoc-typehints pyarrow protobuf grpcio bitstring /wheel/*.whl breathe furo
'''
}

Expand Down