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
8ac383d7
Commit
8ac383d7
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
wxIdleLoop absorbs errors thrown by tasks, prints a warning.
parent
88887dbe
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/utils/async.py
+13
-5
13 additions, 5 deletions
fsl/utils/async.py
fsl/utils/notifier.py
+2
-1
2 additions, 1 deletion
fsl/utils/notifier.py
with
15 additions
and
6 deletions
fsl/utils/async.py
+
13
−
5
View file @
8ac383d7
...
@@ -247,22 +247,30 @@ def _wxIdleLoop(ev):
...
@@ -247,22 +247,30 @@ def _wxIdleLoop(ev):
now
=
time
.
time
()
now
=
time
.
time
()
elapsed
=
now
-
task
.
schedtime
elapsed
=
now
-
task
.
schedtime
queueSizeOffset
=
0
queueSizeOffset
=
0
taskName
=
task
.
name
funcName
=
getattr
(
task
.
task
,
'
__name__
'
,
'
<unknown>
'
)
if
taskName
is
None
:
taskName
=
funcName
else
:
taskName
=
'
{} [{}]
'
.
format
(
taskName
,
funcName
)
# Has enouggh time elapsed
# Has enouggh time elapsed
# since the task was scheduled?
# since the task was scheduled?
# If not, re-queue the task.
# If not, re-queue the task.
if
elapsed
<
task
.
after
:
if
elapsed
<
task
.
after
:
log
.
debug
(
'
Re-queueing function ({}) on wx idle
'
log
.
debug
(
'
Re-queueing function ({}) on wx idle loop
'
.
format
(
taskName
))
'
loop
'
.
format
(
getattr
(
task
.
task
,
'
__name__
'
,
'
<unknown>
'
)))
_idleQueue
.
put_nowait
(
task
)
_idleQueue
.
put_nowait
(
task
)
queueSizeOffset
=
1
queueSizeOffset
=
1
# Has the task timed out?
# Has the task timed out?
elif
task
.
timeout
==
0
or
(
elapsed
<
task
.
timeout
):
elif
task
.
timeout
==
0
or
(
elapsed
<
task
.
timeout
):
log
.
debug
(
'
Running function ({}) on wx idle
'
log
.
debug
(
'
Running function ({}) on wx idle loop
'
.
format
(
taskName
))
'
loop
'
.
format
(
getattr
(
task
.
task
,
'
__name__
'
,
'
<unknown>
'
)))
task
.
task
(
*
task
.
args
,
**
task
.
kwargs
)
try
:
task
.
task
(
*
task
.
args
,
**
task
.
kwargs
)
except
Exception
as
e
:
log
.
warning
(
'
Idle task {} crashed - {}: {}
'
.
format
(
taskName
,
type
(
e
).
__name__
,
str
(
e
)))
if
task
.
name
is
not
None
:
if
task
.
name
is
not
None
:
_idleQueueSet
.
discard
(
task
.
name
)
_idleQueueSet
.
discard
(
task
.
name
)
...
...
This diff is collapsed.
Click to expand it.
fsl/utils/notifier.py
+
2
−
1
View file @
8ac383d7
...
@@ -14,7 +14,8 @@ import inspect
...
@@ -14,7 +14,8 @@ import inspect
import
collections
import
collections
import
props
import
props
import
async
import
fsl.utils.async
as
async
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
...
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