Skip to content

Commit

Permalink
run ray stop before ray tests started (fix ray memory test fail issue) (
Browse files Browse the repository at this point in the history
intel-analytics#3193)

* run ray stop before ray tests started

* add more ray stop

* fix ray memory issue

* change scope to class

* change mxnet scope to function
  • Loading branch information
yangw1234 committed Dec 7, 2020
1 parent abc38b8 commit e869779
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
2 changes: 2 additions & 0 deletions pyzoo/dev/run-pytests-horovod-pytorch
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ cd "`dirname $0`"
export PYSPARK_PYTHON=python
export PYSPARK_DRIVER_PYTHON=python

ray stop -f

echo "Running RayOnSpark tests"
python -m pytest -v ../test/zoo/orca/learn/ray/pytorch/test_estimator_horovod_backend.py
exit_status_1=$?
Expand Down
2 changes: 2 additions & 0 deletions pyzoo/dev/run-pytests-horovod-tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ cd "`dirname $0`"
export PYSPARK_PYTHON=python
export PYSPARK_DRIVER_PYTHON=python

ray stop -f

echo "Running RayOnSpark tests"
python -m pytest -v ../test/zoo/orca/learn/ray/tf/test_tf_ray_estimator.py
exit_status_1=$?
Expand Down
29 changes: 20 additions & 9 deletions pyzoo/dev/run-pytests-ray
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,7 @@ cd "`dirname $0`"
export PYSPARK_PYTHON=python
export PYSPARK_DRIVER_PYTHON=python

echo "Running RayOnSpark tests"
python -m pytest -v ../test/zoo/ray/ \
--ignore=../test/zoo/ray/integration/ \
--ignore=../test/zoo/ray/test_reinit_raycontext.py
exit_status_1=$?
if [ $exit_status_1 -ne 0 ];
then
exit $exit_status_1
fi
ray stop -f

echo "Running orca learn ray tests"
python -m pytest -v ../test/zoo/orca/learn/ray \
Expand All @@ -43,6 +35,8 @@ then
exit $exit_status_2
fi

ray stop -f

echo "Running automl tests"
python -m pytest -v ../test/zoo/automl
exit_status_3=$?
Expand All @@ -51,6 +45,8 @@ then
exit $exit_status_3
fi

ray stop -f

echo "Running zouwu tests"
python -m pytest -v ../test/zoo/zouwu \
-k "not test_forecast_tcmf_distributed"
Expand All @@ -60,6 +56,8 @@ then
exit $exit_status_4
fi

ray stop -f

echo "Running orca data tests"
python -m pytest -v ../test/zoo/orca/data
exit_status_5=$?
Expand All @@ -68,3 +66,16 @@ then
exit $exit_status_5
fi

ray stop -f

echo "Running RayOnSpark tests"
python -m pytest -v ../test/zoo/ray/ \
--ignore=../test/zoo/ray/integration/ \
--ignore=../test/zoo/ray/test_reinit_raycontext.py
exit_status_1=$?
if [ $exit_status_1 -ne 0 ];
then
exit $exit_status_1
fi

ray stop -f
2 changes: 1 addition & 1 deletion pyzoo/test/zoo/automl/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
ray_ctx = None


@pytest.fixture(autouse=True, scope='package')
@pytest.fixture(autouse=True, scope='class')
def automl_fixture():
from zoo import init_spark_on_local
from zoo.ray import RayContext
Expand Down
2 changes: 1 addition & 1 deletion pyzoo/test/zoo/orca/learn/ray/mxnet/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import pytest


@pytest.fixture(autouse=True, scope='package')
@pytest.fixture(autouse=True, scope='function')
def orca_context_fixture():
from zoo.orca import init_orca_context, stop_orca_context
init_orca_context(cores=8, init_ray_on_spark=True,
Expand Down

0 comments on commit e869779

Please sign in to comment.