通过pdb调试djcelery的celeryd

发布于 2024-10-09 06:14:32 字数 1060 浏览 2 评论 0原文

有人尝试过使用 pdb 调试 celeryd 工作程序吗?每当遇到断点(通过 pdb 运行 celeryd 或通过 pdb.set_trace() )时,我都会遇到以下错误:

Error while handling action event.
Traceback (most recent call last):
  File "/home/jeeyo/workspace3/uwcr/subscriptions/tasks.py", line 79, in process_action_event
    func(action_event)
  File "/home/jeeyo/workspace3/uwcr/subscriptions/tasks.py", line 36, in new_user_email
    send_registration_email(username, new_user.get_profile().plaintext_password)
  File "/home/jeeyo/workspace3/uwcr/looers/email.py", line 18, in send_registration_email
    'Your password from UWCoopRankings', user
  File "/home/jeeyo/workspace3/uwcr/looers/email.py", line 61, in send_email
    if isinstance(to, basestring):
  File "/home/jeeyo/workspace3/uwcr/looers/email.py", line 61, in send_email
    if isinstance(to, basestring):
  File "/usr/lib/python2.6/bdb.py", line 46, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python2.6/bdb.py", line 65, in dispatch_line
    if self.quitting: raise BdbQuit
BdbQuit

对此有解决方案吗?

Have anybody tried debugging celeryd worker using pdb? Whenever a breakpoint is encountered (either by running celeryd via pdb, or by pdb.set_trace()), I hit the following error:

Error while handling action event.
Traceback (most recent call last):
  File "/home/jeeyo/workspace3/uwcr/subscriptions/tasks.py", line 79, in process_action_event
    func(action_event)
  File "/home/jeeyo/workspace3/uwcr/subscriptions/tasks.py", line 36, in new_user_email
    send_registration_email(username, new_user.get_profile().plaintext_password)
  File "/home/jeeyo/workspace3/uwcr/looers/email.py", line 18, in send_registration_email
    'Your password from UWCoopRankings', user
  File "/home/jeeyo/workspace3/uwcr/looers/email.py", line 61, in send_email
    if isinstance(to, basestring):
  File "/home/jeeyo/workspace3/uwcr/looers/email.py", line 61, in send_email
    if isinstance(to, basestring):
  File "/usr/lib/python2.6/bdb.py", line 46, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python2.6/bdb.py", line 65, in dispatch_line
    if self.quitting: raise BdbQuit
BdbQuit

Any solution to this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不疑不惑不回忆 2024-10-16 06:14:32

我也有同样的问题。尝试使用 Celery 的远程调试器 rdb

from celery import task
from celery.contrib import rdb

@task()
def add(x, y):
    result = x + y
    rdb.set_trace()  # <- set break-point
    return result

请参阅用户指南(链接更新2017/5)。

I had the same problem. Try using Celery's remote debugger rdb instead:

from celery import task
from celery.contrib import rdb

@task()
def add(x, y):
    result = x + y
    rdb.set_trace()  # <- set break-point
    return result

See the user guide (link update 2017/5).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文