gpt4 book ai didi

python - 通过 pdb 调试 djcelery 的 celeryd

转载 作者:IT老高 更新时间:2023-10-28 20:48:12 24 4
gpt4 key购买 nike

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

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

有什么解决办法吗?

最佳答案

我遇到了同样的问题。尝试使用 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

user guide (链接更新 2017/5)。

关于python - 通过 pdb 调试 djcelery 的 celeryd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4543967/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com