Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to attach host path to container's cache #2546

Merged
merged 1 commit into from
Oct 12, 2023
Merged
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
16 changes: 15 additions & 1 deletion .ci/start-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ while [[ $# -gt 0 ]]; do
shift # past argument
shift # past value
;;
-a|--attach-cache)
ATTACH_CACHE="$2"
shift # past argument
shift # past value
;;
-d|--debug)
DEBUG_CONTAINER=true
shift # past argument
Expand Down Expand Up @@ -81,6 +86,7 @@ cat << EndofMessage
-m|--mount Dataset root path to be mounted to the started container (absolute path)
-r|--reg Specify docker registry URL <default: local>
-d|--debug Flag to start debugging CI container
-a|--attach-cache Attach host path to the .cache on the container
-f|--fix-cpus Specify the number of CPUs to set for the CI container
-h|--help Print this message
EndofMessage
Expand All @@ -93,20 +99,26 @@ INSTANCE_NAME=$3
LABELS="self-hosted,Linux,X64"
ENV_FLAGS=""
MOUNT_FLAGS=""
CACHE_MOUNT_FLAGS=""

if [ "$ADDITIONAL_LABELS" != "" ]; then
LABELS="$LABELS,$ADDITIONAL_LABELS"
fi

echo "mount path option = $MOUNT_PATH"
echo "attached mount path option = $ATTACH_CACHE"

if [ "$MOUNT_PATH" != "" ]; then
ENV_FLAGS="-e CI_DATA_ROOT=/home/validation/data"
MOUNT_FLAGS="-v $MOUNT_PATH:/home/validation/data:ro"
LABELS="$LABELS,dmount"
fi

echo "env flags = $ENV_FLAGS, mount flags = $MOUNT_FLAGS"
if [ "$ATTACH_CACHE" != "" ]; then
CACHE_MOUNT_FLAGS="-v $ATTACH_CACHE:/home/validation/.cache:rw"
fi

echo "env flags = $ENV_FLAGS, mount flags = $MOUNT_FLAGS, cache mount flag = $CACHE_MOUNT_FLAGS"

if [ "$DEBUG_CONTAINER" = true ]; then
CONTAINER_NAME="otx-ci-container-debug"
Expand Down Expand Up @@ -142,6 +154,7 @@ if [ "$DEBUG_CONTAINER" = true ]; then
-e NVIDIA_VISIBLE_DEVICES="$GPU_ID" \
${ENV_FLAGS} \
${MOUNT_FLAGS} \
${CACHE_MOUNT_FLAGS} \
"$DOCKER_REG_ADDR"/ote/ci/cu"$VER_CUDA"/runner:"$TAG_RUNNER"; RET=$?

if [ $RET -ne 0 ]; then
Expand All @@ -162,6 +175,7 @@ else
-e NVIDIA_VISIBLE_DEVICES="$GPU_ID" \
${ENV_FLAGS} \
${MOUNT_FLAGS} \
${CACHE_MOUNT_FLAGS} \
"$DOCKER_REG_ADDR"/ote/ci/cu"$VER_CUDA"/runner:"$TAG_RUNNER"; RET=$?

if [ $RET -ne 0 ]; then
Expand Down