我有一个带有 celery 组件的 wsgi 应用程序。基本上,当某些请求进来时,他们可以将相对耗时的任务交给 celery。我在自己设置的服务器上拥有该产品的工作版本,但我们的客户最近要求我将其部署到 Cloud Foundry。由于 Celery 不能作为 Cloud Foundry 上的服务提供,我们(我和客户的部署团队)决定部署该应用程序两次——一次作为 wsgi 应用程序,一次作为独立 celery 应用程序,共享一个 rabbitmq 服务。
应用程序之间的代码是相同的。wsgi 应用程序正确响应,返回预期的网页。vmc logs celeryapp
表明 celery 将启动并运行,但是当我向 wsgi 发送应该成为 celery 任务的请求时,它们一到达.delay()
语句就会消失。它们既不会出现在 celery 日志中,也不会显示为错误。
尝试调试:
- 我不能
celery.contrib.rdb
在 Cloud Foundry 中使用(为 pdb 提供 telnet 接口),因为每个应用程序都是沙盒和端口限制的。 - 我不知道如何找到这些应用程序应该共享的特定 rabbitmq 实例,所以我可以看到它传递了哪些消息。
更新:为了证实上述关于查找 rabbitmq 的说法,当我尝试访问应该共享 celery 任务的节点时,会发生以下情况:
root@cf:~# export RABBITMQ_NODENAME=eecef185-e1ae-4e08-91af-47f590304ecc
root@cf:~# export RABBITMQ_NODE_PORT=57390
root@cf:~# ~/cloudfoundry/.deployments/devbox/deploy/rabbitmq/sbin/rabbitmqctl list_queues
Listing queues ...
=ERROR REPORT==== 18-Jun-2012::11:31:35 ===
Error in process <0.36.0> on node 'rabbitmqctl17951@cf' with exit value: {badarg,[{erlang,list_to_existing_atom,["eecef185-e1ae-4e08-91af-47f590304ecc@localhost"]},{dist_util,recv_challenge,1},{dist_util,handshake_we_started,1}]}
Error: unable to connect to node 'eecef185-e1ae-4e08-91af-47f590304ecc@cf': nodedown
diagnostics:
- nodes and their ports on cf: [{'eecef185-e1ae-4e08-91af-47f590304ecc',57390},
{rabbitmqctl17951,36032}]
- current node: rabbitmqctl17951@cf
- current node home dir: /home/cf
- current node cookie hash: 1igde7WRgkhAea8fCwKncQ==
我该如何调试和/或为什么我的任务消失了?