dgx-spark-playbooks/nvidia/txt2kg/assets/stop.sh

88 lines
2.3 KiB
Bash
Raw Normal View History

2025-12-02 19:43:52 +00:00
#!/bin/bash
#
# SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Stop script for txt2kg project
2026-01-14 16:05:35 +00:00
# Check which Docker Compose version is available
DOCKER_COMPOSE_CMD=""
if docker compose version &> /dev/null; then
DOCKER_COMPOSE_CMD="docker compose"
elif command -v docker-compose &> /dev/null; then
DOCKER_COMPOSE_CMD="docker-compose"
else
echo "Error: Neither 'docker compose' nor 'docker-compose' is available"
exit 1
fi
2025-12-02 19:43:52 +00:00
# Parse command line arguments
2026-01-14 16:05:35 +00:00
USE_VLLM=false
USE_VECTOR_SEARCH=false
2025-12-02 19:43:52 +00:00
while [[ $# -gt 0 ]]; do
case $1 in
2026-01-14 16:05:35 +00:00
--vllm)
USE_VLLM=true
shift
;;
--vector-search)
USE_VECTOR_SEARCH=true
2025-12-02 19:43:52 +00:00
shift
;;
--help|-h)
echo "Usage: ./stop.sh [OPTIONS]"
echo ""
echo "Options:"
2026-01-14 16:05:35 +00:00
echo " --vllm Stop vLLM stack (use if you started with --vllm)"
echo " --vector-search Include vector search services"
2025-12-02 19:43:52 +00:00
echo " --help, -h Show this help message"
echo ""
2026-01-14 16:05:35 +00:00
echo "Note: Use the same flags you used with ./start.sh"
2025-12-02 19:43:52 +00:00
exit 0
;;
*)
echo "Unknown option: $1"
echo "Run './stop.sh --help' for usage information"
exit 1
;;
esac
done
2026-01-14 16:05:35 +00:00
# Select compose file
COMPOSE_DIR="$(pwd)/deploy/compose"
PROFILES=""
if [ "$USE_VLLM" = true ]; then
COMPOSE_FILE="$COMPOSE_DIR/docker-compose.vllm.yml"
2025-12-02 19:43:52 +00:00
else
2026-01-14 16:05:35 +00:00
COMPOSE_FILE="$COMPOSE_DIR/docker-compose.yml"
2025-12-02 19:43:52 +00:00
fi
2026-01-14 16:05:35 +00:00
CMD="$DOCKER_COMPOSE_CMD -f $COMPOSE_FILE"
2025-12-02 19:43:52 +00:00
2026-01-14 16:05:35 +00:00
if [ "$USE_VECTOR_SEARCH" = true ]; then
PROFILES="--profile vector-search"
2025-12-02 19:43:52 +00:00
fi
2026-01-14 16:05:35 +00:00
echo "Stopping txt2kg services..."
2025-12-02 19:43:52 +00:00
cd $(dirname "$0")
2026-01-14 16:05:35 +00:00
eval "$CMD $PROFILES down"
2025-12-02 19:43:52 +00:00
echo ""
2026-01-14 16:05:35 +00:00
echo "All services stopped."
2025-12-02 19:43:52 +00:00
echo "To start again, run: ./start.sh"