fohrloop / dash-uploader

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

load multiple data issue #44

Closed RickyChenTaiwan closed 2 years ago

RickyChenTaiwan commented 3 years ago

Hi,

Thanks for you provide amazing functionality for us, It's cool! 👍
One question I want to query you: When I wanted to load multiple files(291files) in usage.py, I got 288 files actually. It seems some files missing, any comment?

Operation step:

  1. Clone this repository in fix-multiupload branch
  2. Running demo page => python usage.py
  3. open web and load 291 files
  4. I got 288 files actually.

Here is running code(usage.py) and result: image

image

Thanks and best regards,

Ricky H Chen

fohrloop commented 3 years ago

Hi! Thank you! As you might have noticed that branch is WIP, but is partly working. Did you check the file paths of the missing files? Is there something in common in them or are they just random files from the chosen location?

RickyChenTaiwan commented 3 years ago

Hi @np-8 ,

What is the mean of WIP actually?
Did you check the file paths of the missing files? => yes, I checked the file paths of the missing files. the first 3 files are missing.

I modified code in Upload_ReactComponent.react.js, I added "time sleep" in Upload_ReactComponent.react.js: image

after added "time sleep", the missing files didn't happen again. I think it's a network transmission problem, return "fileNames" need some time. Am I right? I am not sure actually. ><

Thanks and best regards,

Ricky H Chen

fohrloop commented 3 years ago

By WIP I meant "Work In Progress". Okay nice to hear that you found out what could be the reason for the behaviour: the implementation might need some additional checks for each file if they are uploaded or not, and then retry if needed. I'm actually considering to switch from resumable.js to some another (flow.js) JS package, as the resumable.js seems not to be maintained anymore.

RickyChenTaiwan commented 3 years ago

Got it,

I will keep noticing that, thank you very much XD

Best regards,

Ricky H Chen

sorenwacker commented 3 years ago

Do the files all have the same extension?

fohrloop commented 2 years ago

I'm working on this now and have a target for getting this fixed in the next 0.7.0 release. I guess this is related to the same issue I faced here. As the problem is related to timing, it has something to do with file access on server side, and would probably be fixed with simple retries when writing the files.

fohrloop commented 2 years ago

Hi! This should be fixed in the dev branch in 511557f587a02fbae6a0462e5074abd449c14bd0. I will still some sort of test for the multifile upload function before closing this. The changes are going to be included in the dash-uploader 0.7.0 update.

fohrloop commented 2 years ago

Please check out the pre-release (0.7.0a1), by installing it with

python -m pip install dash-uploader --pre

It should have this bug fixed. Note that the callbacks do have different syntax in >=0.7.0, so they should be defined as:

import dash_html_components as html
import dash_uploader as du

@du.callback(
    output=Output("callback-output", "children"),
    id="dash-uploader",
)
def callback_on_completion(status: du.UploadStatus):

    if status.n_uploaded == 0:
        return  # no files uploaded yet.

    print(status)

    out = []
    if status.uploaded_files is not None:
        return html.Ul([html.Li(str(x)) for x in status.uploaded_files])

    return html.Div("No Files Uploaded Yet!")
RickyChenTaiwan commented 2 years ago

Hi @np-8 ,

Thanks for your development, it is amazing.

Best regards,