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

Add support for resumable downloads; clean up ingest directory; add --concurrency flag #408

Merged
merged 9 commits into from
Jul 16, 2024

Commits on Jul 16, 2024

  1. Implement our own PullModel function to control how storage is used

    Add basic implementation for PullModel, which pulls a modelkit from a
    remote reference. This is basically equivalent to the Copy() utility
    function in the oras library, which uses Fetch() and Push(); however,
    this base allows us control over how files are saved and enables
    implementing better cleanup and resumable downloads.
    amisevsk committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    c183bac View commit details
    Browse the repository at this point in the history
  2. Implement resumable downloads when pulling modelkits

    If a remote response with Accept-Ranges: "bytes", treat downloads as
    resumable. In this case:
    
    * Temporary ingest file is saved with the digest name in ingest
      directory
    * If a file already exists, seek to the end of it and seek to that point
      in the download
    * If a download is cancelled or encounters an error, the ingest file is
      not removed
    
    To avoid excessive slowdown, instead of seeking to the end of the file,
    we read it into a digester to resume calculating the digest of the
    downloaded data at the same time.
    amisevsk committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    07a1f49 View commit details
    Browse the repository at this point in the history
  3. Clean up ingest directory on successful pull

    If a pull is cancelled via signal (instead of an error), the ingest file
    will not be cleaned up. To avoid accrual of partially-downloaded ingest
    files (generated by the non-resumable download case), clear the ingest
    directory on every successful pull.
    
    This may remove a partially-completed resumable download, but this
    should only occur if the user downloads some _other_ modelkit before
    attempting to resume the download.
    amisevsk committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    489754c View commit details
    Browse the repository at this point in the history
  4. Reimplement progress bars for pull

    Since we're no longer using a basic copy operation, we need to redo
    progress bars for pull from scratch.
    amisevsk committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    9ee2125 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f24d855 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5fb7687 View commit details
    Browse the repository at this point in the history
  7. Add --concurrency flag for push and pull

    Add flag --concurrency to allow configuring maximum number of
    simultaneous uploads/downloads. Default value is 5.
    amisevsk committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    0ed0ff7 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    2a3e41b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    cc597dc View commit details
    Browse the repository at this point in the history