(improvement)(project) Remove Python module and related Python code. (#1263)

This commit is contained in:
lexluo09
2024-06-28 12:01:13 +08:00
committed by GitHub
parent 26cd73518d
commit a3d4f18df4
47 changed files with 17 additions and 3565 deletions

View File

@@ -23,12 +23,7 @@ del temp.txt
cd %baseDir%
if "%service%"=="%pyllm_service%" (
echo start installing python modules required by supersonic-pyllm: %pip_path%
%pip_path% install -r %projectDir%\headless\python\requirements.txt"
echo install python modules success
goto :EOF
) else if "%service%"=="webapp" (
if "%service%"=="webapp" (
call :buildWebapp
tar xvf supersonic-webapp.tar.gz
move /y supersonic-webapp webapp

View File

@@ -63,12 +63,7 @@ function packageRelease {
}
#1. build backend services
if [ "$service" == $PYLLM_SERVICE ]; then
echo "start installing python modules required by supersonic-pyllm: ${pip_path}"
requirementPath=$projectDir/headless/python/requirements.txt
${pip_path} install -r ${requirementPath}
echo "install python modules success"
elif [ "$service" == "webapp" ]; then
if [ "$service" == "webapp" ]; then
buildWebapp
target_path=$projectDir/launchers/$STANDALONE_SERVICE/target/classes
tar xvf $projectDir/webapp/supersonic-webapp.tar.gz -C $target_path

View File

@@ -2,8 +2,5 @@ set "sbinDir=%~dp0"
set "baseDir=%~dp0.."
set "buildDir=%baseDir%\build"
set "main_class=com.tencent.supersonic.StandaloneLauncher"
set "python_path=python"
set "pip_path=pip3"
set "standalone_service=standalone"
set "pyllm_service=pyllm"
set "projectDir=%baseDir%\.."

View File

@@ -1,9 +1,6 @@
#!/usr/bin/env bash
# environment parameters
python_path=${PYTHON_PATH:-"python3"}
pip_path=${PIP_PATH:-"pip3"}
sbinDir=$(cd "$(dirname "$0")"; pwd)
baseDir=$(cd "$sbinDir/.." && pwd -P)
runtimeDir=$baseDir/runtime
@@ -12,13 +9,8 @@ projectDir=$baseDir/..
readonly CHAT_APP_NAME="supersonic_chat"
readonly HEADLESS_APP_NAME="supersonic_headless"
readonly PYLLM_APP_NAME="supersonic_pyllm"
readonly STANDALONE_APP_NAME="supersonic_standalone"
readonly CHAT_SERVICE="chat"
readonly HEADLESS_SERVICE="headless"
readonly PYLLM_SERVICE="pyllm"
readonly STANDALONE_SERVICE="standalone"
readonly PYLLM_HOST="127.0.0.1"
readonly PYLLM_PORT="9092"
readonly STANDALONE_SERVICE="standalone"

View File

@@ -11,10 +11,6 @@ if "%service%"=="" (
set "service=%standalone_service%"
)
set "model_name=%service%"
IF "%service%"=="pyllm" (
set "llmProxy=PythonLLMProxy"
set "model_name=%standalone_service%"
)
cd %baseDir%
@@ -36,30 +32,15 @@ if "%command%"=="restart" (
goto :EOF
)
: start
if "%service%"=="%pyllm_service%" (
call :runPythonService
call :runJavaService
goto :EOF
)
call :runJavaService
goto :EOF
: stop
call :stopPythonService
call :stopJavaService
goto :EOF
: reloadExamples
set "pythonRunDir=%baseDir%\pyllm"
cd "%pythonRunDir%\sql"
start %python_path% examples_reload_run.py
goto :EOF
: runJavaService
echo 'java service starting, see logs in logs/'
set "libDir=%baseDir%\lib"
@@ -74,24 +55,6 @@ if "%command%"=="restart" (
echo 'java service started'
goto :EOF
: runPythonService
echo 'python service starting, see logs in pyllm\pyllm.log'
set "pythonRunDir=%baseDir%\pyllm"
start /B %python_path% %pythonRunDir%\supersonic_pyllm.py > %pythonRunDir%\pyllm.log 2>&1
timeout /t 10 >nul
echo 'python service started'
goto :EOF
: stopPythonService
for /f "tokens=2" %%i in ('tasklist ^| findstr /i "python"') do (
taskkill /PID %%i /F
echo "python service (PID = %%i) is killed."
)
goto :EOF
: stopJavaService
for /f "tokens=2" %%i in ('tasklist ^| findstr /i "java"') do (
taskkill /PID %%i /F

View File

@@ -10,10 +10,6 @@ if [ -z "$service" ]; then
fi
model_name=$service
if [ "$service" == "pyllm" ]; then
model_name=${STANDALONE_SERVICE}
export llmProxy=PythonLLMProxy
fi
cd $baseDir
function setMainClass {
@@ -36,11 +32,6 @@ function setAppName {
fi
}
function reloadExamples {
cd $baseDir/pyllm/sql
${python_path} examples_reload_run.py
}
function runJavaService {
javaRunDir=$baseDir
local_app_name=$1
@@ -72,49 +63,23 @@ function runJavaService {
fi
}
function runPythonService {
pythonRunDir=$baseDir/pyllm
cd $pythonRunDir
nohup ${python_path} supersonic_pyllm.py > $pythonRunDir/pyllm.log 2>&1 &
# add health check
for i in {1..10}
do
echo "pyllm health check attempt $i..."
response=$(curl -s http://${PYLLM_HOST}:${PYLLM_PORT}/health)
echo "pyllm health check response: $response"
status_ok="Healthy"
if [[ $response == *$status_ok* ]] ; then
echo "pyllm Health check passed."
break
else
if [ "$i" -eq 10 ]; then
echo "pyllm Health check failed after 10 attempts."
echo "May still downloading model files. Please check pyllm.log in runtime directory."
fi
echo "Retrying after 5 seconds..."
sleep 5
fi
done
}
function start()
{
local_app_name=$1
echo "Starting ${local_app_name}"
pid=$(ps aux |grep ${local_app_name} | grep -v grep | awk '{print $2}')
if [[ "$pid" == "" ]]; then
if [[ ${local_app_name} == $PYLLM_APP_NAME ]]; then
runPythonService ${local_app_name}
else
runJavaService ${local_app_name}
fi
else
echo "Process (PID = $pid) is running."
return 1
fi
echo "Start success"
}
function stop()
{
echo "Stopping $1"
pid=$(ps aux | grep $1 | grep -v grep | awk '{print $2}')
if [[ "$pid" == "" ]]; then
echo "Process $1 is not running !"
@@ -124,51 +89,21 @@ function stop()
echo "Process (PID = $pid) is killed !"
return 0
fi
}
function reload()
{
if [[ $1 == $PYLLM_APP_NAME ]]; then
reloadExamples
fi
echo "Stop success"
}
setMainClass
setAppName
case "$command" in
start)
if [ "$service" == $PYLLM_SERVICE ]; then
echo "Starting $PYLLM_APP_NAME"
start $PYLLM_APP_NAME
fi
echo "Starting ${app_name}"
start ${app_name}
echo "Start success"
;;
stop)
echo "Stopping $app_name"
stop $app_name
echo "Stopping $PYLLM_APP_NAME"
stop $PYLLM_APP_NAME
echo "Stop success"
;;
reload)
echo "Reloading ${app_name}"
reload ${app_name}
echo "Reload success"
;;
restart)
if [ "$service" == $PYLLM_SERVICE ]; then
echo "Stopping $PYLLM_APP_NAME"
stop $PYLLM_APP_NAME
echo "Starting $PYLLM_APP_NAME"
start $PYLLM_APP_NAME
fi
echo "Stopping ${app_name}"
stop ${app_name}
echo "Starting ${app_name}"
start ${app_name}
echo "Restart success"
;;
*)
echo "Use command {start|stop|restart} to run."

View File

@@ -20,12 +20,6 @@
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/../../headless/python</directory>
<outputDirectory>pyllm</outputDirectory>
<fileMode>0777</fileMode>
<directoryMode>0755</directoryMode>
</fileSet>
<fileSet>
<directory>${project.basedir}/../../assembly/bin</directory>
<excludes>