fohrloop/dash-uploader

dash-uploader background callbacks

krafftta opened this issue · 1 comments

Hi,

I'm implementing a multi-page dash app and I thought it would be nice if the user could change between pages while waiting for the upload to finish.
Dash introduced Background Callbacks (https://dash.plotly.com/background-callbacks) where (after some extra work on setting up Celery and Redis) callbacks with the 'background' parameter set to True execute their task in the background when triggered.

I was wondering if there's a way to make use of this Dash Feature with dash-uploader. The du.callback does currently not take a background argument either.
It would be really cool if the user could chose a file and the file upload would be moved to a background task.

I don't know how easily this is realizable. If anyone knows a workaround that would be highly appreciated as well :)

Best,
Tamara

@krafftta
You can explicitly use Celery for asynchronous processing in the callback after dcc.Uploader has completed the upload, or, if you want to simplify, you can use something like dcc.Store to re-emit the successful upload event as a new event, and then use background tasks in the new callback. Whether dcc.Uploader is suitable for directly supporting background tasks is not easy for me to judge at the moment.