Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Christoph Alt
pystencils
Commits
2b466db5
Commit
2b466db5
authored
Apr 29, 2021
by
Michael Kuron
Browse files
atomically write cache status file
parent
63536d22
Changes
1
Hide whitespace changes
Inline
Side-by-side
pystencils/cpu/cpujit.py
View file @
2b466db5
...
...
@@ -52,7 +52,7 @@ import subprocess
import
textwrap
from
collections
import
OrderedDict
from
sysconfig
import
get_paths
from
tempfile
import
TemporaryDirectory
from
tempfile
import
TemporaryDirectory
,
NamedTemporaryFile
import
numpy
as
np
from
appdirs
import
user_cache_dir
,
user_config_dir
...
...
@@ -221,7 +221,9 @@ def read_config():
shutil
.
rmtree
(
config
[
'cache'
][
'object_cache'
],
ignore_errors
=
True
)
create_folder
(
config
[
'cache'
][
'object_cache'
],
False
)
json
.
dump
(
config
[
'compiler'
],
open
(
cache_status_file
,
'w'
),
indent
=
4
)
with
NamedTemporaryFile
(
'w'
,
dir
=
os
.
path
.
dirname
(
cache_status_file
),
delete
=
False
)
as
f
:
json
.
dump
(
config
[
'compiler'
],
f
,
indent
=
4
)
os
.
replace
(
f
.
name
,
cache_status_file
)
if
config
[
'compiler'
][
'os'
]
==
'windows'
:
from
pystencils.cpu.msvc_detection
import
get_environment
...
...
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