diff --git a/build-and-copy.sh b/build-and-copy.sh index d019ea0..a304e7c 100755 --- a/build-and-copy.sh +++ b/build-and-copy.sh @@ -27,6 +27,7 @@ FLASHINFER_RELEASE_TAG="prebuilt-flashinfer-current" VLLM_RELEASE_TAG="prebuilt-vllm-current" # Space-separated list of GPU architectures for which prebuilt wheels are available PREBUILT_WHEELS_SUPPORTED_ARCHS="12.1a" +CLEANUP_MODE="false" cleanup() { if [ -n "$TMP_IMAGE" ] && [ -f "$TMP_IMAGE" ]; then @@ -278,6 +279,7 @@ usage() { echo " --full-log : Enable full build logging (--progress=plain)" echo " --no-build : Skip building, only copy image (requires --copy-to)" echo " --network : Docker network to use during build" + echo " --cleanup : Remove all *.whl and *.-commit files in wheels directory" echo " -h, --help : Show this help message" exit 1 } @@ -339,6 +341,7 @@ while [[ "$#" -gt 0 ]]; do ;; --full-log) FULL_LOG=true ;; --no-build) NO_BUILD=true ;; + --cleanup) CLEANUP_MODE=true ;; --network) if [ -n "$2" ] && [[ "$2" != -* ]]; then NETWORK_ARG="$2" @@ -372,6 +375,30 @@ if [ "$NO_BUILD" = true ] && [ "${#COPY_HOSTS[@]}" -eq 0 ]; then exit 1 fi +# Handle cleanup mode +if [[ "$CLEANUP_MODE" == "true" ]]; then + WHEELS_DIR="./wheels" + echo "Cleaning up wheels directory..." + + # Remove all .whl files + if compgen -G "$WHEELS_DIR/*.whl" > /dev/null 2>&1; then + rm -f "$WHEELS_DIR"/*.whl + echo "Removed *.whl files from $WHEELS_DIR" + else + echo "No *.whl files found in $WHEELS_DIR" + fi + + # Remove all .-commit files + if compgen -G "$WHEELS_DIR/*.-commit" > /dev/null 2>&1; then + rm -f "$WHEELS_DIR"/*.-commit + echo "Removed *.-commit files from $WHEELS_DIR" + else + echo "No *.-commit files found in $WHEELS_DIR" + fi + + echo "Cleanup complete." +fi + # Ensure wheels directory exists mkdir -p ./wheels diff --git a/launch-cluster.sh b/launch-cluster.sh index 636a9af..24b6a42 100755 --- a/launch-cluster.sh +++ b/launch-cluster.sh @@ -43,7 +43,6 @@ MEM_LIMIT_GB="110" MEM_SWAP_LIMIT_GB="" PIDS_LIMIT="4096" SHM_SIZE_GB="64" -CLEANUP_MODE="false" # Function to print usage usage() { @@ -70,7 +69,6 @@ usage() { echo " --pids-limit Process limit (default: 4096, only with --non-privileged)" echo " --shm-size-gb Shared memory size in GB (default: 64, only with --non-privileged)" echo " --config Path to .env configuration file (default: .env in script directory)" - echo " --cleanup Remove all *.whl and *.-commit files in wheels directory" echo " action start | stop | status | exec (Default: start). Not compatible with --launch-script." echo " command Command to run (only for 'exec' action). Not compatible with --launch-script." echo "" @@ -131,7 +129,6 @@ while [[ "$#" -gt 0 ]]; do --pids-limit) PIDS_LIMIT="$2"; shift ;; --shm-size-gb) SHM_SIZE_GB="$2"; shift ;; -d) DAEMON_MODE="true" ;; - --cleanup) CLEANUP_MODE="true" ;; -h|--help) usage ;; --config) CONFIG_FILE="$2"; shift ;; start|stop|status) @@ -538,31 +535,6 @@ if [[ "$ACTION" == "stop" ]]; then exit 0 fi -# Handle 'cleanup' action -if [[ "$CLEANUP_MODE" == "true" ]]; then - WHEELS_DIR="$SCRIPT_DIR/wheels" - echo "Cleaning up wheels directory..." - - # Remove all .whl files - if compgen -G "$WHEELS_DIR/*.whl" > /dev/null 2>&1; then - rm -f "$WHEELS_DIR"/*.whl - echo "Removed *.whl files from $WHEELS_DIR" - else - echo "No *.whl files found in $WHEELS_DIR" - fi - - # Remove all .-commit files - if compgen -G "$WHEELS_DIR/*.-commit" > /dev/null 2>&1; then - rm -f "$WHEELS_DIR"/*.-commit - echo "Removed *.-commit files from $WHEELS_DIR" - else - echo "No *.-commit files found in $WHEELS_DIR" - fi - - echo "Cleanup complete." - exit 0 -fi - # Handle 'status' action if [[ "$ACTION" == "status" ]]; then echo "Checking status..."