Skip to content

Commit

Permalink
Merge pull request #25 from cuda-networks/fix_logging
Browse files Browse the repository at this point in the history
remove error logging, exception can be caught by caller
  • Loading branch information
alexeyts authored May 29, 2018
2 parents ff430e0 + 202d4bf commit 8bc21c6
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions eb_sqs/worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ 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, 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,
', inline' if execute_inline else '')
'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,
', inline' if execute_inline else '')

if execute_inline:
return self._execute_task(worker_task)
Expand All @@ -116,12 +116,12 @@ def _enqueue_task(self, worker_task, delay, execute_inline, is_retry, count_retr
raise InvalidQueueException(ex.queue_name)
except QueueClientException as ex:
self._remove_from_group(worker_task)
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)
logger.warning('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)

raise QueueException()

Expand Down Expand Up @@ -160,7 +160,8 @@ def _remove_from_group(self, worker_task):
if self.group_client.remove(worker_task):
self._execute_group_callback(worker_task)

def _execute_group_callback(self, worker_task):
@staticmethod
def _execute_group_callback(worker_task):
# type: (WorkerTask) -> None
if settings.GROUP_CALLBACK_TASK:
callback = settings.GROUP_CALLBACK_TASK
Expand Down

0 comments on commit 8bc21c6

Please sign in to comment.