How to keep a request context in a celery task, in Python Flask? -
is there way copy request celery task in flask in such manner task executes inside request context initiated task?
need access flask security current user in celery task, since task outside request context, can not that. need additional information request, forwarding current user task not trick.
my task inserts on database. needs current user save id of user creates row. passing user object task solve problem. however, application logic such every insert/delete/update logged via before flush event, logs user did modification, ip, original url, data inserts...)
log event done said before flush, , works in 99% scenarios. when have 1 lengthy task want celery task, request data not available, nor current user (since outside original request context)
Comments
Post a Comment