From bdbb599f1f7ff54e4a0a09ad1a2d15a8ada92790 Mon Sep 17 00:00:00 2001 From: Tim Hatch Date: Wed, 31 Jul 2019 16:11:43 -0700 Subject: [PATCH] Make tests multi-process friendly. This side effect at module import time has a race condition between the "exists" check and the "mkdir" call. The safer thing is to just call mkdir and catch the "already exists" error which is what makedirs does. --- python/tvm/contrib/download.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tvm/contrib/download.py b/python/tvm/contrib/download.py index bc6d32476eb7..b3ba7efe2a02 100644 --- a/python/tvm/contrib/download.py +++ b/python/tvm/contrib/download.py @@ -120,8 +120,8 @@ def _download_progress(count, block_size, total_size): TEST_DATA_ROOT_PATH = os.path.join(os.path.expanduser('~'), '.tvm_test_data') -if not os.path.exists(TEST_DATA_ROOT_PATH): - os.mkdir(TEST_DATA_ROOT_PATH) +os.makedirs(TEST_DATA_ROOT_PATH, exist_ok=True) + def download_testdata(url, relpath, module=None): """Downloads the test data from the internet.