mirror of https://github.com/rq/rq.git
Better logging output.
This commit is contained in:
parent
1dd73cb28d
commit
1358246238
|
@ -57,11 +57,11 @@ class Job(object):
|
||||||
return self.func(*self.args, **self.kwargs)
|
return self.func(*self.args, **self.kwargs)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '<Job %s(%s, %s)>' % (
|
arg_list = map(repr, self.args)
|
||||||
|
arg_list += map(lambda key, val: '%s=%r' % (key, val), self.kwargs.items())
|
||||||
|
return '<Job %s(%s)>' % (
|
||||||
self.func.__name__,
|
self.func.__name__,
|
||||||
', '.join(
|
', '.join(arg_list))
|
||||||
map(repr, self.args) +
|
|
||||||
map(lambda key, val: '%s=%r' % (key, val), self.kwargs.items())))
|
|
||||||
|
|
||||||
|
|
||||||
@total_ordering
|
@total_ordering
|
||||||
|
|
|
@ -117,7 +117,6 @@ class Worker(object):
|
||||||
|
|
||||||
This can be used to make `ps -ef` output more readable.
|
This can be used to make `ps -ef` output more readable.
|
||||||
"""
|
"""
|
||||||
self.log.debug(message)
|
|
||||||
procname.setprocname('rq: %s' % (message,))
|
procname.setprocname('rq: %s' % (message,))
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,7 +163,9 @@ class Worker(object):
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
self.state = 'idle'
|
self.state = 'idle'
|
||||||
self.procline('Waiting on %s' % (', '.join(self.queue_names()),))
|
qnames = ', '.join(self.queue_names())
|
||||||
|
self.procline('Waiting on %s' % (qnames,))
|
||||||
|
self.log.info('Watching queues: %s' % (qnames,))
|
||||||
wait_for_job = not quit_when_done
|
wait_for_job = not quit_when_done
|
||||||
job = Queue.dequeue_any(self.queues, wait_for_job)
|
job = Queue.dequeue_any(self.queues, wait_for_job)
|
||||||
if job is None:
|
if job is None:
|
||||||
|
@ -199,7 +200,6 @@ class Worker(object):
|
||||||
random.seed()
|
random.seed()
|
||||||
self.log = Logger('horse')
|
self.log = Logger('horse')
|
||||||
try:
|
try:
|
||||||
self.procline('Processing work since %d' % (time.time(),))
|
|
||||||
self.perform_job(job)
|
self.perform_job(job)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.log.exception(e)
|
self.log.exception(e)
|
||||||
|
@ -211,6 +211,8 @@ class Worker(object):
|
||||||
|
|
||||||
def perform_job(self, job):
|
def perform_job(self, job):
|
||||||
self.procline('Processing %s from %s since %s' % (job.func.__name__, job.origin.name, time.time()))
|
self.procline('Processing %s from %s since %s' % (job.func.__name__, job.origin.name, time.time()))
|
||||||
|
msg = 'Processing job %s from queue %s' % (job, job.origin.name)
|
||||||
|
self.log.debug(msg)
|
||||||
try:
|
try:
|
||||||
rv = job.perform()
|
rv = job.perform()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|
Loading…
Reference in New Issue