mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 20:51:48 +00:00
(fix):using virtual env and fix chromadb's version (#381)
This commit is contained in:
@@ -82,25 +82,39 @@ function runJavaService {
|
|||||||
# run python service
|
# run python service
|
||||||
function runPythonService {
|
function runPythonService {
|
||||||
pythonRunDir=${runtimeDir}/supersonic-${model_name}/llmparser
|
pythonRunDir=${runtimeDir}/supersonic-${model_name}/llmparser
|
||||||
cd $pythonRunDir
|
cd $pythonRunDir
|
||||||
nohup ${python_path} supersonic_llmparser.py > $pythonRunDir/llmparser.log 2>&1 &
|
# check if venv is available
|
||||||
# add health check
|
if ! ${python_path} -c "import venv" &> /dev/null; then
|
||||||
for i in {1..10}
|
echo "venv not found, installing virtualenv via pip..."
|
||||||
do
|
pip install virtualenv
|
||||||
echo "llmparser health check attempt $i..."
|
# create a virtual environment using virtualenv
|
||||||
response=$(curl -s http://${LLMPARSER_HOST}:${LLMPARSER_PORT}/health)
|
virtualenv venv
|
||||||
echo "llmparser health check response: $response"
|
|
||||||
status_ok="Healthy"
|
|
||||||
if [[ $response == *$status_ok* ]] ; then
|
|
||||||
echo "llmparser Health check passed."
|
|
||||||
break
|
|
||||||
else
|
else
|
||||||
if [ "$i" -eq 10 ]; then
|
# create a virtual environment using venv
|
||||||
echo "llmparser Health check failed after 10 attempts."
|
${python_path} -m venv venv
|
||||||
echo "May still downloading model files. Please check llmparser.log in runtime directory."
|
|
||||||
fi
|
|
||||||
echo "Retrying after 5 seconds..."
|
|
||||||
sleep 5
|
|
||||||
fi
|
fi
|
||||||
done
|
# activate the virtual environment
|
||||||
|
source venv/bin/activate
|
||||||
|
# install dependencies
|
||||||
|
pip install --upgrade -r requirements.txt
|
||||||
|
nohup ${python_path} supersonic_llmparser.py > $pythonRunDir/llmparser.log 2>&1 &
|
||||||
|
# add health check
|
||||||
|
for i in {1..10}
|
||||||
|
do
|
||||||
|
echo "llmparser health check attempt $i..."
|
||||||
|
response=$(curl -s http://${LLMPARSER_HOST}:${LLMPARSER_PORT}/health)
|
||||||
|
echo "llmparser health check response: $response"
|
||||||
|
status_ok="Healthy"
|
||||||
|
if [[ $response == *$status_ok* ]] ; then
|
||||||
|
echo "llmparser Health check passed."
|
||||||
|
break
|
||||||
|
else
|
||||||
|
if [ "$i" -eq 10 ]; then
|
||||||
|
echo "llmparser Health check failed after 10 attempts."
|
||||||
|
echo "May still downloading model files. Please check llmparser.log in runtime directory."
|
||||||
|
fi
|
||||||
|
echo "Retrying after 5 seconds..."
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
langchain==0.0.207
|
langchain==0.0.207
|
||||||
openai==0.27.4
|
openai==0.27.4
|
||||||
fastapi==0.95.1
|
fastapi==0.95.1
|
||||||
chromadb==0.3.21
|
chromadb==0.3.26
|
||||||
tiktoken==0.3.3
|
tiktoken==0.3.3
|
||||||
uvicorn[standard]==0.21.1
|
uvicorn[standard]==0.21.1
|
||||||
pandas==1.5.3
|
pandas==1.5.3
|
||||||
|
|||||||
Reference in New Issue
Block a user