From 7a82833c5243d6e597d91da1550525734c135040 Mon Sep 17 00:00:00 2001 From: Terry Kong Date: Fri, 21 Mar 2025 13:26:30 -0700 Subject: [PATCH] fix: disable usage stats more forcefully since container env took precedence Signed-off-by: Terry Kong --- docker/Dockerfile | 5 ++++- nemo_reinforcer/__init__.py | 3 +++ ray.sub | 12 ++++-------- tests/unit/test_meta.py | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 tests/unit/test_meta.py diff --git a/docker/Dockerfile b/docker/Dockerfile index 0abb6ebd9e..5842eed006 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,6 +9,9 @@ RUN apt-get update && sudo apt-get install -y jq RUN pip install uv RUN echo "unset RAY_RUNTIME_ENV_HOOK" >> /home/ray/.bashrc +# Disable usage stats by default for users who are sensitive to sharing usage. +# Users are encouraged to enable if the wish. +ENV RAY_USAGE_STATS_ENABLED=0 FROM base AS hermetic # hermetic creates a virtual environment with the default dependencies pre-installed for convenience @@ -38,4 +41,4 @@ EOF COPY --chown=ray --chmod=755 . /opt/reinforcer RUN uv pip install --no-deps --editable /opt/reinforcer -FROM base \ No newline at end of file +FROM base diff --git a/nemo_reinforcer/__init__.py b/nemo_reinforcer/__init__.py index 76b1dda065..457028a211 100644 --- a/nemo_reinforcer/__init__.py +++ b/nemo_reinforcer/__init__.py @@ -1,3 +1,4 @@ +import os from nemo_reinforcer.package_info import ( __contact_emails__, __contact_names__, @@ -11,3 +12,5 @@ __shortversion__, __version__, ) + +os.environ["RAY_USAGE_STATS_ENABLED"] = "0" diff --git a/ray.sub b/ray.sub index 0e254c6e67..dac0899a35 100644 --- a/ray.sub +++ b/ray.sub @@ -19,13 +19,6 @@ MOUNTS=$MOUNTS COMMAND=${COMMAND:-} # This is a script relative to the SLURM_SUBMIT_DIR. If left empty, it will leave the cluster idle after it's brought up. ######################################################## -######################################################## -# Global settings -######################################################## -# Disable usage stats by default so that it's opt-in -export RAY_USAGE_STATS_ENABLED=${RAY_USAGE_STATS_ENABLED:-0} -######################################################## - COMMON_SRUN_ARGS="" COMMON_SRUN_ARGS+=" --export=ALL" COMMON_SRUN_ARGS+=" --no-container-mount-home" @@ -70,6 +63,7 @@ head_cmd=$(cat <