From 47f5200792479ff913194e58946eff4a9306b4ab Mon Sep 17 00:00:00 2001 From: Itay Bleier Date: Wed, 30 Aug 2017 16:35:31 -0700 Subject: [PATCH 1/2] Removed unicode code references and bumped up version --- eb_sqs/worker/worker.py | 5 ++--- eb_sqs/worker/worker_task.py | 2 +- setup.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/eb_sqs/worker/worker.py b/eb_sqs/worker/worker.py index cccfc5a..72ea268 100644 --- a/eb_sqs/worker/worker.py +++ b/eb_sqs/worker/worker.py @@ -75,14 +75,13 @@ def execute(self, msg): def delay(self, group_id, queue_name, func, args, kwargs, max_retries, use_pickle, delay, execute_inline): # type: (unicode, unicode, Any, tuple, dict, int, bool, int, bool) -> Any - id = unicode(uuid.uuid4()) - worker_task = WorkerTask(id, group_id, queue_name, func, args, kwargs, max_retries, 0, None, use_pickle) + worker_task = WorkerTask(str(uuid.uuid4()), group_id, queue_name, func, args, kwargs, max_retries, 0, None, use_pickle) return self._enqueue_task(worker_task, delay, execute_inline, False, True) def retry(self, worker_task, delay, execute_inline, count_retries): # type: (WorkerTask, int, bool, bool) -> Any worker_task = worker_task.copy(settings.FORCE_SERIALIZATION) - worker_task.retry_id = unicode(uuid.uuid4()) + worker_task.retry_id = str(uuid.uuid4()) return self._enqueue_task(worker_task, delay, execute_inline, True, count_retries) def _enqueue_task(self, worker_task, delay, execute_inline, is_retry, count_retries): diff --git a/eb_sqs/worker/worker_task.py b/eb_sqs/worker/worker_task.py index 4a64499..10a064c 100644 --- a/eb_sqs/worker/worker_task.py +++ b/eb_sqs/worker/worker_task.py @@ -12,7 +12,7 @@ class WorkerTask(object): def __init__(self, id, group_id, queue, func, args, kwargs, max_retries, retry, retry_id, use_pickle): - # type: (unicode, unicode, unicode, Any, tuple, dict, int, int, unicode, bool) -> None + # type: (str, unicode, unicode, Any, tuple, dict, int, int, unicode, bool) -> None super(WorkerTask, self).__init__() self.id = id self.group_id = group_id diff --git a/setup.py b/setup.py index 2adede2..cf52f7c 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name='django-eb-sqs', - version='0.97', + version='0.98', package_dir={'eb_sqs': 'eb_sqs'}, include_package_data=True, packages=find_packages(), From 5b65513527c85c1f8049ce191670f117123743d4 Mon Sep 17 00:00:00 2001 From: Itay Bleier Date: Wed, 30 Aug 2017 17:01:38 -0700 Subject: [PATCH 2/2] Use __name__ to retrieve function's name --- eb_sqs/worker/worker_task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eb_sqs/worker/worker_task.py b/eb_sqs/worker/worker_task.py index 10a064c..b39ba18 100644 --- a/eb_sqs/worker/worker_task.py +++ b/eb_sqs/worker/worker_task.py @@ -25,7 +25,7 @@ def __init__(self, id, group_id, queue, func, args, kwargs, max_retries, retry, self.retry_id = retry_id self.use_pickle = use_pickle - self.abs_func_name = '{}.{}'.format(self.func.__module__, self.func.func_name) + self.abs_func_name = '{}.{}'.format(self.func.__module__, self.func.__name__) def execute(self): # type: () -> Any