Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django 使用update_状态时芹菜任务返回错误_Django_Celery_Djcelery - Fatal编程技术网

Django 使用update_状态时芹菜任务返回错误

Django 使用update_状态时芹菜任务返回错误,django,celery,djcelery,Django,Celery,Djcelery,我有一个芹菜任务,它在运行时会多次更新其状态: current_task.update_state(state='STARTED', meta={'doing': "some message"},) 此任务返回时: return row # row is a Django model instance 我得到的返回值: >> res = task_above.delay() >> res.result u'16' 只是作为字符串的对象id,而不是pickle对象本

我有一个芹菜任务,它在运行时会多次更新其状态:

current_task.update_state(state='STARTED', meta={'doing': "some message"},)
此任务返回时:

return row  # row is a Django model instance
我得到的返回值:

>> res = task_above.delay()
>> res.result
u'16'
只是作为字符串的对象id,而不是pickle对象本身

如果删除update_state语句,我将在任务的元(AsyncResult.result)中获得正确的pickled对象


我如何使用update_state并获得相同的返回值(pickle对象)?

考虑到pickle只支持python原语,我很惊讶您居然能得到一个pickle django模型实例。您是否绝对确定会将django模型实例作为pickle结果?也许它没有经过芹菜,也没有腌制

有关酸洗django模型实例的更多信息,请参见[ThisSoAnswer]