Skip to content

Commit

Permalink
Fixed bug inside get_fixed_dirname
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 committed Mar 21, 2021
1 parent 19e6f67 commit c2215b0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
30 changes: 19 additions & 11 deletions tests/ignite/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,28 @@ def dirname():

@pytest.fixture()
def get_fixed_dirname(worker_id):
# multi-proc friendly fixed tmp dirname
path = f"/tmp/fixed_tmp_dirname_"
lrank = int(worker_id.replace("gw", "")) if "gw" in worker_id else 0

def getter(name="test"):
# multi-proc friendly fixed tmp dirname
path = f"/tmp/fixed_tmp_dirname_{name}"
lrank = int(worker_id.replace("gw", "")) if "gw" in worker_id else 0
nonlocal path
path += name
time.sleep(0.5 * lrank)
os.makedirs(path, exist_ok=True)
yield path
time.sleep(1.0 * lrank + 2.0)
if os.path.exists(path):
shutil.rmtree(path)
# sort of sync
time.sleep(1.0)

return getter
print(f"-- return {path}")
return path

yield getter

print("-- after yield getter, sleep")
time.sleep(1.0 * lrank + 1.0)
if os.path.exists(path):
print(f"-- after yield getter, remove {path}")
shutil.rmtree(path)
# sort of sync
print(f"-- after yield getter, sync sleep")
time.sleep(1.0)


@pytest.fixture()
Expand Down
3 changes: 1 addition & 2 deletions tests/run_cpu_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ if [ "${SKIP_DISTRIB_TESTS:-0}" -eq "1" ]; then
fi

export WORLD_SIZE=2


CUDA_VISIBLE_DEVICES="" pytest --cov ignite --cov-append --cov-report term-missing --cov-report xml --dist=each --tx $WORLD_SIZE*popen//python=python tests -m distributed -vvv
unset WORLD_SIZE
1 change: 1 addition & 0 deletions tests/run_gpu_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ if [ ${ngpus} -gt 1 ]; then

export WORLD_SIZE=${ngpus}
pytest --cov ignite --cov-append --cov-report term-missing --cov-report xml --dist=each --tx ${WORLD_SIZE}*popen//python=python tests -m distributed -vvv
unset WORLD_SIZE

fi

0 comments on commit c2215b0

Please sign in to comment.