فهرست منبع

Use .freeze not ._freeze

Ask Solem 12 سال پیش
والد
کامیت
33a62b0f52

+ 3 - 3
celery/app/builtins.py

@@ -240,7 +240,7 @@ def add_chain_task(app):
                 # First task get partial args from chain.
                 task = maybe_subtask(steps.popleft())
                 task = task.clone() if i else task.clone(args)
-                res = task._freeze()
+                res = task.freeze()
                 i += 1
 
                 if isinstance(task, group):
@@ -249,7 +249,7 @@ def add_chain_task(app):
                         next_step = steps.popleft()
                         # for chords we freeze by pretending it's a normal
                         # task instead of a group.
-                        res = Signature._freeze(task)
+                        res = Signature.freeze(task)
                         task = chord(task, body=next_step, task_id=res.task_id)
                     except IndexError:
                         pass  # no callback, so keep as group
@@ -367,7 +367,7 @@ def add_chord_task(app):
                 body.options['group_id'] = group_id
             [body.link(s) for s in options.pop('link', [])]
             [body.link_error(s) for s in options.pop('link_error', [])]
-            body_result = body._freeze(task_id)
+            body_result = body.freeze(task_id)
             parent = super(Chord, self).apply_async((header, body, args),
                                                     kwargs, **options)
             body_result.parent = parent

+ 2 - 2
celery/canvas.py

@@ -65,7 +65,7 @@ class _getitem_property(object):
         self.path = path.split('.') if path else None
 
     def _path(self, obj):
-        return (reduce(lambda d, k: d[k], [obj] + self.path) if self.path
+        return (reduce(lambda d, k: d[k], obj, self.path) if self.path
                 else obj)
 
     def __get__(self, obj, type=None):
@@ -487,7 +487,7 @@ class chord(Signature):
         kwargs = dict(self.kwargs, body=body, **kwargs)
         if _chord.app.conf.CELERY_ALWAYS_EAGER:
             return self.apply((), kwargs)
-        res = body._freeze(task_id)
+        res = body.freeze(task_id)
         parent = _chord(**kwargs)
         res.parent = parent
         return res

+ 1 - 1
celery/tests/backends/test_base.py

@@ -296,7 +296,7 @@ class test_KeyValueStoreBackend(AppCase):
             task = Mock()
             task.request.group = 'grid'
             cb = task.request.chord = callback.s()
-            task.request.chord._freeze()
+            task.request.chord.freeze()
             callback.backend = b
             callback.backend.fail_from_current_stack = Mock()
             yield task, deps, cb

+ 1 - 1
celery/tests/case.py

@@ -599,7 +599,7 @@ def skip_if_jython(fun):
 
 
 def body_from_sig(app, sig, utc=True):
-    sig._freeze()
+    sig.freeze()
     callbacks = sig.options.pop('link', None)
     errbacks = sig.options.pop('link_error', None)
     countdown = sig.options.pop('countdown', None)

+ 1 - 1
celery/tests/tasks/test_canvas.py

@@ -135,7 +135,7 @@ class test_Signature(AppCase):
 
     def test_election(self):
         x = add.s(2, 2)
-        x._freeze('foo')
+        x.freeze('foo')
         prev, x.type.app.control = x.type.app.control, Mock()
         try:
             r = x.election()

+ 1 - 1
celery/tests/worker/test_request.py

@@ -333,7 +333,7 @@ class test_Request(AppCase):
 
     def test_execute_magic_kwargs(self):
         task = self.add.s(2, 2)
-        task._freeze()
+        task.freeze()
         req = self.get_request(task)
         self.add.accept_magic_kwargs = True
         try:

+ 1 - 1
celery/tests/worker/test_strategy.py

@@ -129,7 +129,7 @@ class test_default_strategy(AppCase):
 
     def test_when_revoked(self):
         task = self.add.s(2, 2)
-        task._freeze()
+        task.freeze()
         state.revoked.add(task.id)
         try:
             with self._context(task) as C: