开发者

testing django-tasks

开发者 https://www.devze.com 2023-03-11 00:54 出处:网络
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 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

精彩评论

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