开发者

testing django-tasks

I am trying to write a test that involves running a django-tasks task. The problem is I can't seem to get the tasks to go beyond the "scheduled" status.

开发者_开发知识库

I have set

DJANGOTASK_DEMON_THREAD = True

in my settings, for simplicity.

ptask = djangotasks.task_for_function(f)
djangotasks.run_task(ptask)

while ptask.status!='successful':
    ptask = djangotasks.task_for_function(f)
    print ptask.status
    time.sleep(5)

This is what I'm attempting, which works well outside of tests.

edit: fixed typo


I think you didn't assign a task worker. In your django directory :

> python manage.py taskd run

your scheduled tasks would be executed by this "taskd".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜