Skip to content

Commit

Permalink
Fix node monitor (#204)
Browse files Browse the repository at this point in the history
* Fix path from /opt/install to /opt/simapp

* Faster shutdown
  • Loading branch information
larsll authored Jun 16, 2024
1 parent 59fd97f commit ac0c4e3
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions build-dev-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ docker buildx build ${OPT_NOCACHE} -t ${PREFIX}/deepracer-robomaker-build-devel:

echo "Building development build of bundle into $(pwd)/bundle..."
mkdir -p $(pwd)/install $(pwd)/build $(pwd)/log
docker run --rm -ti -v $(pwd)/bundle:/opt/bundle -v $(pwd)/log:/opt/log -v $(pwd)/install:/opt/install -v $(pwd)/build:/opt/build \
${PREFIX}/deepracer-robomaker-build-devel:latest bash -c 'colcon --log-base /opt/log build --install-base /opt/install --build-base /opt/build'
docker run --rm -ti -v $(pwd)/bundle:/opt/bundle -v $(pwd)/log:/opt/log -v $(pwd)/install:/opt/simapp -v $(pwd)/build:/opt/build \
${PREFIX}/deepracer-robomaker-build-devel:latest bash -c 'colcon --log-base /opt/log build --install-base /opt/simapp --build-base /opt/build'

if [ -n "${OPT_GAZEBO}" ]; then
if [ -z "${DR_ROBOMAKER_IMAGE}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion bundle/markov/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def cancel_simulation_job():
logger.info("Successfully cancelled the simulation job")
else:
logger.info("AWS_ROBOMAKER_SIMULATION_JOB_ARN environment variable not set.")
subprocess.run(["/opt/install/shutdown.sh"])
subprocess.run(["/opt/simapp/shutdown.sh"])
logger.info("Shutdown initiated")
exit(0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -ex
#export PYTHONPATH=${COLCON_BUNDLE_PREFIX}/usr/local/lib/python3.6/dist-packages/:$PYTHONPATH
export PYTHONUNBUFFERED=1

python3 /opt/install/start_deepracer_node_monitor.py \
--node_monitor_file_path /opt/install/deepracer_node_monitor_list.txt 2>&1 &
python3 /opt/simapp/start_deepracer_node_monitor.py \
--node_monitor_file_path /opt/simapp/deepracer_node_monitor_list.txt 2>&1 &

python3 -m markov.evaluation_worker
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set -ex
#export PYTHONPATH=${COLCON_BUNDLE_PREFIX}/usr/local/lib/python3.6/dist-packages/:$PYTHONPATH
export PYTHONUNBUFFERED=1
ROLLOUT_IDX=${1:-0}
python3 /opt/install/start_deepracer_node_monitor.py \
--node_monitor_file_path /opt/install/deepracer_node_monitor_list.txt 2>&1 &
python3 /opt/simapp/start_deepracer_node_monitor.py \
--node_monitor_file_path /opt/simapp/deepracer_node_monitor_list.txt 2>&1 &


if ! python3 -m markov.rollout_worker --rollout_idx $ROLLOUT_IDX; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -ex
#export PYTHONPATH=${COLCON_BUNDLE_PREFIX}/usr/local/lib/python3.6/dist-packages/:$PYTHONPATH
export PYTHONUNBUFFERED=1

python3 /opt/install/start_deepracer_node_monitor.py \
--node_monitor_file_path /opt/install/deepracer_virtual_event_node_monitor_list.txt 2>&1 &
python3 /opt/simapp/start_deepracer_node_monitor.py \
--node_monitor_file_path /opt/simapp/deepracer_virtual_event_node_monitor_list.txt 2>&1 &

python3 -m markov.virtual_event_worker
2 changes: 1 addition & 1 deletion docker/Dockerfile.localext
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ARG FROM_TAG
FROM awsdeepracercommunity/deepracer-robomaker:${FROM_TAG}

COPY bundle/install /opt/install
COPY bundle/install /opt/simapp
COPY ./docker/files/run.sh run.sh
COPY ./docker/files/devel.sh devel.sh

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ services:
- XDG_RUNTIME_DIR=/tmp/runtime-$USER
volumes:
- '../docker/files:/opt/files'
- '../install:/opt/install'
- '../install:/opt/simapp'
- '/tmp/.X11-unix/:/tmp/.X11-unix'
- '${XAUTHORITY}:$HOME/.Xauthority'
8 changes: 4 additions & 4 deletions docker/files/robomaker/devel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ touch ~/.gazebo/gui.ini
# Initialize ROS & the Bundle
export IGN_IP=127.0.0.1
source /opt/ros/${ROS_DISTRO}/setup.bash
source /opt/install/setup.bash
export GAZEBO_RESOURCE_PATH=/opt/install/deepracer_simulation_environment/share/deepracer_simulation_environment
export GAZEBO_MODEL_PATH=/opt/install/deepracer_simulation_environment/share/deepracer_simulation_environment
source /opt/simapp/setup.bash
export GAZEBO_RESOURCE_PATH=/opt/simapp/deepracer_simulation_environment/share/deepracer_simulation_environment
export GAZEBO_MODEL_PATH=/opt/simapp/deepracer_simulation_environment/share/deepracer_simulation_environment

echo "IP: $(hostname -I) ($(hostname))"

source /usr/share/gazebo/setup.sh
gazebo /opt/install/deepracer_simulation_environment/share/deepracer_simulation_environment/worlds/${DR_WORLD_NAME}.world --verbose
gazebo /opt/simapp/deepracer_simulation_environment/share/deepracer_simulation_environment/worlds/${DR_WORLD_NAME}.world --verbose

wait
4 changes: 2 additions & 2 deletions docker/files/robomaker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export DEEPRACER_JOB_TYPE_ENV="LOCAL"
if [[ -n "${RTF_OVERRIDE}" ]]; then
echo "Setting RTF to ${RTF_OVERRIDE} for ${WORLD_NAME}"
RTF_UPDATE_RATE=$(awk -v rtf=$RTF_OVERRIDE 'BEGIN{ update_rate=rtf*1000; printf "%0.6f", update_rate}')
WORLD_FILE="/opt/install/deepracer_simulation_environment/share/deepracer_simulation_environment/worlds/${WORLD_NAME}.world"
WORLD_FILE="/opt/simapp/deepracer_simulation_environment/share/deepracer_simulation_environment/worlds/${WORLD_NAME}.world"
xmlstarlet ed -L -s '/sdf/world' -t elem -n physics $WORLD_FILE
xmlstarlet ed -L -a '/sdf/world/physics' -t attr -n type -v ode $WORLD_FILE
xmlstarlet ed -L -s '/sdf/world/physics' -t elem -n max_step_size -v 0.001000 $WORLD_FILE
Expand All @@ -53,7 +53,7 @@ fi
# Check if we want to do reward-function debugging
if [[ "${DEBUG_REWARD,,}" == "true" ]]; then
echo "Enabling Reward Debugging"
patch -p2 -N --directory=/opt/install < debug-reward.diff
patch -p2 -N --directory=/opt/simapp < debug-reward.diff
fi

# If no run-option given then use the distributed training
Expand Down
2 changes: 1 addition & 1 deletion docker/files/robomaker/shutdown.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
nohup bash -c 'sleep 20 && echo "Bye!" && kill 1' &
nohup bash -c 'sleep 5 && echo "Bye!" && kill 1' &

0 comments on commit ac0c4e3

Please sign in to comment.