|
|
@ -10,12 +10,8 @@ except ImportError:
|
|
|
|
import socket
|
|
|
|
import socket
|
|
|
|
import signal
|
|
|
|
import signal
|
|
|
|
import traceback
|
|
|
|
import traceback
|
|
|
|
|
|
|
|
import logging
|
|
|
|
from cPickle import dumps
|
|
|
|
from cPickle import dumps
|
|
|
|
try:
|
|
|
|
|
|
|
|
from logbook import Logger
|
|
|
|
|
|
|
|
Logger = Logger # Does nothing except it shuts up pyflakes annoying error
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
|
|
|
|
from logging import Logger
|
|
|
|
|
|
|
|
from .queue import Queue, get_failed_queue
|
|
|
|
from .queue import Queue, get_failed_queue
|
|
|
|
from .connections import get_current_connection
|
|
|
|
from .connections import get_current_connection
|
|
|
|
from .utils import make_colorizer
|
|
|
|
from .utils import make_colorizer
|
|
|
@ -28,6 +24,8 @@ yellow = make_colorizer('darkyellow')
|
|
|
|
red = make_colorizer('darkred')
|
|
|
|
red = make_colorizer('darkred')
|
|
|
|
blue = make_colorizer('darkblue')
|
|
|
|
blue = make_colorizer('darkblue')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class StopRequested(Exception):
|
|
|
|
class StopRequested(Exception):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
@ -109,7 +107,7 @@ class Worker(object):
|
|
|
|
self._is_horse = False
|
|
|
|
self._is_horse = False
|
|
|
|
self._horse_pid = 0
|
|
|
|
self._horse_pid = 0
|
|
|
|
self._stopped = False
|
|
|
|
self._stopped = False
|
|
|
|
self.log = Logger('worker')
|
|
|
|
self.log = logger
|
|
|
|
self.failed_queue = get_failed_queue(connection=self.connection)
|
|
|
|
self.failed_queue = get_failed_queue(connection=self.connection)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -363,7 +361,7 @@ class Worker(object):
|
|
|
|
signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
|
|
|
signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
|
|
|
|
|
|
|
|
|
|
|
self._is_horse = True
|
|
|
|
self._is_horse = True
|
|
|
|
self.log = Logger('horse')
|
|
|
|
self.log = logger
|
|
|
|
|
|
|
|
|
|
|
|
success = self.perform_job(job)
|
|
|
|
success = self.perform_job(job)
|
|
|
|
|
|
|
|
|
|
|
|