Skip to content

Commit

Permalink
kernel-gateway: lint env vars, disable ddtrace-run for now
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Sep 27, 2024
1 parent e019fb7 commit 9472038
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
45 changes: 22 additions & 23 deletions mpcontribs-kernel-gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,34 @@ COPY --from=python-deps /root/.local/lib/python3.10/site-packages /root/.local/l
COPY --from=python-deps /root/.local/bin /root/.local/bin

WORKDIR /app
ENV PATH=/root/.local/bin:$PATH
ENV PYTHONUNBUFFERED 1
ENV NODE_ENV production
ENV PLOTLY_RENDERER=png
ENV KG_ENV_PROCESS_WHITELIST=PLOTLY_RENDERER
ENV KG_IP=0.0.0.0
ENV KG_PORT_RETRIES=0
ENV KG_MAX_KERNELS=12
ENV KG_PRESPAWN_COUNT=12
ENV KG_SEED_URI=/app/kernel_imports.ipynb
ENV KG_FORCE_KERNEL_NAME=python3
ENV KG_DEFAULT_KERNEL_NAME=python3
ENV KG_LIST_KERNELS=True
ENV KG_PORT=10100
ENV TINI_SUBREAPER=true

EXPOSE 10100
COPY make_seed.py .
COPY start.sh .
RUN python make_seed.py && chmod +x start.sh

ARG VERSION
ENV DD_SERVICE=contribs-kernel-gateway \
ENV PATH=/root/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
NODE_ENV=production \
PLOTLY_RENDERER=png \
KG_ENV_PROCESS_WHITELIST=PLOTLY_RENDERER \
KG_IP=0.0.0.0 \
KG_PORT_RETRIES=0 \
KG_MAX_KERNELS=12 \
KG_PRESPAWN_COUNT=1 \
KG_SEED_URI=/app/kernel_imports.ipynb \
KG_FORCE_KERNEL_NAME=python3 \
KG_DEFAULT_KERNEL_NAME=python3 \
KG_LIST_KERNELS=True \
KG_PORT=10100 \
TINI_SUBREAPER=true \
DD_SERVICE=contribs-kernel-gateway \
DD_ENV=prod \
DD_VERSION=$VERSION \
DD_TRACE_HOST=localhost:8126 \
DD_PROFILING_ENABLED=true \
DD_LOGS_INJECTION=true \
DD_TRACE_SAMPLE_RATE=1
DD_TRACE_SAMPLE_RATE=1 \
DD_TRACE_OTEL_ENABLED=false

EXPOSE 10100
COPY make_seed.py .
COPY start.sh .
RUN python make_seed.py && chmod +x start.sh
LABEL com.datadoghq.ad.logs='[{"source": "gunicorn", "service": "contribs-kernel-gateway"}]'
CMD ./start.sh
7 changes: 4 additions & 3 deletions mpcontribs-kernel-gateway/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ pmgrc=$HOME/.pmgrc.yaml

CMD="jupyter kernelgateway"

if [[ -n "$DD_TRACE_HOST" ]]; then
wait-for-it.sh $DD_TRACE_HOST -q -s -t 10 && CMD="ddtrace-run $CMD"
fi
# NOTE ddtrace-run causes 100% CPU usage
#if [[ -n "$DD_TRACE_HOST" ]]; then
# wait-for-it.sh $DD_TRACE_HOST -q -s -t 10 && CMD="ddtrace-run $CMD"
#fi

exec $CMD --KernelGatewayApp.log_format='%(asctime)s,%(msecs)03d %(levelname)s [%(name)s] [%(module)s:%(lineno)d] - %(message)s'

0 comments on commit 9472038

Please sign in to comment.