Skip to content
Snippets Groups Projects
Commit 752128a1 authored by Nicolas Dandrimont's avatar Nicolas Dandrimont
Browse files

Add memray to the swh-counters container

Ref. sysadm-environment#5259
parent 6abbcd5d
No related branches found
No related tags found
1 merge request!37Add memray to the swh-counters container
......@@ -16,6 +16,8 @@ COPY --chown=swh:swh requirements-frozen.txt /opt/swh
ENV PYTHONPATH=/opt/swh
ENV PATH=/opt/swh/.local/bin:$PATH
ENV MEMRAY_ENABLED=false
ENV MEMRAY_OPTIONS=
RUN /usr/local/bin/python -m pip install --upgrade pip && \
pip install --no-cache-dir -r requirements-frozen.txt && \
......
......@@ -13,8 +13,21 @@ case "$1" in
;;
"swh")
shift
echo "Running swh command $@"
exec swh $@
declare -a cmd
if [ "${MEMRAY_ENABLED}" = "true" ]; then
# we expect MEMRAY_OPTIONS to contain quoted values
# shellcheck disable=SC2206
cmd=(memray run --native ${MEMRAY_OPTIONS})
if [ -n "${MEMRAY_LIVE_REMOTE_PORT}" ]; then
cmd+=(--live-remote --live-port="${MEMRAY_LIVE_REMOTE_PORT}")
fi
fi
cmd+=(swh "$@")
set -x
exec "${cmd[@]}"
;;
*)
echo Starting the swh-search API server
......
memray
swh.counters
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment