fohrloop / dash-uploader

The alternative upload component for python Dash applications.
MIT License
144 stars 30 forks source link

The uploader is not resumable. #40

Open cainmagi opened 3 years ago

cainmagi commented 3 years ago

Although dash-uploader is based on resumablejs, it seems that the uploader could not resume from the interrupted uploading file (even we set the same upload_id). To reproduce the experiment, we could:

  1. Launch a dashboard with an uploader, and the upload_id set to a specific value (or not used).
  2. Upload a large file.
  3. When the file is uploaded for half. Use Ctrl + C to interrupt the server.
  4. Launch the same dashboard again.
  5. Upload the same large file. We could find that the progress starts from 0, not half.

I wonder whether the author is interested in implementing the resumable feature in the future. In my understanding, this implementation may be tricky, but I do not need this feature urgently.

fohrloop commented 3 years ago

Thanks for posting the issue. If I understand correctly the documentation of resumable.js, the testChunks must be set on, and there should be handling of these test chunks implemented in the server side.

From src/lib/components/Upload_ReactComponent.react.js you can see that the testChunks are hard-coded to be disabled. Perhaps this has been an speed optimization thing for the original author, or the server side implementation just was not finished.

I guess I would not be implementing this in the near future as I have other projects that have higher priority, and right now I do not have need for the resumability. That being said, I can accept a PR fixing this and offer some help.

How would one fix this?

So, what would need to be done is to add some new parameter to du.Upload, like resumable=True, which would be then propagated to the underlying React component as testChunks=True (to this line of Upload_ReactComponent.react.js). I would also change the testMethod to 'GET' as this is the default.

Then, probably the server side checking the test chunks might need some corrections. They are in the _get() method of the HttpRequestHandler.

sorenwacker commented 3 years ago

Is this related to these messages when uploading multile files?

INFO:werkzeug:127.0.0.1 - - [15/Sep/2021 10:38:33] "POST /API/resumable?resumableChunkNumber=1&resumableChunkSize=1048576&resumableCurrentChunkSize=1048576&resumableTotalSize=14043146&resumableType=&resumableIdentifier=14043146-EC_B1mzXML&resumableFilename=EC_B1.mzXML&resumableRelativePath=EC_B1.mzXML&resumableTotalChunks=13&upload_id=4e49f94a-1643-11ec-923b-107b44934408 HTTP/1.1" 405 -

fohrloop commented 3 years ago

Hi @sorenwacker, I am not entirely sure what you are asking. Could you clarify your question?

sorenwacker commented 3 years ago

I am getting this messages when uploading multiple files. I wonder if this is the same issue or something new.

sorenwacker commented 3 years ago

not important.