I wrote a task in my app.
@frappe.async.handler
def atask():
with open('/tmp/aaaaa', 'w') as f:
f.write('aaaaaa')
And in bench --site test-proj console
from myapp.tasks import atask
atask()
returned {u'status': u'queued', u'task_id': '43cf8d24-37b3-411a-99ba-34adfebbe915'}
and
In [4]: frappe.async.get_task_status(frappe.local.response['task_id'])
Out[4]: {u'progress': 0, u'state': u'SUCCESS'}
But /tmp/aaaaaa did not exist.
And both frappe-bench/log/worker.log && frappe-bench/log/worker.error.log did not log that.
UPDATED:
and I tried
@frappe.celery_app.celery_task()
def atask():
with open('/tmp/aaaaa', 'w') as f:
f.write('aaaaaa')
running
atask.delay()
on console
In [23]: frappe.async.get_task_status('fafa98d1-7c1e-47c7-8763-0426324cba41')
Out[23]: {u'progress': 0, u'state': 'PENDING'}
the status always is PENDING.