Skip to content

Commit

Permalink
Merge pull request #5 from iksnagreb/refactor/non-interactive
Browse files Browse the repository at this point in the history
WIP: Non-Interactive Docker Run
  • Loading branch information
fpjentzsch authored Jan 29, 2025
2 parents 89896c6 + 1cf9228 commit 1693f2a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ SCRIPTPATH=$(dirname "$SCRIPT")
: ${FINN_SKIP_XRT_DOWNLOAD=""}
: ${FINN_XRT_PATH=""}
: ${FINN_DOCKER_NO_CACHE="0"}

DOCKER_INTERACTIVE=""
# Default to interactive runs, for non-interactive set DOCKER_INTERACTIVE=""
: "${DOCKER_INTERACTIVE="-it"}"

# Catch FINN_DOCKER_EXTRA options being passed in without a trailing space
FINN_DOCKER_EXTRA+=" "
Expand Down Expand Up @@ -132,21 +132,21 @@ elif [ "$1" = "notebook" ]; then
elif [ "$1" = "build_dataflow" ]; then
BUILD_DATAFLOW_DIR=$(readlink -f "$2")
FINN_DOCKER_EXTRA+="-v $BUILD_DATAFLOW_DIR:$BUILD_DATAFLOW_DIR "
DOCKER_INTERACTIVE="-it"
#FINN_HOST_BUILD_DIR=$BUILD_DATAFLOW_DIR/build
gecho "Running build_dataflow for folder $BUILD_DATAFLOW_DIR"
DOCKER_CMD="build_dataflow $BUILD_DATAFLOW_DIR"
elif [ "$1" = "build_custom" ]; then
BUILD_CUSTOM_DIR=$(readlink -f "$2")
FLOW_NAME=${3:-build}
FINN_DOCKER_EXTRA+="-v $BUILD_CUSTOM_DIR:$BUILD_CUSTOM_DIR -w $BUILD_CUSTOM_DIR "
DOCKER_INTERACTIVE="-it"
#FINN_HOST_BUILD_DIR=$BUILD_DATAFLOW_DIR/build
gecho "Running build_custom: $BUILD_CUSTOM_DIR/$FLOW_NAME.py"
DOCKER_CMD="python -mpdb -cc -cq $FLOW_NAME.py ${@:4}"
elif [ -z "$1" ]; then
gecho "Running container only"
DOCKER_CMD="bash"
# Overwrite: container only should always be interactive as it drops us into
# a bash prompt...
DOCKER_INTERACTIVE="-it"
else
gecho "Running container with passed arguments"
Expand Down Expand Up @@ -181,7 +181,11 @@ gecho "Using default PYNQ board $PYNQ_BOARD"

# Ensure git-based deps are checked out at correct commit
if [ "$FINN_SKIP_DEP_REPOS" = "0" ]; then
# Need to ensure this is done within the finn/ root folder:
OLD_PWD=$(pwd)
cd $SCRIPTPATH
./fetch-repos.sh
cd $OLD_PWD
fi

# If xrt path given, copy .deb file to this repo
Expand Down Expand Up @@ -212,7 +216,7 @@ fi
# Launch container with current directory mounted
# important to pass the --init flag here for correct Vivado operation, see:
# https://stackoverflow.com/questions/55733058/vivado-synthesis-hangs-in-docker-container-spawned-by-jenkins
DOCKER_BASE="docker run -t --rm $DOCKER_INTERACTIVE --tty --init --hostname $DOCKER_INST_NAME "
DOCKER_BASE="docker run --rm $DOCKER_INTERACTIVE --init --hostname $DOCKER_INST_NAME "
DOCKER_EXEC="-e SHELL=/bin/bash "
DOCKER_EXEC+="-w $SCRIPTPATH "
DOCKER_EXEC+="-v $SCRIPTPATH:$SCRIPTPATH "
Expand Down

0 comments on commit 1693f2a

Please sign in to comment.