Esempio n. 1
0
def _rcb(obj):
    if obj is None:
        return '<missing>'
    if isinstance(obj, string_t):
        return obj
    if isinstance(obj, tuple):
        cb, args = obj
        return reprcall(cb.__name__, args=args)
    return obj.__name__
Esempio n. 2
0
def _rcb(obj):
    if obj is None:
        return '<missing>'
    if isinstance(obj, string_t):
        return obj
    if isinstance(obj, tuple):
        cb, args = obj
        return reprcall(cb.__name__, args=args)
    return obj.__name__
Esempio n. 3
0
 def process_task(self, body, message):
     fun = body['fun']
     args = body['args']
     kwargs = body['kwargs']
     logger.info('Got task: %s', reprcall(fun.__name__, args, kwargs))
     try:
         fun(*args, **kwargs)
     except Exception as exc:
         logger.error('task raised exception: %r', exc)
     message.ack()
Esempio n. 4
0
 def process_task(self, body, message):
     fun = body['fun']
     args = body['args']
     kwargs = body['kwargs']
     logger.info('Got task: %s', reprcall(fun.__name__, args, kwargs))
     try:
         fun(*args, **kwargs)
     except Exception as exc:
         logger.error('task raised exception: %r', exc)
     message.ack()
Esempio n. 5
0
 def process_task(self, body, message):
     fun = body['fun']
     args = body['args']
     kwargs = body['kwargs']
     logger.info('Got task: %s', reprcall(fun.__name__, args, kwargs))
     try:
         # 注意这个fun并未import,是直接从body中序列化出来,因为本地未import hello_task
         fun(*args, **kwargs)
     except Exception as exc:
         logger.error('task raised exception: %r', exc)
     message.ack()
Esempio n. 6
0
 def reprcall(self, *args, **kwargs):
     args, kwargs, _ = self._merge(args, kwargs, {}, force=True)
     return reprcall(self['task'], args, kwargs)
Esempio n. 7
0
 def __repr__(self):
     return '<{name}: {0.name} {call} {0.schedule}'.format(
         self,
         call=reprcall(self.task, self.args or (), self.kwargs or {}),
         name=type(self).__name__,
     )
Esempio n. 8
0
 def __repr__(self):
     return reprcall('ffwd', (),
                     self._fields(weeks=self.weeks, weekday=self.weekday))
Esempio n. 9
0
def test_reprcall():
    assert reprcall('add', (2, 2), {'copy': True})
Esempio n. 10
0
 def reprcall(self, *args, **kwargs):
     args, kwargs, _ = self._merge(args, kwargs, {}, force=True)
     return reprcall(self['task'], args, kwargs)
Esempio n. 11
0
 def __repr__(self):
     return reprcall('ffwd', (), self._fields(weeks=self.weeks,
                                              weekday=self.weekday))
Esempio n. 12
0
def test_reprcall():
    assert reprcall('add', (2, 2), {'copy': True})
Esempio n. 13
0
 def test_reprcall(self):
     self.assertTrue(
         reprcall('add', (2, 2), {'copy': True}),
     )