Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
268f6176
Unverified
Commit
268f6176
authored
Jan 27, 2022
by
nv-dlasalle
Committed by
GitHub
Jan 28, 2022
Browse files
Fix race condition in creating directory (#3696)
Co-authored-by:
Quan (Andy) Gan
<
coin2028@hotmail.com
>
parent
bf5497a2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
python/dgl/backend/set_default_backend.py
python/dgl/backend/set_default_backend.py
+2
-2
No files found.
python/dgl/backend/set_default_backend.py
View file @
268f6176
...
@@ -3,8 +3,8 @@ import os
...
@@ -3,8 +3,8 @@ import os
import
json
import
json
def
set_default_backend
(
default_dir
,
backend_name
):
def
set_default_backend
(
default_dir
,
backend_name
):
if
not
os
.
path
.
exists
(
default_dir
):
# the exists_ok requires python >= 3.2
os
.
makedirs
(
default_dir
)
os
.
makedirs
(
default_dir
,
exists_ok
=
True
)
config_path
=
os
.
path
.
join
(
default_dir
,
'config.json'
)
config_path
=
os
.
path
.
join
(
default_dir
,
'config.json'
)
with
open
(
config_path
,
"w"
)
as
config_file
:
with
open
(
config_path
,
"w"
)
as
config_file
:
json
.
dump
({
'backend'
:
backend_name
.
lower
()},
config_file
)
json
.
dump
({
'backend'
:
backend_name
.
lower
()},
config_file
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment