Skip to content

Commit

Permalink
Fix race condition in creating directory (dmlc#3696)
Browse files Browse the repository at this point in the history
Co-authored-by: Quan (Andy) Gan <[email protected]>
  • Loading branch information
nv-dlasalle and BarclayII authored Jan 28, 2022
1 parent bf5497a commit 268f617
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/dgl/backend/set_default_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import json

def set_default_backend(default_dir, backend_name):
if not os.path.exists(default_dir):
os.makedirs(default_dir)
# the exists_ok requires python >= 3.2
os.makedirs(default_dir, exists_ok=True)
config_path = os.path.join(default_dir, 'config.json')
with open(config_path, "w") as config_file:
json.dump({'backend': backend_name.lower()}, config_file)
Expand Down

0 comments on commit 268f617

Please sign in to comment.