Skip to content

Commit

Permalink
fix: No logs from Windows run v4
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronNg committed May 14, 2024
1 parent 2616aa5 commit acc8ed0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
26 changes: 11 additions & 15 deletions .github/scripts/e2e-test-server-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 (
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit acc8ed0

Please sign in to comment.