Skip to content

Commit

Permalink
Improved task retry logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Schweigi committed Jul 11, 2016
1 parent 0fe6d03 commit eae13c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions eb_sqs/worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,19 @@ def execute(self, msg):
if settings.DEAD_LETTER_MODE:
# If in dead letter mode only try to run callback. Do not execute task.
logger.debug(
'Task %s (%s) not executed (dead letter queue)',
'Task %s (%s, retry-id: %s) not executed (dead letter queue)',
worker_task.abs_func_name,
worker_task.id,
worker_task.retry_id,
)

self._remove_from_group(worker_task)
else:
logger.debug(
'Execute task %s (%s) with args: %s and kwargs: %s',
'Execute task %s (%s, retry-id: %s) with args: %s and kwargs: %s',
worker_task.abs_func_name,
worker_task.id,
worker_task.retry_id,
worker_task.args,
worker_task.kwargs
)
Expand All @@ -60,9 +62,10 @@ def execute(self, msg):
raise
except Exception as ex:
logger.exception(
'Task %s (%s) failed to execute with args: %s and kwargs: %s: %s',
'Task %s (%s, retry-id: %s) failed to execute with args: %s and kwargs: %s: %s',
worker_task.abs_func_name,
worker_task.id,
worker_task.retry_id,
worker_task.args,
worker_task.kwargs,
ex
Expand Down Expand Up @@ -93,10 +96,11 @@ def _enqueue_task(self, worker_task, delay, execute_inline, is_retry, count_retr

self._add_to_group(worker_task)

logger.debug('%s task %s (%s): %s, %s (%s%s)',
logger.debug('%s task %s (%s, retry-id: %s): %s, %s (%s%s)',
'Retrying' if is_retry else 'Delaying',
worker_task.abs_func_name,
worker_task.id,
worker_task.retry_id,
worker_task.args,
worker_task.kwargs,
worker_task.queue,
Expand All @@ -119,9 +123,10 @@ def _enqueue_task(self, worker_task, delay, execute_inline, is_retry, count_retr
except QueueClientException as ex:
self._remove_from_group(worker_task)

logger.exception('Task %s (%s) failed to enqueue to %s: %s',
logger.exception('Task %s (%s, retry-id: %s) failed to enqueue to %s: %s',
worker_task.abs_func_name,
worker_task.id,
worker_task.retry_id,
worker_task.queue,
ex)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='django-eb-sqs',
version='0.94',
version='0.95',
package_dir={'eb_sqs': 'eb_sqs'},
include_package_data=True,
packages=find_packages(),
Expand Down

0 comments on commit eae13c2

Please sign in to comment.