From ac0c4e32e47a79e35f53f03893713bab266bd6aa Mon Sep 17 00:00:00 2001 From: Lars Lorentz Ludvigsen <59617571+larsll@users.noreply.github.com> Date: Sun, 16 Jun 2024 20:54:50 +0200 Subject: [PATCH] Fix node monitor (#204) * Fix path from /opt/install to /opt/simapp * Faster shutdown --- build-dev-bundle.sh | 4 ++-- bundle/markov/utils.py | 2 +- .../scripts/run_evaluation_rl_agent.sh | 4 ++-- .../scripts/run_rollout_rl_agent.sh | 4 ++-- .../scripts/run_virtual_event_rl_agent.sh | 4 ++-- docker/Dockerfile.localext | 2 +- docker/docker-compose-development.yml | 2 +- docker/files/robomaker/devel.sh | 8 ++++---- docker/files/robomaker/run.sh | 4 ++-- docker/files/robomaker/shutdown.sh | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build-dev-bundle.sh b/build-dev-bundle.sh index 220bad76..84f4ff75 100755 --- a/build-dev-bundle.sh +++ b/build-dev-bundle.sh @@ -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 diff --git a/bundle/markov/utils.py b/bundle/markov/utils.py index 4c1584c5..fa59fa01 100644 --- a/bundle/markov/utils.py +++ b/bundle/markov/utils.py @@ -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) diff --git a/bundle/src/deepracer_simulation_environment/scripts/run_evaluation_rl_agent.sh b/bundle/src/deepracer_simulation_environment/scripts/run_evaluation_rl_agent.sh index 9cb393e2..56600240 100755 --- a/bundle/src/deepracer_simulation_environment/scripts/run_evaluation_rl_agent.sh +++ b/bundle/src/deepracer_simulation_environment/scripts/run_evaluation_rl_agent.sh @@ -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 \ No newline at end of file diff --git a/bundle/src/deepracer_simulation_environment/scripts/run_rollout_rl_agent.sh b/bundle/src/deepracer_simulation_environment/scripts/run_rollout_rl_agent.sh index 0529e4d8..1b6ff100 100755 --- a/bundle/src/deepracer_simulation_environment/scripts/run_rollout_rl_agent.sh +++ b/bundle/src/deepracer_simulation_environment/scripts/run_rollout_rl_agent.sh @@ -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 diff --git a/bundle/src/deepracer_simulation_environment/scripts/run_virtual_event_rl_agent.sh b/bundle/src/deepracer_simulation_environment/scripts/run_virtual_event_rl_agent.sh index 2cccf8d7..7ce096f5 100644 --- a/bundle/src/deepracer_simulation_environment/scripts/run_virtual_event_rl_agent.sh +++ b/bundle/src/deepracer_simulation_environment/scripts/run_virtual_event_rl_agent.sh @@ -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 \ No newline at end of file diff --git a/docker/Dockerfile.localext b/docker/Dockerfile.localext index 1e6a9df6..0d0ad29f 100644 --- a/docker/Dockerfile.localext +++ b/docker/Dockerfile.localext @@ -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 diff --git a/docker/docker-compose-development.yml b/docker/docker-compose-development.yml index b5cd7844..e3b26d77 100644 --- a/docker/docker-compose-development.yml +++ b/docker/docker-compose-development.yml @@ -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' diff --git a/docker/files/robomaker/devel.sh b/docker/files/robomaker/devel.sh index d6ae57f0..2fe0db1c 100755 --- a/docker/files/robomaker/devel.sh +++ b/docker/files/robomaker/devel.sh @@ -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 diff --git a/docker/files/robomaker/run.sh b/docker/files/robomaker/run.sh index 8fb4e711..fff2b24e 100755 --- a/docker/files/robomaker/run.sh +++ b/docker/files/robomaker/run.sh @@ -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 @@ -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 diff --git a/docker/files/robomaker/shutdown.sh b/docker/files/robomaker/shutdown.sh index 93b01fd5..fd299525 100755 --- a/docker/files/robomaker/shutdown.sh +++ b/docker/files/robomaker/shutdown.sh @@ -1,2 +1,2 @@ #!/bin/bash -nohup bash -c 'sleep 20 && echo "Bye!" && kill 1' & \ No newline at end of file +nohup bash -c 'sleep 5 && echo "Bye!" && kill 1' & \ No newline at end of file