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

DataLoaders 6: first-class support for Incompatible #4565

Merged
merged 10 commits into from
Dec 19, 2023

Conversation

teh-cmc
Copy link
Member

@teh-cmc teh-cmc commented Dec 17, 2023

Introduce a first-class protocol for DataLoaders -- whether they are builtin, custom, or external -- to announce that they don't support loading a given piece of data.

This fixes one of the oldest issue when loading files in Rerun: loading unsupported data would always bottom out in either the image or websocket paths, leading to unrelated errors very confusing to users.

The loading process is now a two-pass process:

  1. Dispatch the data to be loaded to all loaders, which will respond ASAP whether they can do it or not.
    1.1. If at least one compatible loader is found, go to 2
    1.2. Otherwise, fail early with a nice error message for the end user
  2. Dispatch the actual data loading.

This has important/subtle ramifications on the threading model, but other than that is what you'd expect.

Checks:

  • Native: CLI examples/assets/*
  • Native: CLI examples/assets
  • Native: CLI examples/assets/* containing unsupported files
  • Native: CLI examples/assets containing unsupported files
  • Native: File>Open examples/assets/*
  • Native: File>Open examples/assets
  • Native: File>Open examples/assets/* containing unsupported files
  • Native: File>Open examples/assets containing unsupported files
  • Native: Drag-n-drop examples/assets/*
  • Native: Drag-n-drop examples/assets
  • Native: Drag-n-drop examples/assets/* containing unsupported files
  • Native: Drag-n-drop examples/assets containing unsupported files
  • Web: File>Open examples/assets/*
  • Web: Drag-n-drop examples/assets/*
  • Web: File>Open examples/assets/* containing unsupported files
  • Web: Drag-n-drop examples/assets/* containing unsupported files

Part of a series of PRs to make it possible to load any file from the local filesystem, by any means, on web and native:

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
    • Full build: app.rerun.io
    • Partial build: app.rerun.io - Useful for quick testing when changes do not affect examples in any way
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I appreciate the comment explaining why we're using real threads instead of rayon::spawn

crates/re_data_source/src/data_loader/loader_directory.rs Outdated Show resolved Hide resolved
crates/re_data_source/src/data_loader/loader_external.rs Outdated Show resolved Hide resolved
crates/re_data_source/src/data_loader/loader_external.rs Outdated Show resolved Hide resolved
crates/re_data_source/src/data_loader/loader_external.rs Outdated Show resolved Hide resolved
crates/re_data_source/src/data_loader/loader_external.rs Outdated Show resolved Hide resolved
crates/re_data_source/src/load_file.rs Outdated Show resolved Hide resolved
examples/cpp/external_data_loader/main.cpp Outdated Show resolved Hide resolved
examples/python/external_data_loader/main.py Outdated Show resolved Hide resolved
examples/rust/external_data_loader/src/main.rs Outdated Show resolved Hide resolved
examples/rust/external_data_loader/src/main.rs Outdated Show resolved Hide resolved
@emilk
Copy link
Member

emilk commented Dec 19, 2023

Oh also: use re_tracing::profile_wait for scopes that are doing nothing while waiting for other threads!

@teh-cmc teh-cmc removed the do-not-merge Do not merge this PR label Dec 19, 2023
@teh-cmc teh-cmc merged commit b7f7a55 into main Dec 19, 2023
23 of 29 checks passed
@teh-cmc teh-cmc deleted the cmc/dataloaders_6_unsupported_support branch December 19, 2023 18:50
@teh-cmc teh-cmc changed the title DataLoaders 6: first-class support for NotSupported DataLoaders 6: first-class support for Incompatible Dec 19, 2023
teh-cmc added a commit that referenced this pull request Dec 19, 2023
Add support for registering custom loaders, the same way we offer
support for registering custom space views and store subscribers.

Checks:
- [x] cargo r -p custom_data_loader -- Cargo.toml

---

Part of a series of PRs to make it possible to load _any_ file from the
local filesystem, by any means, on web and native:
- #4516
- #4517 
- #4518 
- #4519 
- #4520 
- #4521 
- #4565
- #4566
- #4567
teh-cmc added a commit that referenced this pull request Dec 22, 2023
Some docs for the whole thing.

It heavily relies on linking to the examples for exact details and to
avoid rot.

It's probably extremely bad. Help welcome.


---

Part of a series of PRs to make it possible to load _any_ file from the
local filesystem, by any means, on web and native:
- #4516
- #4517 
- #4518 
- #4519 
- #4520 
- #4521 
- #4565
- #4566
- #4567

Co-authored-by: Nikolaus West <niko@rerun.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧑‍💻 dev experience developer experience (excluding CI) include in changelog 📺 re_viewer affects re_viewer itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants