Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Cherrypick Fix nightly large_vector test caused by incorrect with_see…
Browse files Browse the repository at this point in the history
…d path (#18178) (#18220)

* Fix nightly large_vector test caused by incorrect with_seed path (#18178)

* pylint astroid sanity issue
  • Loading branch information
ChaiBapchya committed May 4, 2020
1 parent 38e6634 commit 295e939
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 25 deletions.
3 changes: 2 additions & 1 deletion ci/docker/install/requirements
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ mock==2.0.0
nose==1.3.7
nose-timer==0.7.3
numpy>1.16.0,<2.0.0
pylint==2.3.1; python_version >= '3.0'
pylint==2.3.1 # pylint and astroid need to be aligned
astroid==2.3.3 # pylint and astroid need to be aligned
requests<2.19.0,>=2.18.4
scipy==1.2.1
six==1.11.0
Expand Down
2 changes: 1 addition & 1 deletion tests/nightly/test_large_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from mxnet.test_utils import rand_ndarray, assert_almost_equal, rand_coord_2d, default_context, check_symbolic_forward, create_2d_tensor
from mxnet import gluon, nd
from common import with_seed, with_post_test_cleanup
from common import with_seed
from nose.tools import with_setup
import unittest

Expand Down
2 changes: 1 addition & 1 deletion tests/nightly/test_large_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from mxnet.test_utils import rand_ndarray, assert_almost_equal, rand_coord_2d, create_vector
from mxnet import gluon, nd
from tests.python.unittest.common import with_seed
from common import with_seed
from nose.tools import with_setup
import unittest

Expand Down
23 changes: 1 addition & 22 deletions tests/python/unittest/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,27 +310,6 @@ def teardown():
mx.nd.waitall()


def with_post_test_cleanup():
"""
Helper function that cleans up memory by releasing it from memory pool
Required especially by large tensor tests that have memory footprints in GBs.
"""
def test_helper(orig_test):
@make_decorator(orig_test)
def test_new(*args, **kwargs):
logger = default_logger()
try:
orig_test(*args, **kwargs)
except:
logger.info(test_msg)
raise
finally:
mx.nd.waitall()
mx.cpu().empty_cache()
return test_new
return test_helper


def run_in_spawned_process(func, env, *args):
"""
Helper function to run a test in its own process.
Expand Down Expand Up @@ -373,4 +352,4 @@ def run_in_spawned_process(func, env, *args):
finally:
os.environ.clear()
os.environ.update(orig_environ)
return True
return True

0 comments on commit 295e939

Please sign in to comment.