Skip to content

Commit a8a7d75

Browse files
authored
Merge pull request #11 from sysprog21/ci-improve
Fix dependency preloading and Jupyter warnings
2 parents a14b181 + 8072289 commit a8a7d75

File tree

3 files changed

+41
-13
lines changed

3 files changed

+41
-13
lines changed

Dockerfile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ RUN adduser -D -s /bin/bash bootcamp
3636
ENV SCALA_VERSION=2.12.10
3737
ENV ALMOND_VERSION=0.9.1
3838
ENV COURSIER_VERSION=2.1.24
39-
ENV COURSIER_CACHE=/coursier_cache
4039
ENV JUPYTER_CONFIG_DIR=/jupyter/config
4140
ENV JUPYTER_DATA_DIR=/jupyter/data
4241

@@ -86,7 +85,12 @@ RUN \
8685
--default=true \
8786
-o almond && \
8887
./almond --install --global && \
89-
# Preload Chisel dependencies to avoid first-run delay before removing coursier
88+
# Preload Chisel dependencies - coursier fetch downloads to its default cache
89+
# which gets picked up by Ammonite at runtime
90+
./coursier fetch \
91+
--intransitive \
92+
edu.berkeley.cs:chisel3-plugin_2.12.10:3.6.1 \
93+
&& \
9094
./coursier fetch \
9195
edu.berkeley.cs:chisel3_2.12:3.6.1 \
9296
edu.berkeley.cs:chisel-iotesters_2.12:2.5.6 \
@@ -95,20 +99,23 @@ RUN \
9599
edu.berkeley.cs:rocket-dsptools_2.12:1.2.0 \
96100
org.scalanlp:breeze_2.12:1.0 \
97101
org.scalatest:scalatest_2.12:3.2.2 \
98-
--cache /coursier_cache && \
99-
rm -rf almond coursier /root/.cache/coursier
102+
&& \
103+
rm -rf almond coursier
100104

101105
# Last stage
102106
FROM base AS final
103107

108+
# Set COURSIER_CACHE environment variable so Ammonite uses our preloaded cache
109+
ENV COURSIER_CACHE=/coursier_cache
110+
104111
# copy the Scala requirements and kernel into the image
105112
COPY --from=intermediate-builder --chown=bootcamp:bootcamp /coursier_cache/ /coursier_cache/
106113
COPY --from=intermediate-builder --chown=bootcamp:bootcamp /usr/local/share/jupyter/kernels/scala/ /usr/local/share/jupyter/kernels/scala/
107114

108-
RUN chown -R bootcamp:bootcamp /chisel-bootcamp /jupyter
115+
RUN chown -R bootcamp:bootcamp /chisel-bootcamp /jupyter /coursier_cache
109116

110117
USER bootcamp
111118
WORKDIR /chisel-bootcamp
112119

113120
EXPOSE 8888
114-
CMD jupyter lab --no-browser --ip 0.0.0.0 --port 8888
121+
CMD ["jupyter", "lab", "--no-browser", "--ip", "0.0.0.0", "--port", "8888"]

source/jupyter_server_config.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
c = get_config() #noqa
55

66
# Fix websocket ping timeout warning
7+
# Set both to same value to avoid timeout > interval warning
78
c.ServerApp.websocket_ping_interval = 30
89
c.ServerApp.websocket_ping_timeout = 30
910

@@ -14,6 +15,14 @@
1415
c.ServerApp.allow_origin = '*'
1516
c.ServerApp.allow_credentials = True
1617

18+
# Disable history manager to suppress Almond kernel history_request errors
19+
# Almond kernel doesn't support history operations, causing JSON decode errors
20+
c.HistoryManager.enabled = False
21+
22+
# Disable notebook trust warnings in container environment
23+
# All notebooks are from trusted source (bootcamp materials)
24+
c.ServerApp.trust_xheaders = False
25+
1726
# Keep INFO level for essential startup messages (URL, port, etc)
1827
# but suppress specific noisy loggers
1928
c.ServerApp.log_level = 'INFO'
@@ -23,14 +32,28 @@
2332
logging.getLogger('tornado.access').setLevel(logging.ERROR)
2433
logging.getLogger('tornado.application').setLevel(logging.ERROR)
2534

35+
# Suppress LabApp schema validation warnings
36+
logging.getLogger('LabApp').setLevel(logging.ERROR)
37+
2638
# Create a custom filter to suppress specific warning messages
27-
class SuppressAuthWarning(logging.Filter):
39+
class SuppressWarnings(logging.Filter):
2840
def filter(self, record):
29-
return 'All authentication is disabled' not in record.getMessage()
41+
# Only filter WARNING level messages, not INFO
42+
if record.levelno != logging.WARNING:
43+
return True
44+
45+
msg = record.getMessage()
46+
# Suppress specific warnings
47+
return not any([
48+
'All authentication is disabled' in msg,
49+
'Clearing invalid/expired login cookie' in msg,
50+
'is not trusted' in msg,
51+
'Could not determine jupyterlab build status' in msg
52+
])
3053

3154
# Apply the filter to ServerApp logger
3255
server_logger = logging.getLogger('ServerApp')
33-
server_logger.addFilter(SuppressAuthWarning())
56+
server_logger.addFilter(SuppressWarnings())
3457

3558
# Hide system and build files from file browser
3659
# Students only need to see notebook files (*.ipynb)

source/overrides.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
"@jupyterlab/apputils-extension:notification": {
3-
"fetchNews": "false",
4-
"checkForUpdates": false
5-
}
2+
"fetchNews": "false",
3+
"checkForUpdates": false
64
}

0 commit comments

Comments
 (0)