Skip to content

Commit

Permalink
feat(docker,ansible): download artifacts at runtime (autowarefoundati…
Browse files Browse the repository at this point in the history
  • Loading branch information
youtalk authored May 24, 2024
1 parent 14bc931 commit e8a258f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ansible/playbooks/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@
when: prompt_install_nvidia == 'y'
- role: autoware.dev_env.docker_engine
- role: autoware.dev_env.nvidia_container_toolkit

# ONNX files and other artifacts
- role: autoware.dev_env.artifacts
when: prompt_download_artifacts == 'y'
4 changes: 2 additions & 2 deletions docker/autoware-openadk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Install development tools and artifacts
RUN --mount=type=ssh \
./setup-dev-env.sh -y --module dev-tools --download-artifacts openadk \
./setup-dev-env.sh -y --module dev-tools openadk \
&& pip uninstall -y ansible ansible-core \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache

Expand All @@ -125,7 +125,7 @@ ARG SETUP_ARGS
COPY --from=src-imported /rosdep-exec-depend-packages.txt /tmp/rosdep-exec-depend-packages.txt
# hadolint ignore=SC2002
RUN --mount=type=ssh \
./setup-dev-env.sh -y --module all ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadk \
./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers --runtime openadk \
&& pip uninstall -y ansible ansible-core \
&& apt-get update \
&& cat /tmp/rosdep-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
Expand Down
14 changes: 12 additions & 2 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ fi
option_no_nvidia=false
option_devel=false
option_headless=false
DATA_PATH="${HOME}/autoware_data"
MAP_PATH=""
WORKSPACE_PATH=""
USER_ID=""
WORKSPACE=""
DEFAULT_LAUNCH_CMD="ros2 launch autoware_launch autoware.launch.xml map_path:=/autoware_map vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit"
DEFAULT_LAUNCH_CMD="ros2 launch autoware_launch autoware.launch.xml data_path:=/autoware_data map_path:=/autoware_map vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit"

# Function to print help message
print_help() {
Expand All @@ -35,6 +36,7 @@ print_help() {
echo -e "${RED}Usage:${NC} run.sh [OPTIONS] [LAUNCH_CMD](optional)"
echo -e "Options:"
echo -e " ${GREEN}--help/-h${NC} Display this help message"
echo -e " ${GREEN}--data-path${NC} Specify to mount data files into /autoware_data"
echo -e " ${GREEN}--map-path${NC} Specify to mount map files into /autoware_map (mandatory if no custom launch command is provided)"
echo -e " ${GREEN}--no-nvidia${NC} Disable NVIDIA GPU support"
echo -e " ${GREEN}--devel${NC} Use the latest development version of Autoware"
Expand Down Expand Up @@ -64,6 +66,10 @@ parse_arguments() {
WORKSPACE_PATH="$2"
shift
;;
--data-path)
DATA_PATH="$2"
shift
;;
--map-path)
MAP_PATH="$2"
shift
Expand Down Expand Up @@ -95,6 +101,9 @@ set_variables() {
exit 1
fi

# Mount data path
DATA="-v ${DATA_PATH}:/autoware_data:ro"

# Mount map path if provided
MAP="-v ${MAP_PATH}:/autoware_map:ro"

Expand Down Expand Up @@ -150,6 +159,7 @@ main() {

echo -e "${GREEN}\n-----------------------LAUNCHING CONTAINER-----------------------"
echo -e "${GREEN}IMAGE:${NC} ${IMAGE}"
echo -e "${GREEN}DATA PATH(mounted):${NC} ${DATA_PATH}:/autoware_data"
echo -e "${GREEN}MAP PATH(mounted):${NC} ${MAP_PATH}:/autoware_map"
echo -e "${GREEN}WORKSPACE(mounted):${NC} ${WORKSPACE_PATH}:/workspace"
echo -e "${GREEN}LAUNCH CMD:${NC} ${LAUNCH_CMD}"
Expand All @@ -159,7 +169,7 @@ main() {
set -x
docker run -it --rm --net=host ${GPU_FLAG} ${USER_ID} ${MOUNT_X} \
-e XAUTHORITY=${XAUTHORITY} -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR -e NVIDIA_DRIVER_CAPABILITIES=all -v /etc/localtime:/etc/localtime:ro \
${WORKSPACE} ${MAP} ${IMAGE} \
${WORKSPACE} ${DATA} ${MAP} ${IMAGE} \
${LAUNCH_CMD}
}

Expand Down
2 changes: 1 addition & 1 deletion setup-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ if [ "$option_yes" = "true" ] || [ "$option_download_artifacts" = "true" ]; then
fi

# Check downloading artifacts
if [ "$target_playbook" = "autoware.dev_env.openadk" ]; then
if [ "$target_playbook" = "autoware.dev_env.docker" ] || [ "$target_playbook" = "autoware.dev_env.openadk" ]; then
if [ "$option_download_artifacts" = "true" ]; then
echo -e "\e[36mArtifacts will be downloaded to $option_data_dir\e[m"
ansible_args+=("--extra-vars" "prompt_download_artifacts=y")
Expand Down

0 comments on commit e8a258f

Please sign in to comment.