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
c2d136b9
There was a problem fetching the pipeline summary.
Commit
c2d136b9
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 'master'
Fix to async module See merge request !24
parents
6ddf0582
1eaa0840
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+3
-1
3 additions, 1 deletion
.gitlab-ci.yml
fsl/utils/async.py
+17
-4
17 additions, 4 deletions
fsl/utils/async.py
with
20 additions
and
5 deletions
.gitlab-ci.yml
+
3
−
1
View file @
c2d136b9
...
...
@@ -320,6 +320,7 @@ build-doc:
-
python setup.py doc
-
mv doc/html doc/"$CI_COMMIT_REF_NAME"
artifacts
:
expire_in
:
1 day
paths
:
-
doc/$CI_COMMIT_REF_NAME
...
...
@@ -335,7 +336,7 @@ build-dist:
stage
:
build
image
:
python:3.5
tags
:
-
docker
...
...
@@ -345,6 +346,7 @@ build-dist:
-
python setup.py bdist_wheel
artifacts
:
expire_in
:
1 day
paths
:
-
dist/*
...
...
This diff is collapsed.
Click to expand it.
fsl/utils/async.py
+
17
−
4
View file @
c2d136b9
...
...
@@ -77,13 +77,11 @@ Other facilities
The ``async`` module also defines the :func:`mutex` decorator, which is
intended to be used to mark the methods of a class as being mutually exclusive.
The ``mutex`` decorator uses the :class:`MutexFactory` class to do its work.
.. todo:: You could possibly use ``props.callqueue`` to drive the idle loop.
"""
import
time
import
atexit
import
logging
import
functools
import
threading
...
...
@@ -213,6 +211,9 @@ def idleReset():
global
_idleTimer
global
_idleCallRate
if
_idleTimer
is
not
None
:
_idleTimer
.
Stop
()
_idleRegistered
=
False
_idleQueue
=
queue
.
Queue
()
_idleQueueDict
=
{}
...
...
@@ -220,6 +221,11 @@ def idleReset():
_idleCallRate
=
200
# Call idleReset on exit, in
# case the idleTimer is active.
atexit
.
register
(
idleReset
)
def
getIdleTimeout
():
"""
Returns the current ``wx`` idle loop time out/call rate.
"""
...
...
@@ -306,7 +312,7 @@ def _wxIdleLoop(ev):
if
taskName
is
None
:
taskName
=
funcName
else
:
taskName
=
'
{} [{}]
'
.
format
(
taskName
,
funcName
)
# Has enoug
g
h time elapsed
# Has enough time elapsed
# since the task was scheduled?
# If not, re-queue the task.
# If this is the only task on the
...
...
@@ -333,8 +339,15 @@ def _wxIdleLoop(ev):
try
:
_idleQueueDict
.
pop
(
task
.
name
)
except
KeyError
:
pass
# More tasks on the queue?
# Request anotherd event
if
_idleQueue
.
qsize
()
>
queueSizeOffset
:
ev
.
RequestMore
()
# Otherwise use the idle
# timer to make sure that
# the loop keeps ticking
# over
else
:
_idleTimer
.
Start
(
_idleCallRate
,
wx
.
TIMER_ONE_SHOT
)
...
...
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