Skip to content

Commit

Permalink
perf: run installBcc in a subshell
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Bailey committed Apr 13, 2024
1 parent f433ead commit 45a23a8
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions vhdbuilder/packer/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,17 @@ ls -ltr /opt/gpu/* >> ${VHD_LOGS_FILEPATH}
installBpftrace
echo " - $(bpftrace --version)" >> ${VHD_LOGS_FILEPATH}

installBcc
cat << EOF >> ${VHD_LOGS_FILEPATH}
- bcc-tools
- libbcc-examples
EOF
PARENT_DIR=$(pwd)

(
cd $PARENT_DIR || { echo "Subshell in the wrong directory" >&2; exit 1; }

installBcc

exit $?
) > /tmp/bcc.log 2>&1 &

BCC_PID=$!

echo "${CONTAINER_RUNTIME} images pre-pulled:" >> ${VHD_LOGS_FILEPATH}
stop_watch $capture_time "Pull NVIDIA driver image (mcr), Start installBcc subshell" false
Expand Down Expand Up @@ -492,6 +498,20 @@ if [[ $OS == $UBUNTU_OS_NAME ]]; then
sed -i 's/After=network-online.target/After=multi-user.target/g' /lib/systemd/system/motd-news.service
fi


wait $BCC_PID
BCC_EXIT_CODE=$?

if [ $BCC_EXIT_CODE -eq 0 ]; then
echo "Bcc tools successfully installed."
cat << EOF >> ${VHD_LOGS_FILEPATH}
- bcc-tools
- libbcc-examples
EOF
else
echo "Error: installBcc subshell failed with exit code $BCC_EXIT_CODE" >&2
fi

# use the private_packages_url to download and cache packages
if [[ -n ${PRIVATE_PACKAGES_URL} ]]; then
IFS=',' read -ra PRIVATE_URLS <<< "${PRIVATE_PACKAGES_URL}"
Expand Down

0 comments on commit 45a23a8

Please sign in to comment.