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

Refactoring Preload API #12

Merged
merged 153 commits into from
Jan 21, 2025
Merged

Refactoring Preload API #12

merged 153 commits into from
Jan 21, 2025

Conversation

b-yogesh
Copy link
Collaborator

@b-yogesh b-yogesh commented Dec 30, 2024

This PR builds on top of #6

Changes in this PR:

  • Extend ExecutorPreloadHandle from xcube for preload operations in the CLMS data store
  • Improve tests and readability
  • Use pytest-vcr to send actual requests and records it as cassettes to test them like real API responses.
  • Modify CI to install xcube deps
  • Update README.md
  • Update CHANGES.md
  • Refactoring the codebase

Closes #10
Closes #9
Closes #8
Closes #4
Closes #3

Copy link
Collaborator

@konstntokas konstntokas left a comment

Choose a reason for hiding this comment

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

I already looks a lot more structured and it is easier to read than in the previous PR. :)

Please view my comments below.

CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
environment.yml Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
examples/notebooks/CLMSDataStoreTutorial.ipynb Outdated Show resolved Hide resolved
xcube_clms/constants.py Outdated Show resolved Hide resolved
xcube_clms/store.py Outdated Show resolved Hide resolved
xcube_clms/clms.py Show resolved Hide resolved
xcube_clms/utils.py Outdated Show resolved Hide resolved
xcube_clms/utils.py Outdated Show resolved Hide resolved
@b-yogesh b-yogesh requested a review from konstntokas January 16, 2025 16:01
Copy link
Collaborator

@konstntokas konstntokas left a comment

Choose a reason for hiding this comment

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

The key point is that the store should clearly reflect that all (preloaded) datasets are stored as Zarr files. Please double-check to ensure my assumptions about this are correct and make any necessary adjustments. I'll review it briefly later today, and then I’ll approve.

The remaining comments are only cosmetics.

Comment on lines 28 to 30
from xcube.util.jsonschema import (
JsonObjectSchema,
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
from xcube.util.jsonschema import (
JsonObjectSchema,
)
from xcube.util.jsonschema import JsonObjectSchema

@@ -25,9 +25,11 @@
import pytest
import xarray as xr
from xcube.core.store import new_data_store, DatasetDescriptor
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
from xcube.core.store import new_data_store, DatasetDescriptor
from xcube.core.store import new_data_store
from xcube.core.store import DatasetDescriptor

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer single imports here.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, xcube coding convention says so.


from xcube_clms.constants import DATA_STORE_ID, DATA_ID_SEPARATOR, DATA_OPENER_IDS
from xcube_clms.constants import DATA_STORE_ID, DATA_ID_SEPARATOR
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
from xcube_clms.constants import DATA_STORE_ID, DATA_ID_SEPARATOR
from xcube_clms.constants import DATA_STORE_ID
from xcube_clms.constants import DATA_ID_SEPARATOR

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer single line imports.

test/test_store.py Outdated Show resolved Hide resolved
self.assertIsInstance(schema, JsonObjectSchema)
self.assertEqual({}, schema.properties)
self.assertEqual(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will need to be adjusted then, since you get the opener params for zarr.

xcube_clms/clms.py Show resolved Hide resolved
xcube_clms/preload.py Outdated Show resolved Hide resolved
xcube_clms/store.py Outdated Show resolved Hide resolved
xcube_clms/store.py Outdated Show resolved Hide resolved
xcube_clms/store.py Show resolved Hide resolved
test/test_preload.py Show resolved Hide resolved
@@ -25,9 +25,11 @@
import pytest
import xarray as xr
from xcube.core.store import new_data_store, DatasetDescriptor
Copy link
Member

Choose a reason for hiding this comment

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

Yes, xcube coding convention says so.

xcube_clms/clms.py Show resolved Hide resolved
xcube_clms/processor.py Outdated Show resolved Hide resolved
xcube_clms/store.py Show resolved Hide resolved
xcube_clms/download_manager.py Outdated Show resolved Hide resolved
xcube_clms/constants.py Outdated Show resolved Hide resolved
xcube_clms/clms.py Outdated Show resolved Hide resolved
"""Retrieves all data IDs, optionally including additional attributes.

Args:
include_attrs: Specifies whether to include attributes.
Copy link
Member

Choose a reason for hiding this comment

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

Right, but we should also do it. Could you please create an xcube issue for that and maybe a PR as well. Should be < 1h.

xcube_clms/store.py Outdated Show resolved Hide resolved
Copy link
Member

@forman forman left a comment

Choose a reason for hiding this comment

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

Good job, very clean code, thanks!

xcube_clms/utils.py Show resolved Hide resolved
Copy link
Collaborator

@konstntokas konstntokas left a comment

Choose a reason for hiding this comment

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

Nice, approved!

@b-yogesh b-yogesh merged commit b5606e4 into main Jan 21, 2025
3 checks passed
@b-yogesh b-yogesh deleted the yogesh_preload-data-2 branch January 21, 2025 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants