mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-22 16:07:51 +08:00
[CI] Optimize log cleanup and isolation in unittest (#7132)
This commit is contained in:
+12
-10
@@ -117,16 +117,6 @@ run_test_with_logging() {
|
||||
echo "======================================================="
|
||||
fi
|
||||
|
||||
# if passed, remove the isolated log directory and server logs
|
||||
if [ "$status" -eq 0 ]; then
|
||||
rm -rf "${isolated_log_dir}" || true
|
||||
# Clean up server logs in run_path on pass
|
||||
for f in "${run_path}"/*.log; do
|
||||
[[ "$(basename "$f")" != "${failed_tests_file}" ]] && rm -f "$f" || true
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Clean up port-related processes
|
||||
if [ -n "$FD_CACHE_QUEUE_PORT" ]; then
|
||||
ps -ef | grep "${FD_CACHE_QUEUE_PORT}" | grep -v grep | awk '{print $2}' | xargs -r kill -9 || true
|
||||
@@ -135,6 +125,15 @@ run_test_with_logging() {
|
||||
ps -ef | grep "${FD_ENGINE_QUEUE_PORT}" | grep -v grep | awk '{print $2}' | xargs -r kill -9 || true
|
||||
fi
|
||||
|
||||
# if passed, remove the isolated log directory and server logs
|
||||
if [ "$status" -eq 0 ]; then
|
||||
rm -rf "${isolated_log_dir}" || true
|
||||
# Clean up server logs in run_path on pass
|
||||
for f in "${run_path}"/*.log; do
|
||||
[[ "$(basename "$f")" != "${failed_tests_file}" ]] && rm -f "$f" || true
|
||||
done
|
||||
fi
|
||||
|
||||
# Unset FD_LOG_DIR to avoid affecting next test
|
||||
unset FD_LOG_DIR
|
||||
return $status
|
||||
@@ -331,6 +330,9 @@ if [ "$failed_count" -ne 0 ]; then
|
||||
if [ -d "${run_path}/unittest_logs" ]; then
|
||||
echo "Cleaning empty directories..."
|
||||
|
||||
# remove console_error.log files (cleanup logs from stopped processes)
|
||||
find "${run_path}/unittest_logs" -name "console_error.log*" -delete || true
|
||||
|
||||
# perform multi-round clean until no more empty directories are found
|
||||
while true; do
|
||||
before=$(find "${run_path}/unittest_logs" -type d | wc -l)
|
||||
|
||||
Reference in New Issue
Block a user