From 224e447d4ea0cab44de0432c5a8f786c562aae7c Mon Sep 17 00:00:00 2001 From: Eran Cohen Date: Mon, 8 Jul 2024 15:13:52 +0300 Subject: [PATCH] Add support for running ilab container in background or foreground mode - Introduce PODMAN_BACKGROUND_MODE environment variable to control podman run mode - Use --detach flag for background mode and --interactive flag for foreground mode - Update PODMAN_COMMAND to include the appropriate flag based on PODMAN_BACKGROUND_MODE This change allows the script to conditionally run ilab podman containers in the background or foreground based on the value of the PODMAN_BACKGROUND_MODE environment variable Signed-off-by: Eran Cohen --- training/ilab-wrapper/ilab | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/training/ilab-wrapper/ilab b/training/ilab-wrapper/ilab index d023880..3dc9d28 100755 --- a/training/ilab-wrapper/ilab +++ b/training/ilab-wrapper/ilab @@ -102,8 +102,16 @@ get_model() { fi } +if [[ "${PODMAN_BACKGROUND_MODE}" == "true" ]]; then + echo "Running in background mode" + PODMAN_BACKGROUND_MODE_FLAGS="--detach" +else + echo "Running in foreground mode" + PODMAN_BACKGROUND_MODE_FLAGS="--interactive" +fi + mkdir -p "${HOST_CACHE}" -PODMAN_COMMAND=("podman" "run" "--rm" "-it" "--device" "${CONTAINER_DEVICE}" \ +PODMAN_COMMAND=("podman" "run" "--rm" "-t" "${PODMAN_BACKGROUND_MODE_FLAGS}" "--device" "${CONTAINER_DEVICE}" \ "--security-opt" "label=disable" "--net" "host" \ "-v" "${WORKDIR}:/instructlab" "--entrypoint" "" \ "-e" "HF_HOME=${CONTAINER_CACHE}" \