Skip to content

Commit

Permalink
Add option to attach host path to container's cache (#2546)
Browse files Browse the repository at this point in the history
  • Loading branch information
yunchu authored Oct 12, 2023
1 parent c4d810a commit 66ec76d
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit 66ec76d

Please sign in to comment.