mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-07 06:38:12 +08:00
Merge pull request #42 from Koed00/dev
Replaces qsize == 0 with empty()
This commit is contained in:
+1
-1
@@ -143,7 +143,7 @@ class Sentinel(object):
|
|||||||
if not self.start_event.is_set() and not self.stop_event.is_set():
|
if not self.start_event.is_set() and not self.stop_event.is_set():
|
||||||
return Conf.STARTING
|
return Conf.STARTING
|
||||||
elif self.start_event.is_set() and not self.stop_event.is_set():
|
elif self.start_event.is_set() and not self.stop_event.is_set():
|
||||||
if Conf.QSIZE and self.result_queue.qsize() == 0 and self.task_queue.qsize() == 0:
|
if self.result_queue.empty() and self.task_queue.empty():
|
||||||
return Conf.IDLE
|
return Conf.IDLE
|
||||||
return Conf.WORKING
|
return Conf.WORKING
|
||||||
elif self.stop_event.is_set() and self.start_event.is_set():
|
elif self.stop_event.is_set() and self.start_event.is_set():
|
||||||
|
|||||||
@@ -55,8 +55,7 @@ def test_cluster_initial(r):
|
|||||||
assert c.is_starting is False
|
assert c.is_starting is False
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
stat = c.stat
|
stat = c.stat
|
||||||
if Conf.QSIZE:
|
assert stat.status == Conf.IDLE
|
||||||
assert stat.status == Conf.IDLE
|
|
||||||
assert c.stop() is True
|
assert c.stop() is True
|
||||||
assert c.sentinel.is_alive() is False
|
assert c.sentinel.is_alive() is False
|
||||||
assert c.has_stopped
|
assert c.has_stopped
|
||||||
|
|||||||
+2
-2
@@ -30,7 +30,7 @@ State
|
|||||||
Current state of the cluster:
|
Current state of the cluster:
|
||||||
|
|
||||||
- **Starting** The cluster is spawning workers and getting ready.
|
- **Starting** The cluster is spawning workers and getting ready.
|
||||||
- **Idle** Everything is ok, but there are no tasks to process. [#f1]_
|
- **Idle** Everything is ok, but there are no tasks to process.
|
||||||
- **Working** Processing tasks like a good cluster should.
|
- **Working** Processing tasks like a good cluster should.
|
||||||
- **Stopping** The cluster does not take on any new tasks and is finishing.
|
- **Stopping** The cluster does not take on any new tasks and is finishing.
|
||||||
- **Stopped** All tasks have been processed and the cluster is shutting down.
|
- **Stopped** All tasks have been processed and the cluster is shutting down.
|
||||||
@@ -154,4 +154,4 @@ Reference
|
|||||||
|
|
||||||
.. rubric:: Footnotes
|
.. rubric:: Footnotes
|
||||||
|
|
||||||
.. [#f1] Uses :meth:`multiprocessing.Queue.qsize()` which is not implemented on OS X.
|
.. [#f1] Uses :meth:`multiprocessing.Queue.qsize()` which is not implemented on OS X and always returns 0.
|
||||||
|
|||||||
Reference in New Issue
Block a user