From edcd4a20ea72dbc664327b3522427729e0b78f90 Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Mon, 24 Jan 2022 10:40:59 -0800 Subject: [PATCH] Exit once there's an environment error (#71693) Summary: Narrow the scope of https://github.com/pytorch/pytorch/issues/69730. Once there's an error, stop the script. Since it's a random error, it most likely has something with the environment. Let's see the stat. Pull Request resolved: https://github.com/pytorch/pytorch/pull/71693 Reviewed By: seemethere, mikaylagawarecki Differential Revision: D33742733 Pulled By: janeyx99 fbshipit-source-id: b453957c2cb450eb79b89614db426b50eef1d14f (cherry picked from commit cd32fa53d994c4c4590cd7f4962671330eda28c1) --- .jenkins/pytorch/win-test-helpers/test_python.bat | 7 +++++++ .../pytorch/win-test-helpers/test_python_first_shard.bat | 6 ++++++ .../pytorch/win-test-helpers/test_python_second_shard.bat | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/.jenkins/pytorch/win-test-helpers/test_python.bat b/.jenkins/pytorch/win-test-helpers/test_python.bat index 9f95a5c9d72..2de7ac4c3bc 100644 --- a/.jenkins/pytorch/win-test-helpers/test_python.bat +++ b/.jenkins/pytorch/win-test-helpers/test_python.bat @@ -1,4 +1,11 @@ call %SCRIPT_HELPERS_DIR%\setup_pytorch_env.bat +:: exit the batch once there's an error +if not errorlevel 0 ( + echo "setup pytorch env failed" + echo %errorlevel% + exit /b +) + pushd test if "%RUN_SMOKE_TESTS_ONLY%"=="1" ( :: Download specified test cases to run diff --git a/.jenkins/pytorch/win-test-helpers/test_python_first_shard.bat b/.jenkins/pytorch/win-test-helpers/test_python_first_shard.bat index 0e378e31db0..181259df7e3 100644 --- a/.jenkins/pytorch/win-test-helpers/test_python_first_shard.bat +++ b/.jenkins/pytorch/win-test-helpers/test_python_first_shard.bat @@ -1,4 +1,10 @@ call %SCRIPT_HELPERS_DIR%\setup_pytorch_env.bat +:: exit the batch once there's an error +if not errorlevel 0 ( + echo "setup pytorch env failed" + echo %errorlevel% + exit /b +) pushd test diff --git a/.jenkins/pytorch/win-test-helpers/test_python_second_shard.bat b/.jenkins/pytorch/win-test-helpers/test_python_second_shard.bat index cb583eaef1e..56d115f64df 100644 --- a/.jenkins/pytorch/win-test-helpers/test_python_second_shard.bat +++ b/.jenkins/pytorch/win-test-helpers/test_python_second_shard.bat @@ -1,4 +1,10 @@ call %SCRIPT_HELPERS_DIR%\setup_pytorch_env.bat +:: exit the batch once there's an error +if not errorlevel 0 ( + echo "setup pytorch env failed" + echo %errorlevel% + exit /b +) echo Copying over test times file copy /Y "%PYTORCH_FINAL_PACKAGE_DIR_WIN%\.pytorch-test-times.json" "%TEST_DIR_WIN%"