Fix PEP8 complaints

main
Vincent Driessen 8 years ago
parent a689cdb3ec
commit af6ce54ea4

@ -153,8 +153,8 @@ def info(url, config, path, interval, raw, only_queues, only_workers, by_queue,
@click.option('--exception-handler', help='Exception handler(s) to use', multiple=True) @click.option('--exception-handler', help='Exception handler(s) to use', multiple=True)
@click.option('--pid', help='Write the process ID number to a file at the specified path') @click.option('--pid', help='Write the process ID number to a file at the specified path')
@click.argument('queues', nargs=-1) @click.argument('queues', nargs=-1)
def worker(url, config, burst, name, worker_class, job_class, queue_class, connection_class, path, results_ttl, worker_ttl, def worker(url, config, burst, name, worker_class, job_class, queue_class, connection_class, path, results_ttl,
verbose, quiet, sentry_dsn, exception_handler, pid, queues): worker_ttl, verbose, quiet, sentry_dsn, exception_handler, pid, queues):
"""Starts an RQ worker.""" """Starts an RQ worker."""
if path: if path:

@ -579,4 +579,5 @@ class Job(object):
def __hash__(self): def __hash__(self):
return hash(self.id) return hash(self.id)
_job_stack = LocalStack() _job_stack = LocalStack()

@ -55,6 +55,7 @@ def iterable(x):
def compact(l): def compact(l):
return [x for x in l if x is not None] return [x for x in l if x is not None]
_signames = dict((getattr(signal, signame), signame) _signames = dict((getattr(signal, signame), signame)
for signame in dir(signal) for signame in dir(signal)
if signame.startswith('SIG') and '_' not in signame) if signame.startswith('SIG') and '_' not in signame)
@ -544,7 +545,7 @@ class Worker(object):
except Exception: except Exception:
pass pass
#Unhandled failure: move the job to the failed queue # Unhandled failure: move the job to the failed queue
self.log.warning( self.log.warning(
'Moving job to {0!r} queue'.format( 'Moving job to {0!r} queue'.format(
self.failed_queue.name self.failed_queue.name
@ -826,7 +827,7 @@ class HerokuWorker(Worker):
self.request_force_stop_sigrtmin(signum, frame) self.request_force_stop_sigrtmin(signum, frame)
else: else:
self.log.warning('Imminent shutdown, raising ShutDownImminentException in %d seconds', self.log.warning('Imminent shutdown, raising ShutDownImminentException in %d seconds',
self.imminent_shutdown_delay) self.imminent_shutdown_delay)
signal.signal(signal.SIGRTMIN, self.request_force_stop_sigrtmin) signal.signal(signal.SIGRTMIN, self.request_force_stop_sigrtmin)
signal.signal(signal.SIGALRM, self.request_force_stop_sigrtmin) signal.signal(signal.SIGALRM, self.request_force_stop_sigrtmin)
signal.alarm(self.imminent_shutdown_delay) signal.alarm(self.imminent_shutdown_delay)

@ -577,6 +577,7 @@ def kill_worker(pid, double_kill):
time.sleep(0.5) time.sleep(0.5)
os.kill(pid, signal.SIGTERM) os.kill(pid, signal.SIGTERM)
def wait_and_kill_work_horse(pid, time_to_wait=0.0): def wait_and_kill_work_horse(pid, time_to_wait=0.0):
time.sleep(time_to_wait) time.sleep(time_to_wait)
os.kill(pid, signal.SIGKILL) os.kill(pid, signal.SIGKILL)
@ -678,6 +679,7 @@ class WorkerShutdownTestCase(TimeoutTestCase, RQTestCase):
self.assertEqual(failed_q.count, 1) self.assertEqual(failed_q.count, 1)
self.assertEqual(fooq.count, 0) self.assertEqual(fooq.count, 0)
def schedule_access_self(): def schedule_access_self():
q = Queue('default', connection=get_current_connection()) q = Queue('default', connection=get_current_connection())
q.enqueue(access_self) q.enqueue(access_self)

Loading…
Cancel
Save