diff --git a/rq/worker.py b/rq/worker.py index 553b457..8678ad3 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -15,15 +15,20 @@ import warnings from datetime import timedelta from uuid import uuid4 +try: + from signal import SIGKILL +except ImportError: + from signal import SIGTERM as SIGKILL + from redis import WatchError from . import worker_registration from .compat import PY2, as_text, string_types, text_type -from .connections import (get_current_connection, pop_connection, - push_connection) -from .defaults import (DEFAULT_JOB_MONITORING_INTERVAL, - DEFAULT_LOGGING_DATE_FORMAT, DEFAULT_LOGGING_FORMAT, - DEFAULT_RESULT_TTL, DEFAULT_WORKER_TTL) +from .connections import get_current_connection, push_connection, pop_connection + +from .defaults import (DEFAULT_RESULT_TTL, + DEFAULT_WORKER_TTL, DEFAULT_JOB_MONITORING_INTERVAL, + DEFAULT_LOGGING_FORMAT, DEFAULT_LOGGING_DATE_FORMAT) from .exceptions import DequeueTimeout, ShutDownImminentException from .job import Job, JobStatus from .logutils import setup_loghandlers @@ -31,22 +36,13 @@ from .queue import Queue from .registry import FailedJobRegistry, StartedJobRegistry, clean_registries from .scheduler import RQScheduler from .suspension import is_suspended -from .timeouts import (HorseMonitorTimeoutException, JobTimeoutException, - UnixSignalDeathPenalty) -from .utils import (backend_class, ensure_list, enum, make_colorizer, - utcformat, utcnow, utcparse) +from .timeouts import JobTimeoutException, HorseMonitorTimeoutException, UnixSignalDeathPenalty +from .utils import (backend_class, ensure_list, enum, + make_colorizer, utcformat, utcnow, utcparse) from .version import VERSION from .worker_registration import clean_worker_registry, get_keys from .serializers import resolve_serializer -try: - from signal import SIGKILL -except ImportError: - from signal import SIGTERM as SIGKILL - - - - try: from setproctitle import setproctitle as setprocname except ImportError: