Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Julian Hammer
pystencils
Commits
d91d3221
Commit
d91d3221
authored
Jul 11, 2019
by
Martin Bauer
Browse files
cpujit: try second time if module could not be loaded
parent
6373c03a
Changes
1
Hide whitespace changes
Inline
Side-by-side
pystencils/cpu/cpujit.py
View file @
d91d3221
...
...
@@ -401,9 +401,19 @@ def create_module_boilerplate_code(module_name, names):
def
load_kernel_from_file
(
module_name
,
function_name
,
path
):
from
importlib.util
import
spec_from_file_location
,
module_from_spec
spec
=
spec_from_file_location
(
name
=
module_name
,
location
=
path
)
mod
=
module_from_spec
(
spec
)
spec
.
loader
.
exec_module
(
mod
)
try
:
spec
=
spec_from_file_location
(
name
=
module_name
,
location
=
path
)
mod
=
module_from_spec
(
spec
)
spec
.
loader
.
exec_module
(
mod
)
except
ImportError
:
import
time
import
warnings
warnings
.
warn
(
"Could not load "
+
path
+
", trying on more time..."
)
time
.
sleep
(
1
)
spec
=
spec_from_file_location
(
name
=
module_name
,
location
=
path
)
mod
=
module_from_spec
(
spec
)
spec
.
loader
.
exec_module
(
mod
)
return
getattr
(
mod
,
function_name
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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