diff --git a/.github/workflows/run-pytest.yml b/.github/workflows/run-pytest.yml index 56d759fb..ac8e5341 100644 --- a/.github/workflows/run-pytest.yml +++ b/.github/workflows/run-pytest.yml @@ -7,7 +7,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - + - uses: actions/setup-python@v5 + with: + python-version: '3.9' - name: Install Dependencies run: | python3 -m pip install --upgrade pip diff --git a/CHANGELOG.md b/CHANGELOG.md index 16aa6754..e038a696 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,13 +25,19 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - --> +------ +## [v8.1.0](https://github.com/asfadmin/Discovery-asf_search/compare/v8.0.1...v8.1.0) +### Changed +- Changed log level from warning to debug/info for search timing log messages +- Raised minimum Python version to 3.9 from 3.8, which reached EOL last year (see the official [Status of Python versions](https://devguide.python.org/versions/) for the Python version release cycle) + ------ ## [v8.0.1](https://github.com/asfadmin/Discovery-asf_search/compare/v8.0.0...v8.0.1) ### Fixed - Fixed setting end date timezone when translating search opts to CMR opts ------ -## [v8.0.0](https://github.com/asfadmin/Discovery-asf_search/compare/v7.1.0...v7.2.0) +## [v8.0.0](https://github.com/asfadmin/Discovery-asf_search/compare/v7.1.0...v8.0.0) ### Added - Added `asf.ASFSearchOptions(circle=[lat, long, radius])` search param. Takes list of exactly 3 numbers. - Exposed `asf.validator_map`, which given a ops search param, can be used to look up which method we're going to validate it against. diff --git a/asf_search/ASFProduct.py b/asf_search/ASFProduct.py index b12e31ae..91090f67 100644 --- a/asf_search/ASFProduct.py +++ b/asf_search/ASFProduct.py @@ -121,14 +121,10 @@ def get_classname(cls): - `path`: the expected path in the CMR UMM json granule response as a list - `cast`: (optional): the optional type casting method -<<<<<<< HEAD Defining `_base_properties` in subclasses allows for defining custom properties or overiding existing ones. See `S1Product.get_property_paths()` on how subclasses are expected to combine `ASFProduct._base_properties` with their own separately defined `_base_properties` -======= - Defining `_properties_paths` in subclasses allows for defining custom properties or overiding existing ones. ->>>>>>> master """ def __init__(self, args: Dict = {}, session: ASFSession = ASFSession()): diff --git a/asf_search/search/search.py b/asf_search/search/search.py index cc60fcb9..cdad2f4b 100644 --- a/asf_search/search/search.py +++ b/asf_search/search/search.py @@ -172,7 +172,7 @@ def search( # The last page will be marked as complete if results sucessful perf = time.time() for page in search_generator(opts=opts): - ASF_LOGGER.warning(f'Page Time Elapsed {time.time() - perf}') + ASF_LOGGER.debug(f'Page Time Elapsed {time.time() - perf}') results.extend(page) results.searchComplete = page.searchComplete results.searchOptions = page.searchOptions diff --git a/asf_search/search/search_generator.py b/asf_search/search/search_generator.py index 550891f7..961b4c88 100644 --- a/asf_search/search/search_generator.py +++ b/asf_search/search/search_generator.py @@ -256,7 +256,7 @@ def search_generator( last_page = process_page( items, maxResults, subquery_max_results, total, subquery_count, opts ) - ASF_LOGGER.warning(f'Page Processing Time {time.time() - perf}') + ASF_LOGGER.info(f'Page Processing Time {time.time() - perf}') subquery_count += len(last_page) total += len(last_page) last_page.searchComplete = subquery_count == subquery_max_results or total == maxResults @@ -296,7 +296,7 @@ def query_cmr( perf = time.time() items = [as_ASFProduct(f, session=session) for f in response.json()['items']] - ASF_LOGGER.warning(f'Product Subclassing Time {time.time() - perf}') + ASF_LOGGER.debug(f'Product Subclassing Time {time.time() - perf}') hits: int = response.json()['hits'] # total count of products given search opts # 9-10 per process # 3.9-5 per process @@ -354,7 +354,7 @@ def get_page(session: ASFSession, url: str, translated_opts: List) -> Response: f'Connection Error (Timeout): CMR took too long to respond. Set asf constant "asf_search.constants.INTERNAL.CMR_TIMEOUT" to increase. ({url=}, timeout={CMR_TIMEOUT})' ) from exc - ASF_LOGGER.warning(f'Query Time Elapsed {time.time() - perf}') + ASF_LOGGER.info(f'Query Time Elapsed {time.time() - perf}') return response diff --git a/setup.py b/setup.py index d5a82a73..e600d89a 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ 'pytest-cov', 'pytest-xdist', 'coverage', - 'requests-mock', + 'requests-mock==1.11.0', 'nbformat', 'nbconvert', 'ipykernel', diff --git a/tests/ASFSearchResults/test_ASFSearchResults.py b/tests/ASFSearchResults/test_ASFSearchResults.py index c28dcac8..bc647bc9 100644 --- a/tests/ASFSearchResults/test_ASFSearchResults.py +++ b/tests/ASFSearchResults/test_ASFSearchResults.py @@ -15,6 +15,7 @@ from shapely.geometry.base import BaseGeometry from asf_search.CMR.translate import try_parse_date from asf_search.constants import PLATFORM +from asf_search import ASF_LOGGER import re from asf_search.exceptions import ASFSearchError @@ -211,15 +212,19 @@ def run_test_ASFSearchResults_intersection(wkt: str): def overlap_check(s1: BaseGeometry, s2: BaseGeometry): return s1.overlaps(s2) or s1.touches(s2) or s2.distance(s1) <= 0.005 - asf.constants.INTERNAL.CMR_TIMEOUT = 60 for platform in platforms: + asf.constants.INTERNAL.CMR_TIMEOUT = 120 try: results = asf.geo_search(intersectsWith=wkt, platform=platform, maxResults=250) except ASFSearchError as exc: asf.constants.INTERNAL.CMR_TIMEOUT = 30 - raise BaseException( - f'Failed to perform intersection test with wkt: {wkt}\nplatform: {platform}.\nOriginal exception: {exc}' - ) + if str(exc).startswith("Connection Error (Timeout):"): + ASF_LOGGER.warning('CMR timeout while running intersection test') + continue + else: + raise BaseException( + f'Failed to perform intersection test with wkt: {wkt}\nplatform: {platform}.\nOriginal exception: {exc}' + ) asf.constants.INTERNAL.CMR_TIMEOUT = 30 for product in results: