示例#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__
示例#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__
示例#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()
示例#4
0
文件: worker.py 项目: Erve1879/kombu
 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()
示例#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()
示例#6
0
 def reprcall(self, *args, **kwargs):
     args, kwargs, _ = self._merge(args, kwargs, {}, force=True)
     return reprcall(self['task'], args, kwargs)
示例#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__,
     )
示例#8
0
 def __repr__(self):
     return reprcall('ffwd', (),
                     self._fields(weeks=self.weeks, weekday=self.weekday))
示例#9
0
def test_reprcall():
    assert reprcall('add', (2, 2), {'copy': True})
示例#10
0
文件: canvas.py 项目: xpxu/celery
 def reprcall(self, *args, **kwargs):
     args, kwargs, _ = self._merge(args, kwargs, {}, force=True)
     return reprcall(self['task'], args, kwargs)
示例#11
0
 def __repr__(self):
     return reprcall('ffwd', (), self._fields(weeks=self.weeks,
                                              weekday=self.weekday))
示例#12
0
def test_reprcall():
    assert reprcall('add', (2, 2), {'copy': True})
示例#13
0
 def test_reprcall(self):
     self.assertTrue(
         reprcall('add', (2, 2), {'copy': True}),
     )