通过pdb调试djcelery的celeryd [英] Debugging djcelery's celeryd via pdb

查看:236
本文介绍了通过pdb调试djcelery的celeryd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人尝试使用pdb调试celeryd worker?每当遇到断点时(通过pdb运行celeryd,或者通过 pdb.set_trace()),我会遇到以下错误:

 处理动作事件时出错。 
追溯(最近的最后一次呼叫):
文件/home/jeeyo/workspace3/uwcr/subscriptions/tasks.py,第79行,process_action_event
func(action_event)
文件/home/jeeyo/workspace3/uwcr/subscriptions/tasks.py,第36行,new_user_email
send_registration_email(username,new_user.get_profile()。plaintext_password)
文件/ home / jeeyo /workspace3/uwcr/looers/email.py,第18行,在send_registration_email
'您的密码从UWCoopRankings',用户
文件/home/jeeyo/workspace3/uwcr/looers/email.py ,line 61,在send_email
if isinstance(to,basestring):
文件/home/jeeyo/workspace3/uwcr/looers/email.py,第61行,send_email
if isinstance(to,basestring):
文件/usr/lib/python2.6/bdb.py,第46行,trace_dispatch
return self.dispatch_line(frame)
文件/ usr / lib / python2.6 / bdb.py,第65行,dispatch_line
如果self.quitting:raise BdbQuit
BdbQuit

任何解决方案?

解决方案

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

 从芹菜导入任务
from celery.contrib import rdb

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

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


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?

解决方案

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).

这篇关于通过pdb调试djcelery的celeryd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆