Ask Solem 8 vuotta sitten
vanhempi
commit
0a7b3ba03d

+ 2 - 0
.landscape.yml

@@ -49,5 +49,7 @@ pylint:
         - attribute-defined-outside-init
         - too-many-ancestors
         - too-many-return-statements
+        - bad-mcs-classmethod-argument
+        - bad-mcs-method-argument
     options:
         exclude-protected: _reader, _writer, _popen, _sentinel_poll, _job, _is_alive, _write_to, _scheduled_for, _terminated, _accepted, _set_terminated, _payload, _cancel

+ 1 - 1
celery/apps/worker.py

@@ -222,7 +222,7 @@ class Worker(WorkController):
 
         # integrate the ASCII art.
         if artlines:
-            for i, x in enumerate(banner):
+            for i, _ in enumerate(banner):
                 try:
                     banner[i] = ' '.join([ARTLINES[i], banner[i]])
                 except IndexError:

+ 1 - 1
celery/backends/async.py

@@ -218,7 +218,7 @@ class BaseResultConsumer(object):
         self.buckets = WeakKeyDictionary()
         self.drainer = drainers[detect_environment()](self)
 
-    def start(self, initial_task_id):
+    def start(self, initial_task_id, **kwargs):
         raise NotImplementedError()
 
     def stop(self):

+ 6 - 2
celery/backends/redis.py

@@ -50,7 +50,7 @@ class ResultConsumer(async.BaseResultConsumer):
         self._decode_result = self.backend.decode_result
         self.subscribed_to = set()
 
-    def start(self, initial_task_id):
+    def start(self, initial_task_id, **kwargs):
         self._pubsub = self.backend.client.pubsub(
             ignore_subscribe_messages=True,
         )
@@ -230,7 +230,11 @@ class RedisBackend(base.BaseKeyValueStoreBackend, async.AsyncBackendMixin):
 
     def apply_chord(self, header, partial_args, group_id, body,
                     result=None, options={}, **kwargs):
-        # avoids saving the group in the redis db.
+        # Overrides this to avoid calling GroupResult.save
+        # pylint: disable=method-hidden
+        # Note that KeyValueStoreBackend.__init__ sets self.apply_chord
+        # if the implements_incr attr is set.  Redis backend doesn't set
+        # this flag.
         options['task_id'] = group_id
         return header(*partial_args, **options or {})
 

+ 1 - 1
celery/backends/rpc.py

@@ -47,7 +47,7 @@ class ResultConsumer(BaseResultConsumer):
         super(ResultConsumer, self).__init__(*args, **kwargs)
         self._create_binding = self.backend._create_binding
 
-    def start(self, initial_task_id, no_ack=True):
+    def start(self, initial_task_id, no_ack=True, **kwargs):
         self._connection = self.app.connection()
         initial_queue = self._create_binding(initial_task_id)
         self._consumer = self.Consumer(

+ 4 - 2
celery/result.py

@@ -696,7 +696,7 @@ class ResultSet(ResultBase):
                 results.append(value)
         return results
 
-    def then(self, callback, on_error=None):
+    def then(self, callback, on_error=None, weak=False):
         return self.on_ready.then(callback, on_error)
 
     def iter_native(self, timeout=None, interval=0.5, no_ack=True,
@@ -878,6 +878,8 @@ class EagerResult(AsyncResult):
     """Result that we know has already been executed."""
 
     def __init__(self, id, ret_value, state, traceback=None):
+        # pylint: disable=super-init-not-called
+        # XXX should really not be inheriting from AsyncResult
         self.id = id
         self._result = ret_value
         self._state = state
@@ -885,7 +887,7 @@ class EagerResult(AsyncResult):
         self.on_ready = promise(args=(self,))
         self.on_ready()
 
-    def then(self, callback, on_error=None):
+    def then(self, callback, on_error=None, weak=False):
         return self.on_ready.then(callback, on_error)
 
     def _get_task_meta(self):

+ 1 - 0
celery/utils/threads.py

@@ -313,6 +313,7 @@ class _FastLocalStack(threading.local):
         self.stack = []
         self.push = self.stack.append
         self.pop = self.stack.pop
+        super(_FastLocalStack, self).__init__()
 
     @property
     def top(self):

+ 2 - 1
celery/utils/time.py

@@ -334,10 +334,11 @@ class ffwd(object):
     def __init__(self, year=None, month=None, weeks=0, weekday=None, day=None,
                  hour=None, minute=None, second=None, microsecond=None,
                  **kwargs):
+        # pylint: disable=redefined-outer-name
+        # weekday is also a function in outer scope.
         self.year = year
         self.month = month
         self.weeks = weeks
-        # pylint: disable=redefined-outer-name
         self.weekday = weekday
         self.day = day
         self.hour = hour

+ 1 - 1
celery/worker/control.py

@@ -340,7 +340,7 @@ def scheduled(state, **kwargs):
     return list(_iter_schedule_requests(state.consumer.timer))
 
 
-def _iter_schedule_requests(timer, Request=Request):
+def _iter_schedule_requests(timer):
     for waiting in timer.schedule.queue:
         try:
             arg0 = waiting.entry.args[0]