Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

du.UploadStatus objects for du.callback #68

Closed
fohrloop opened this issue Feb 19, 2022 · 2 comments
Closed

du.UploadStatus objects for du.callback #68

fohrloop opened this issue Feb 19, 2022 · 2 comments
Assignees
Milestone

Comments

@fohrloop
Copy link
Owner

fohrloop commented Feb 19, 2022

In the dash-uploader 0.7.0 update, the new (proposed) callback syntax is

@du.callback(
    output=Output('callback-output', 'children'),
    id='dash-uploader',
)
def get_a_list(status: du.UploadStatus):
    print(status.n_files_uploaded, status.n_files_total)
    return html.Ul([html.Li(x) for x in status.filenames])

du.UploadStatus attributes

The du.UploadStatus object could include

  • status.latest_file (pathlib.Path): The full file path to the file that has been latest uploaded
  • status.uploaded_files (list of pathlib.Path): The list of full file paths to all of the uploaded files. (uploaded in this session)
  • status.is_completed (bool): True if all the files have been uploaded
  • status.n_uploaded (int): The number of files already uploaded in this session
  • status.n_total (int): The number of files to be uploaded.
  • status.uploaded_size_mb (float): Size of files uploaded in Megabytes
  • status.total_size_mb (float): Total size of files to be uploaded in Megabytes
  • status.upload_id (str or None): The upload id used in the upload process, if any.
  • status.progress (float): From 0 to 1, indicating the current upload progress of all files. From flow.progress(). Todo: Is this calculated based on amount of files or total file size?
  • status.timeremaining (float): The remaining time to upload all files, in seconds. From flow.timeRemaining(). Dropped from the list (see du.UploadStatus objects for du.callback #68 (comment)).

Goal: implement this UploadStatus class. It will serve as guide when implementing the props and state or the Upload_ReactComponent of the 0.7.0 release.

@fohrloop fohrloop added this to the 0.7.0 milestone Feb 19, 2022
@fohrloop fohrloop self-assigned this Feb 19, 2022
@fohrloop
Copy link
Owner Author

fohrloop commented Feb 19, 2022

The status.mb_uploaded can be taken from flow.sizeUploaded(). The status.mb_total can be taken from flow.getSize().

@fohrloop
Copy link
Owner Author

The flow.timeRemaining() seems a bit unstable. The number given by the flow component will need some filtering before the value would be displayed to the user.

Here is a screen capture from situation where multiple files were "uploaded" (locally, no throttling). The timeRemaining() value jumped from 10s to ~20.000s when file was changed. This could be made working some day by keeping track of used time in the JS side and calculating longer time averages. As this is not priority right now, I'm dropping the attribute status.timeremaining from the list.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant