From 5971df7bc98a696df2b710e784e0ed32bd1eaf59 Mon Sep 17 00:00:00 2001 From: Lucas Kanashiro Date: Tue, 4 Aug 2015 15:48:00 -0300 Subject: [PATCH] Add comment to reducer function on colab.signals --- colab/signals/signals.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/colab/signals/signals.py b/colab/signals/signals.py index ff4082d..34ba295 100644 --- a/colab/signals/signals.py +++ b/colab/signals/signals.py @@ -7,8 +7,15 @@ registered_signals = {} signal_instances = {} -# Fix celery serialization for signal def reducer(self): + ''' + In order to send a signal to a celery task, it is necessary to pickle + the objects that will be used as parameters. However, + django.dispatch.Signal has an instance of threading.Lock, which is an + object that cannot be pickled. Therefore, this function changes the + pickle behaviour of Signal, making that only the providind_args of + Signal to be pickled. + ''' return (Signal, (self.providing_args,)) Signal.__reduce__ = reducer -- libgit2 0.21.2