Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
fslpy
Commits
2359b49c
Commit
2359b49c
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
MNT: Hook in idle module to allow errors to be propagated. Useful for testing.
parent
8d7d19a9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/idle.py
+18
-5
18 additions, 5 deletions
fsl/utils/idle.py
with
18 additions
and
5 deletions
fsl/utils/idle.py
+
18
−
5
View file @
2359b49c
...
...
@@ -196,6 +196,13 @@ _idleCallRate = 200
"""
_idleAllowErrors
=
False
"""
Used for testing/debugging. If ``True``, and a function called on the idle
loop raises an error, that error will not be caught, and the idle loop will
stop.
"""
def
idleReset
():
"""
Reset the internal :func:`idle` queue state.
...
...
@@ -211,6 +218,7 @@ def idleReset():
global
_idleQueueDict
global
_idleTimer
global
_idleCallRate
global
_idleAllowErrors
if
_idleTimer
is
not
None
:
_idleTimer
.
Stop
()
...
...
@@ -221,11 +229,12 @@ def idleReset():
if
queue
is
not
None
:
newQueue
=
queue
.
Queue
()
else
:
newQueue
=
None
_idleRegistered
=
False
_idleQueue
=
newQueue
_idleQueueDict
=
{}
_idleTimer
=
None
_idleCallRate
=
200
_idleRegistered
=
False
_idleQueue
=
newQueue
_idleQueueDict
=
{}
_idleTimer
=
None
_idleCallRate
=
200
_idleAllowErrors
=
False
# Call idleReset on exit, in
...
...
@@ -294,6 +303,7 @@ def _wxIdleLoop(ev):
global
_idleQueueDict
global
_idleTimer
global
_idleCallRate
global
_idleAllowErrors
ev
.
Skip
()
...
...
@@ -342,6 +352,9 @@ def _wxIdleLoop(ev):
log
.
warning
(
'
Idle task {} crashed - {}: {}
'
.
format
(
taskName
,
type
(
e
).
__name__
,
str
(
e
)),
exc_info
=
True
)
if
_idleAllowErrors
:
raise
e
if
task
.
name
is
not
None
:
try
:
_idleQueueDict
.
pop
(
task
.
name
)
except
KeyError
:
pass
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment