-
Notifications
You must be signed in to change notification settings - Fork 18
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
New data store preload API #1097
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like very much, that we already have the multi-threading in there.I think this makes it fairly easy to do the implementation in the data store plugins.
I tested the notebook locally which works fine!
xcube/core/store/preload.py
Outdated
for data_id, future in self._futures.items(): | ||
if f is future: | ||
break | ||
if data_id is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I search for the data_id
that belongs to the passed future f
.
I'll add a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Co-authored-by: Konstantin Ntokas <[email protected]>
Co-authored-by: Konstantin Ntokas <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just saw that the failed test are not related to preload API. So I approve :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good overall, thanks. I have added some comments below, please have a look.
@@ -0,0 +1,368 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also add the context manager example in the notebook.
def __init__( | ||
self, | ||
data_ids: tuple[str, ...], | ||
preload_data: Callable[[PreloadHandle, str], None] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is useful to allow preload_params
in the preload_data
function.
E.g. I had the case, where I had multiple tiff files within a zip file which could be merged if the user requests it by a keyword boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the use case. Why don't you just add a dedicated opener parameter then?
You could also use functools.partial()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved! Added a tiny change suggestion. Please have a look before merging.
Btw, the tests are failing.
Co-authored-by: b-yogesh <[email protected]>
Added a new preload API to xcube data stores:
xcube.core.store.DataStore
class to optionally supportpreloading of datasets via an API represented by the
new
xcube.core.store.DataPreloader
interface.NullPreloadHandle
andExecutorPreloadHandle
to be returned by implementations of the
prepare_data()
method of agiven data store.
Closes #1093
Checklist:
New/modified features documented indocs/source/*
CHANGES.md