获得“意外提升:BdbQuit()”

时间:2014-09-16 18:24:21

标签: python celery

回溯:

[2014-09-16 17:27:04,912: ERROR/MainProcess] Task my_project.tasks.get_items[8481cd42-ec19-441f-b32d-03280570053c] raised unexpected: BdbQuit()
Traceback (most recent call last):
  File "/vagrant/venv/local/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/vagrant/venv/local/lib/python2.7/site-packages/celery/app/trace.py", line 437, in __protected_call__
    return self.run(*args, **kwargs)
  File "/vagrant/my_project/my_app/tasks.py", line 21, in get_items
    logging.debug('{} {}'.format(settings.API_KEY, settings.API_SECRET))
  File "/vagrant/my_project/my_app/tasks.py", line 21, in get_items
    logging.debug('{} {}'.format(settings.API_KEY, settings.API_SECRET))
  File "/usr/lib/python2.7/bdb.py", line 49, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python2.7/bdb.py", line 68, in dispatch_line
    if self.quitting: raise BdbQuit
BdbQuit

我检查了这个question并尝试使用 celery.contrib.rdb ,但在做完telnet后我被发送到:

vagrant@vagrant-ubuntu-trusty-64:~$ telnet localhost 6900
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
--Call--
> /usr/lib/python2.7/contextlib.py(21)__exit__()
-> def __exit__(self, type, value, traceback):
(Pdb) l
 16             try:
 17                 return self.gen.next()
 18             except StopIteration:
 19                 raise RuntimeError("generator didn't yield")
 20     
 21  ->     def __exit__(self, type, value, traceback):
 22             if type is None:
 23                 try:
 24                     self.gen.next()
 25                 except StopIteration:
 26                     return
(Pdb)

代码是:

from __future__ import absolute_import
from celery import shared_task
from . import utils
from . import status
import redis
import pickle
import logging
from django.conf import settings
import tweepy
from celery.contrib import rdb

logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s -%(filename)s:%(lineno)d - %(message)s')

MAX_TWEETS_PER_PAGE = 200

r = redis.StrictRedis(host='localhost', port=6379, db=0)

@shared_task
def get_items(user_id, external_page):
    rdb.set_trace()
    logging.debug('{} {}'.format(settings.API_KEY, settings.API_SECRET))
    logging.debug('{} {}'.format(settings.ACCESS_TOKEN, settings.ACCESS_TOKEN_SECRET))

如果我删除set_trace调用,任务到目前为止成功结束,但我需要能够调试它,因为我要添加更多东西。任何帮助将不胜感激。

0 个答案:

没有答案