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

Das 2192 #14

Merged
merged 5 commits into from
Aug 22, 2024
Merged

Das 2192 #14

merged 5 commits into from
Aug 22, 2024

Conversation

sudha-murthy
Copy link
Collaborator

@sudha-murthy sudha-murthy commented Aug 19, 2024

Description

Prefetch of dimension variables was occurring for variable subsetting for SMAP L3/L4 collections. The update to the is_index_subset method fixes the bug.

Jira Issue ID

DAS-2192

Local Test Steps. At least one of the urls can be tested. The full test can be done post merge.

  • Build hoss image locally after fetching the branch DAS-2192
  • All the following 8 SMAP L3 requests should succeed and the logs should not have a call for 'prefetch'
  1. SPL3SMP.009
    http://localhost:3000/C1268452378-EEDTEST/ogc-api-coverages/1.0.0/collections/parameter_vars/coverage/rangeset?forceAsync=true&granuleId=G1268452388-EEDTEST&variable=Soil_Moisture_Retrieval_Data_AM%2Falbedo&skipPreview=true
  2. SPL3SMP_E.006
    http://localhost:3000/C1268399578-EEDTEST/ogc-api-coverages/1.0.0/collections/parameter_vars/coverage/rangeset?forceAsync=true&granuleId=G1268399648-EEDTEST&variable=Soil_Moisture_Retrieval_Data_AM%2Falbedo&skipPreview=true
  3. SPL3FTP.004
    http://localhost:3000/C1268617120-EEDTEST/ogc-api-coverages/1.0.0/collections/parameter_vars/coverage/rangeset?forceAsync=true&granuleId=G1268617167-EEDTEST&variable=Freeze_Thaw_Retrieval_Data_Global%2Faltitude_dem&skipPreview=true
  4. SPL3FTP_E.004
    http://localhost:3000/C1268616149-EEDTEST/ogc-api-coverages/1.0.0/collections/parameter_vars/coverage/rangeset?forceAsync=true&granuleId=G1268616387-EEDTEST&variable=Freeze_Thaw_Retrieval_Data_Global%2Faltitude_dem&skipPreview=true
  5. SPL3FTA.003
    http://localhost:3000/C1268612485-EEDTEST/ogc-api-coverages/1.0.0/collections/all/coverage/rangeset?forceAsync=true&granuleId=G1268612495-EEDTEST&skipPreview=true
  6. SPL3SMAP.003
    http://localhost:3000/C1268612473-EEDTEST/ogc-api-coverages/1.0.0/collections/parameter_vars/coverage/rangeset?forceAsync=true&granuleId=G1268612483-EEDTEST&variable=Soil_Moisture_Retrieval_Data%2Falbedo&skipPreview=true
  7. SPL2SMAP_S.003
    http://localhost:3000/C1268429762-EEDTEST/ogc-api-coverages/1.0.0/collections/parameter_vars/coverage/rangeset?forceAsync=true&granuleId=G1268612499-EEDTEST&variable=a%2FLogFileName%2CSoil_Moisture_Retrieval_Data_1km%2Falbedo_1km&skipPreview=true
  8. SPL3SMA.003
    http://localhost:3000/C1268429762-EEDTEST/ogc-api-coverages/1.0.0/collections/parameter_vars/coverage/rangeset?forceAsync=true&granuleId=G1268612499-EEDTEST&variable=a%2FLogFileName%2CSoil_Moisture_Retrieval_Data_1km%2Falbedo_1km&skipPreview=true

PR Acceptance Checklist

  • Jira ticket acceptance criteria met.
  • [X ] CHANGELOG.md updated to include high level summary of PR changes.
  • docker/service_version.txt updated if publishing a release.
  • Tests added/updated and passing.
  • Documentation updated (if needed).

The fix does only corrects variable subsetting. Spatial subsetting will be fixed in DAS-2232 after a fix to varinfo in DAS-2231
The jupyter notebook tests will be updated after the fix to DAS-2231 and DAS-2232 and the corresponding HOSS changes

Copy link
Member

@owenlittlejohns owenlittlejohns left a comment

Choose a reason for hiding this comment

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

The change makes sense. The two main things are adding a couple of quick subtests to make sure the functionality works as expected and making sure the pre-commit checks are passing. There are instructions here to set up pre-commit for the repository.

@@ -45,7 +45,7 @@ def is_index_subset(message: Message) -> bool:

"""
return any(
rgetattr(message, subset_parameter, None) is not None
rgetattr(message, subset_parameter, None) not in (None, [])
Copy link
Member

Choose a reason for hiding this comment

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

I think we need a new unit test (or more likely a sub test) here to make sure the empty list is correctly identified in this check. Probably also a sub test with a non-empty list, too, just to be sure.

Here's the test for this function. I think the easiest thing is to just add two new subtests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think there are several subtests with non empty list. But I added 2 subtests for the empty and non empty list cases

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, looking in more detail, I think you are right about the non-empty list. But thanks for adding a couple of unit tests.

CHANGELOG.md Outdated
## v1.0.5
### 2024-08-19

This version of HOSS updates the 'is_index_subset' method to check for empty list (in case of dimensions subset)
Copy link
Member

Choose a reason for hiding this comment

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

Super pedantic nit: The single-quotes around the is_index_subset should probably be backticks so that the function renders as code in the markdown.

CHANGELOG.md Outdated
### 2024-08-19

This version of HOSS updates the 'is_index_subset' method to check for empty list (in case of dimensions subset)
as well as None (for the spatial, bbox and temporal subsets. This prevents prefetch from being called for
Copy link
Member

Choose a reason for hiding this comment

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

Other nit: This line is missing a closing parenthesis. I think it's meant to be:

as well as None (for spatial, bounding box and temporal subsets). This prevents prefetch from being called for

I guess one other note: I don't know that "prefetch" is too informative for a lot of folks. Maybe:

This prevents 1-D dimension variables from being unnecessarily requested from OPeNDAP for some variable subsets, in particular SMAP L3 and L4 collections.

Nit on line below: "occuring" -> "occurring".

Copy link
Member

@owenlittlejohns owenlittlejohns left a comment

Choose a reason for hiding this comment

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

Thanks for adding the unit test. That looks good.

I think all I have left are the nits from CHANGELOG.md (missing closing parenthesis and adding a bit more context to the prose about the prefetch request to OPeNDAP). Other than that, I found one more nit about the description of the new unit test. Otherwise, this is looking good.

For what it's worth, the reason I'm being a bit pedantic about the CHANGELOG.md is it forms the basis of the public release notes for 1.0.5 release, which are are pretty public-facing, so it's good to make sure there's not typos in them etc.

@@ -679,6 +679,38 @@ def test_is_index_subset(self):
)
)

with self.subTest('No index Subset'):
Copy link
Member

@owenlittlejohns owenlittlejohns Aug 22, 2024

Choose a reason for hiding this comment

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

Nitpick: I think it's probably worth explicitly stating this subtest is for an empty dimensions list rather than "No index subset".

@@ -45,7 +45,7 @@ def is_index_subset(message: Message) -> bool:

"""
return any(
rgetattr(message, subset_parameter, None) is not None
rgetattr(message, subset_parameter, None) not in (None, [])
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, looking in more detail, I think you are right about the non-empty list. But thanks for adding a couple of unit tests.

Copy link
Contributor

@autydp autydp left a comment

Choose a reason for hiding this comment

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

This change + the unit test updates look good and cover the necessary updates. Good work!

@sudha-murthy
Copy link
Collaborator Author

This change + the unit test updates look good and cover the necessary updates. Good work!

Thanks @autydp

@sudha-murthy
Copy link
Collaborator Author

Thanks for adding the unit test. That looks good.

I think all I have left are the nits from CHANGELOG.md (missing closing parenthesis and adding a bit more context to the prose about the prefetch request to OPeNDAP). Other than that, I found one more nit about the description of the new unit test. Otherwise, this is looking good.

For what it's worth, the reason I'm being a bit pedantic about the CHANGELOG.md is it forms the basis of the public release notes for 1.0.5 release, which are are pretty public-facing, so it's good to make sure there's not typos in them etc.

Thanks @owenlittlejohns
I think I updated them both now. I must have missed committing the CHANGELOG.md before.

Copy link
Member

@owenlittlejohns owenlittlejohns left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the comments I had.

When merging please use the "Squash and Merge" option, and be sure to prepend the squashed commit message with the ticket number, so something like "DAS-2192 - Ensure HOSS correctly identifies when an index range subset is necessary". (The commits so far in this PR do not do this)

Copy link
Member

@flamingbear flamingbear 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 was following along in the background.

@sudha-murthy
Copy link
Collaborator Author

"DAS-2192 - Ensure HOSS correctly identifies when an index range subset is necessary".

@sudha-murthy sudha-murthy merged commit 065415e into main Aug 22, 2024
4 checks passed
@owenlittlejohns owenlittlejohns deleted the DAS-2192 branch August 22, 2024 16:05
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

Successfully merging this pull request may close these issues.

4 participants