From acc8ed085385d3e49d9c75d3c906543f2bacacb2 Mon Sep 17 00:00:00 2001 From: Cam Ng Date: Tue, 14 May 2024 23:31:56 +0700 Subject: [PATCH] fix: No logs from Windows run v4 --- .github/scripts/e2e-test-server-windows.bat | 26 +++++++++------------ .github/workflows/build.yml | 6 ++--- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/scripts/e2e-test-server-windows.bat b/.github/scripts/e2e-test-server-windows.bat index e15bc19..da0c6ec 100644 --- a/.github/scripts/e2e-test-server-windows.bat +++ b/.github/scripts/e2e-test-server-windows.bat @@ -17,7 +17,7 @@ for %%i in ("%BINARY_PATH%") do set "BINARY_NAME=%%~nxi" echo BINARY_NAME=%BINARY_NAME% -del %TEMP%\python-file-execution-res.log 2>nul +del %TEMP%\response1.log 2>nul del %TEMP%\server.log 2>nul set /a min=9999 @@ -28,7 +28,7 @@ set /a PORT=%min% + %RANDOM% %% %range% rem Start the binary file start /B "" "%BINARY_PATH%" "127.0.0.1" %PORT% > %TEMP%\server.log 2>&1 -ping -n 6 127.0.0.1 > nul +ping -n 6 127.0.0.1 %PORT% > nul rem Capture the PID of the started process with "server" in its name for /f "tokens=2" %%a in ('tasklist /fi "imagename eq %BINARY_NAME%" /fo list ^| findstr /B "PID:"') do ( @@ -44,43 +44,39 @@ if not defined pid ( ) rem Wait for a few seconds to let the server start -timeout /t 3 /nobreak >nul rem Define JSON strings for curl data -set "PYTHON_FILE_EXECUTION_PATH_STRING=%PYTHON_FILE_EXECUTION_PATH:\=\\%" +call set "PYTHON_FILE_EXECUTION_PATH_STRING=%%PYTHON_FILE_EXECUTION_PATH:\=\\%%" set "curl_data1={\"file_execution_path\":\"%PYTHON_FILE_EXECUTION_PATH_STRING%\"}" rem Print the values of curl_data for debugging echo curl_data1=%curl_data1% rem Run the curl commands and capture the status code -curl.exe --connect-timeout 60 -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/execute" --header "Content-Type: application/json" --data "%curl_data1%" > "%TEMP%\response1.log" +curl.exe --connect-timeout 60 -o "%TEMP%\response1.log" -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/loadmodel" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1.log 2>&1 set "error_occurred=0" rem Read the status code directly from the response file set "response1=" -for /f "usebackq delims=" %%a in ("%TEMP%\response1.log") do ( - if "%%a" gtr "199" if "%%a" lss "300" ( - set "response1=%%a" - ) -) +for /f %%a in (%TEMP%\response1.log) do set "response1=%%a" -if not defined response1 ( - echo The first curl command failed with status code: !response1! +if "%response1%" neq "200" ( + echo The first curl command failed with status code: %response1% type %TEMP%\response1.log set "error_occurred=1" ) -if "%error_occurred%"=="1" ( - echo Server test run failed!!!!!!!!!!!!!!!!!!!!!! -) +echo ---------------------- +echo Log python file execution: +type %TEMP%\response1.log echo ---------------------- echo Server logs: type %TEMP%\server.log if "%error_occurred%"=="1" ( + echo Server test run failed!!!!!!!!!!!!!!!!!!!!!! taskkill /f /pid %pid% echo An error occurred while running the server. exit /b 1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1fff76..8933cac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,14 +13,14 @@ jobs: matrix: include: - os: "linux" - name: "ubuntu-1" + name: "ubuntu-18-04" runs-on: "ubuntu-18-04" # run-e2e: true - os: "mac" - name: "arm64-1" + name: "arm64" runs-on: "mac-silicon" - os: "windows" - name: "amd64-avx2-cuda-12-0" + name: "amd64" runs-on: "windows-cuda-12-0" steps: