-
Notifications
You must be signed in to change notification settings - Fork 4
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
Creo missing products #584
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6bca9d2
Log in if-case where that gives misterious missing products. https://…
EmileSonneveld 5cb7d0c
query_offline should probably list products that are not AVAILABLE an…
EmileSonneveld 08fc9c6
Only warn when STATUS=OFFLINE products do not have an ONLINE equivale…
EmileSonneveld 6c58f43
Minimize diff.
EmileSonneveld b9183d5
Fix test.
EmileSonneveld File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
import os | ||
import shutil | ||
import textwrap | ||
import urllib.request | ||
import urllib.parse | ||
import urllib.request | ||
from pathlib import Path | ||
from typing import List, Union, Sequence | ||
|
||
|
@@ -42,15 +42,15 @@ | |
) | ||
from openeogeotrellis.backend import JOB_METADATA_FILENAME | ||
from openeogeotrellis.job_registry import ZkJobRegistry | ||
from openeogeotrellis.layercatalog import get_layer_catalog | ||
from openeogeotrellis.testing import random_name, KazooClientMock, config_overrides | ||
from openeogeotrellis.utils import ( | ||
UtcNowClock, | ||
drop_empty_from_aggregate_polygon_result, | ||
get_jvm, | ||
is_package_available, | ||
) | ||
from openeogeotrellis.vault import OAuthCredentials | ||
from .data import get_test_data_file | ||
from tests.data import get_test_data_file | ||
|
||
_log = logging.getLogger(__name__) | ||
|
||
|
@@ -75,6 +75,13 @@ def set_all(properties: dict): | |
set_all(orig_properties) | ||
|
||
|
||
@pytest.fixture | ||
def catalog(vault): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this fixture added? It doesn't seem to be used |
||
catalog = get_layer_catalog(vault) | ||
catalog.set_default_sentinel_hub_credentials(client_id="???", client_secret="!!!") | ||
return catalog | ||
|
||
|
||
def test_execute_math_basic(api100): | ||
res = api100.check_result({"add": {"process_id": "add", "arguments": {"x": 3, "y": 5}, "result": True}}) | ||
assert res.json == 8 | ||
|
@@ -1903,7 +1910,7 @@ def feature_collection(cls, features: List[dict]) -> dict: | |
} | ||
|
||
|
||
def test_extra_validation_creo(api100, requests_mock): | ||
def test_extra_validation_creo(api100): | ||
pg = {"lc": { | ||
"process_id": "load_collection", | ||
"arguments": { | ||
|
@@ -1915,20 +1922,20 @@ def test_extra_validation_creo(api100, requests_mock): | |
"result": True | ||
}} | ||
|
||
requests_mock.get( | ||
"https://catalogue.dataspace.copernicus.eu/resto/api/collections/Sentinel2/search.json?productType=L2A&startDate=2020-03-01T00%3A00%3A00&cloudCover=%5B0%2C50%5D&page=1&maxRecords=100&sortParam=startDate&sortOrder=ascending&status=all&dataset=ESA-DATASET&completionDate=2020-03-10T23%3A59%3A59.999999&geometry=POLYGON+%28%28-87+68%2C+-86+68%2C+-86+67%2C+-87+67%2C+-87+68%29%29", | ||
json=CreoApiMocker.feature_collection(features=[{"tile_id": "16WEV"}, {"tile_id": "16WDA", "status": 31}]), | ||
) | ||
requests_mock.get( | ||
"https://catalogue.dataspace.copernicus.eu/resto/api/collections/Sentinel2/search.json?productType=L2A&startDate=2020-03-01T00%3A00%3A00&cloudCover=%5B0%2C50%5D&page=2&maxRecords=100&sortParam=startDate&sortOrder=ascending&status=all&dataset=ESA-DATASET&completionDate=2020-03-10T23%3A59%3A59.999999&geometry=POLYGON+%28%28-87+68%2C+-86+68%2C+-86+67%2C+-87+67%2C+-87+68%29%29", | ||
json=CreoApiMocker.feature_collection(features=[]), | ||
) | ||
# noinspection PyUnusedLocal | ||
def mock_query_jvm_opensearch_client(open_search_client, collection_id, _query_kwargs, | ||
processing_level="", attribute_values_dict=None): | ||
if attribute_values_dict["status"] == "OFFLINE": | ||
return {"16WEA", "17WEA"} | ||
elif attribute_values_dict["status"] == "ONLINE": | ||
return {"17WEA", "18WEA"} | ||
else: | ||
raise Exception("Unknown open_search_client: " + str(open_search_client)) | ||
|
||
response = api100.validation(pg) | ||
assert response.json == {'errors': [ | ||
{'code': 'MissingProduct', | ||
'message': "Tile 'S2A_MSIL2A_20200301T173231_N0209_R055_T16WDA_20200301T210331' in collection 'SENTINEL2_L2A_CREO' is not available."} | ||
]} | ||
with mock.patch("openeogeotrellis.layercatalog.query_jvm_opensearch_client", new=mock_query_jvm_opensearch_client): | ||
response = api100.validation(pg) | ||
assert response.json == {'errors': [ | ||
{'code': 'MissingProduct', 'message': "Tile '16WEA' in collection 'SENTINEL2_L2A_CREO' is not available."}]} | ||
|
||
|
||
@pytest.fixture | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm not sure this is an improvement over the original
from .data import get_test_data_file
(which is also not ideal by the way). This import makes it look like there is some top-leveltests
package in the venv while the relative import makes it more clear it is just from a sibling file.Is there a particular reason you changed this?