mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-07 05:18:12 +08:00
Merge pull request #73 from Koed00/gevent
Removes pycharm stdin bug workaround
This commit is contained in:
@@ -13,7 +13,6 @@ standard_library.install_aliases()
|
|||||||
import importlib
|
import importlib
|
||||||
import signal
|
import signal
|
||||||
import socket
|
import socket
|
||||||
import sys
|
|
||||||
import ast
|
import ast
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from multiprocessing import Queue, Event, Process, Value, current_process
|
from multiprocessing import Queue, Event, Process, Value, current_process
|
||||||
@@ -49,12 +48,6 @@ class Cluster(object):
|
|||||||
signal.signal(signal.SIGINT, self.sig_handler)
|
signal.signal(signal.SIGINT, self.sig_handler)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
# This is just for PyCharm to not crash. Ignore it.
|
|
||||||
if not hasattr(sys.stdin, 'close'):
|
|
||||||
def dummy_close():
|
|
||||||
pass
|
|
||||||
|
|
||||||
sys.stdin.close = dummy_close
|
|
||||||
# Start Sentinel
|
# Start Sentinel
|
||||||
self.stop_event = Event()
|
self.stop_event = Event()
|
||||||
self.start_event = Event()
|
self.start_event = Event()
|
||||||
@@ -150,12 +143,6 @@ class Sentinel(object):
|
|||||||
"""
|
"""
|
||||||
:type target: function or class
|
:type target: function or class
|
||||||
"""
|
"""
|
||||||
# This is just for PyCharm to not crash. Ignore it.
|
|
||||||
if not hasattr(sys.stdin, 'close'):
|
|
||||||
def dummy_close():
|
|
||||||
pass
|
|
||||||
|
|
||||||
sys.stdin.close = dummy_close
|
|
||||||
p = Process(target=target, args=args)
|
p = Process(target=target, args=args)
|
||||||
p.daemon = True
|
p.daemon = True
|
||||||
if target == worker:
|
if target == worker:
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ def test_cluster_initial(broker):
|
|||||||
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
|
||||||
|
assert c.stop() is False
|
||||||
broker.delete_queue()
|
broker.delete_queue()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user