Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -38,4 +41,4 @@ EOF
COPY --chown=ray --chmod=755 . /opt/reinforcer
RUN uv pip install --no-deps --editable /opt/reinforcer

FROM base
FROM base
3 changes: 3 additions & 0 deletions nemo_reinforcer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from nemo_reinforcer.package_info import (
__contact_emails__,
__contact_names__,
Expand All @@ -11,3 +12,5 @@
__shortversion__,
__version__,
)

os.environ["RAY_USAGE_STATS_ENABLED"] = "0"
12 changes: 4 additions & 8 deletions ray.sub
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -70,6 +63,7 @@ head_cmd=$(cat <<EOF
env
cat <<EOFINNER | tee /launch-head.sh
ray start --head \
--disable-usage-stats \
--num-cpus=0 \
--num-gpus=0 \
--node-ip-address="$head_node_ip" \
Expand Down Expand Up @@ -104,9 +98,11 @@ for ((i = 0; i < SLURM_JOB_NUM_NODES; i++)); do
env
cat <<EOFINNER | tee /launch-worker.sh
ray start --address "$ip_head" \
--disable-usage-stats \
--resources="{\"worker_units\": $gpus_per_node}" \
--min-worker-port=$min_worker_port \
--max-worker-port=$max_worker_port --block
--max-worker-port=$max_worker_port \
--block
Comment thread
terrykong marked this conversation as resolved.
EOFINNER

count=0
Expand Down
34 changes: 34 additions & 0 deletions tests/unit/test_meta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This module tests things outside of any package (e.g., things in the root __init__.py)

import pytest
import os


def test_usage_stats_disabled_by_default():
import nemo_reinforcer

assert os.environ["RAY_USAGE_STATS_ENABLED"] == "0", (
f"Our dockerfile, slurm submission script and default environment setting when importing reinforcer should all disable usage stats collection. This failing is not expected."
)


def test_usage_stats_disabled_in_tests():
import tests

assert os.environ["RAY_USAGE_STATS_ENABLED"] == "0", (
f"Our dockerfile, slurm submission script and default environment setting when importing reinforcer should all disable usage stats collection. This failing is not expected."
)