From 88ad96b563f9562ed639bc55c194ec0074dec4ca Mon Sep 17 00:00:00 2001 From: Alexandre Schulz Date: Tue, 19 Apr 2022 17:20:14 +0200 Subject: [PATCH 01/14] added time range splitting and process status management --- speasy/webservices/amda/_impl.py | 40 +++++++++++++++++++++++--- speasy/webservices/amda/rest_client.py | 19 ++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/speasy/webservices/amda/_impl.py b/speasy/webservices/amda/_impl.py index a7401c17..4041f928 100644 --- a/speasy/webservices/amda/_impl.py +++ b/speasy/webservices/amda/_impl.py @@ -6,7 +6,8 @@ from .rest_client import auth_args from .exceptions import MissingCredentials -from datetime import datetime +import numpy as np +from datetime import datetime, timedelta from typing import Optional # General modules @@ -84,15 +85,46 @@ def update_inventory(self): data_tree.amda.Parameters.__dict__.update(data.dataRoot.AMDA.__dict__) self._update_lists() + def parameter_concat(self, param1, param2): + """Concatenate parameters + """ + if param1 is None and param2 is None: + return None + if param1 is None: + return param2 + if param2 is None: + return param1 + param1.time = np.hstack((param1.time, param2.time)) + if len(param1.data.shape) == 1: + param1.data = np.hstack((param1.data, param2.data)) + else: + param1.data = np.vstack((param1.data, param2.data)) + return param1 def dl_parameter(self, start_time: datetime, stop_time: datetime, parameter_id: str, **kwargs) -> Optional[ SpeasyVariable]: - - start_time = start_time.timestamp() - stop_time = stop_time.timestamp() + if isinstance(start_time, datetime): + start_time = start_time.timestamp() + if isinstance(stop_time, datetime): + stop_time = stop_time.timestamp() + + dt = timedelta(days=1).total_seconds() + + if stop_time - start_time > dt: + var = None + curr_t = start_time + while curr_t < stop_time: + #print(f"Getting block {datetime.utcfromtimestamp(curr_t)} -> {datetime.utcfromtimestamp(curr_t + dt)}") + if curr_t + dt < stop_time: + var = self.parameter_concat(var , self.dl_parameter(curr_t, curr_t + dt, parameter_id, **kwargs)) + else: + var = self.parameter_concat(var, self.dl_parameter(curr_t, stop_time, parameter_id, **kwargs)) + curr_t += dt + return var url = rest_client.get_parameter( startTime=start_time, stopTime=stop_time, parameterID=parameter_id, timeFormat='UNIXTIME', server_url=self.server_url, **kwargs) + # check status until done if url is not None: var = load_csv(url) if len(var): diff --git a/speasy/webservices/amda/rest_client.py b/speasy/webservices/amda/rest_client.py index da2e344c..ecf3b07a 100644 --- a/speasy/webservices/amda/rest_client.py +++ b/speasy/webservices/amda/rest_client.py @@ -1,4 +1,5 @@ import logging +import time from enum import Enum @@ -27,6 +28,8 @@ class Endpoint(Enum): GETCAT = "getCatalog.php" GETPARAM = "getParameter.php" + GETSTATUS = "getStatus.php" + def auth_args(username: str, password: str) -> dict: return {'userID': username, 'password': password} @@ -175,6 +178,22 @@ def send_request_json(endpoint: Endpoint, params: Dict = None, n_try: int = 3, 'dataFileURLs' in js: log.debug(f"success: {js['dataFileURLs']}") return js['dataFileURLs'] + elif "success" in js and \ + js["success"] is True and \ + "status" in js and \ + js["status"]=="in progress": + print("Warning: request duration is too long, consider reducing time range") + while True: + default_sleep_time = 10. + time.sleep(default_sleep_time) + url = request_url(Endpoint.GETSTATUS, server_url=server_url) + + #status = send_request_json(Endpoint.GETSTATUS, js) + status = http.get(url, params=js).json() + if status is not None and status["status"] == "done": + return status["dataFileURLs"] + + else: log.debug(f"Failed: {r.text}") return None From f5ced69d5dda9b27a28fad7f3bca4b5cf9d3042f Mon Sep 17 00:00:00 2001 From: Alexandre Schulz Date: Wed, 1 Jun 2022 15:47:30 +0200 Subject: [PATCH 02/14] replace parameter_concat function by speasy.products.variable.merge --- speasy/webservices/amda/_impl.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/speasy/webservices/amda/_impl.py b/speasy/webservices/amda/_impl.py index 4041f928..561d6662 100644 --- a/speasy/webservices/amda/_impl.py +++ b/speasy/webservices/amda/_impl.py @@ -12,7 +12,7 @@ # General modules from ...config import amda_password, amda_username, amda_user_cache_retention -from ...products.variable import SpeasyVariable +from ...products.variable import SpeasyVariable, merge from ...inventory import data_tree, flat_inventories from ...inventory import reset_amda_inventory as reset_amda_flat_inventory from ...core.cache import CacheCall @@ -85,21 +85,6 @@ def update_inventory(self): data_tree.amda.Parameters.__dict__.update(data.dataRoot.AMDA.__dict__) self._update_lists() - def parameter_concat(self, param1, param2): - """Concatenate parameters - """ - if param1 is None and param2 is None: - return None - if param1 is None: - return param2 - if param2 is None: - return param1 - param1.time = np.hstack((param1.time, param2.time)) - if len(param1.data.shape) == 1: - param1.data = np.hstack((param1.data, param2.data)) - else: - param1.data = np.vstack((param1.data, param2.data)) - return param1 def dl_parameter(self, start_time: datetime, stop_time: datetime, parameter_id: str, **kwargs) -> Optional[ SpeasyVariable]: @@ -116,9 +101,9 @@ def dl_parameter(self, start_time: datetime, stop_time: datetime, parameter_id: while curr_t < stop_time: #print(f"Getting block {datetime.utcfromtimestamp(curr_t)} -> {datetime.utcfromtimestamp(curr_t + dt)}") if curr_t + dt < stop_time: - var = self.parameter_concat(var , self.dl_parameter(curr_t, curr_t + dt, parameter_id, **kwargs)) + var = merge([var, self.dl_parameter(curr_t, curr_t+dt, parameter_id, **kwargs)]) else: - var = self.parameter_concat(var, self.dl_parameter(curr_t, stop_time, parameter_id, **kwargs)) + var = merge([var, self.dl_parameter(curr_t, stop_time, parameter_id, **kwargs)]) curr_t += dt return var url = rest_client.get_parameter( From 03bde87dc37f701190bfbac4e64302bed379ae35 Mon Sep 17 00:00:00 2001 From: Alexandre Schulz Date: Wed, 1 Jun 2022 15:59:55 +0200 Subject: [PATCH 03/14] removed datetime check in dl_parameter --- speasy/webservices/amda/_impl.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/speasy/webservices/amda/_impl.py b/speasy/webservices/amda/_impl.py index 561d6662..d041b9d5 100644 --- a/speasy/webservices/amda/_impl.py +++ b/speasy/webservices/amda/_impl.py @@ -88,18 +88,12 @@ def update_inventory(self): def dl_parameter(self, start_time: datetime, stop_time: datetime, parameter_id: str, **kwargs) -> Optional[ SpeasyVariable]: - if isinstance(start_time, datetime): - start_time = start_time.timestamp() - if isinstance(stop_time, datetime): - stop_time = stop_time.timestamp() - - dt = timedelta(days=1).total_seconds() + dt = timedelta(days=1) if stop_time - start_time > dt: var = None curr_t = start_time while curr_t < stop_time: - #print(f"Getting block {datetime.utcfromtimestamp(curr_t)} -> {datetime.utcfromtimestamp(curr_t + dt)}") if curr_t + dt < stop_time: var = merge([var, self.dl_parameter(curr_t, curr_t+dt, parameter_id, **kwargs)]) else: From 46e32a89236d553de389fed03d6c0b05d239936b Mon Sep 17 00:00:00 2001 From: Alexandre Schulz Date: Wed, 1 Jun 2022 16:36:20 +0200 Subject: [PATCH 04/14] seems to work --- speasy/webservices/amda/_impl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/speasy/webservices/amda/_impl.py b/speasy/webservices/amda/_impl.py index d041b9d5..67c26d85 100644 --- a/speasy/webservices/amda/_impl.py +++ b/speasy/webservices/amda/_impl.py @@ -101,7 +101,7 @@ def dl_parameter(self, start_time: datetime, stop_time: datetime, parameter_id: curr_t += dt return var url = rest_client.get_parameter( - startTime=start_time, stopTime=stop_time, parameterID=parameter_id, timeFormat='UNIXTIME', + startTime=start_time.timestamp(), stopTime=stop_time.timestamp(), parameterID=parameter_id, timeFormat='UNIXTIME', server_url=self.server_url, **kwargs) # check status until done if url is not None: From 81d5540b5a2a9f2785f799217885dd7e78c1928e Mon Sep 17 00:00:00 2001 From: Alexandre Schulz Date: Wed, 1 Jun 2022 16:38:35 +0200 Subject: [PATCH 05/14] removed print, use logger --- speasy/webservices/amda/rest_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/speasy/webservices/amda/rest_client.py b/speasy/webservices/amda/rest_client.py index ecf3b07a..b8c01950 100644 --- a/speasy/webservices/amda/rest_client.py +++ b/speasy/webservices/amda/rest_client.py @@ -182,7 +182,7 @@ def send_request_json(endpoint: Endpoint, params: Dict = None, n_try: int = 3, js["success"] is True and \ "status" in js and \ js["status"]=="in progress": - print("Warning: request duration is too long, consider reducing time range") + log.debug("Warning: request duration is too long, consider reducing time range") while True: default_sleep_time = 10. time.sleep(default_sleep_time) From 7490295e4e847f40d3bfa3ee9f974139d2ee12d5 Mon Sep 17 00:00:00 2001 From: Alexandre Schulz Date: Wed, 1 Jun 2022 16:42:42 +0200 Subject: [PATCH 06/14] added dl_parameter_chunk --- speasy/webservices/amda/_impl.py | 34 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/speasy/webservices/amda/_impl.py b/speasy/webservices/amda/_impl.py index 67c26d85..c6198fe1 100644 --- a/speasy/webservices/amda/_impl.py +++ b/speasy/webservices/amda/_impl.py @@ -85,21 +85,7 @@ def update_inventory(self): data_tree.amda.Parameters.__dict__.update(data.dataRoot.AMDA.__dict__) self._update_lists() - - def dl_parameter(self, start_time: datetime, stop_time: datetime, parameter_id: str, **kwargs) -> Optional[ - SpeasyVariable]: - dt = timedelta(days=1) - - if stop_time - start_time > dt: - var = None - curr_t = start_time - while curr_t < stop_time: - if curr_t + dt < stop_time: - var = merge([var, self.dl_parameter(curr_t, curr_t+dt, parameter_id, **kwargs)]) - else: - var = merge([var, self.dl_parameter(curr_t, stop_time, parameter_id, **kwargs)]) - curr_t += dt - return var + def dl_parameter_chunk(self, start_time: datetime, stop_time: datetime, parameter_id: str, **kwargs) -> Optional[SpeasyVariable]: url = rest_client.get_parameter( startTime=start_time.timestamp(), stopTime=stop_time.timestamp(), parameterID=parameter_id, timeFormat='UNIXTIME', server_url=self.server_url, **kwargs) @@ -114,6 +100,24 @@ def dl_parameter(self, start_time: datetime, stop_time: datetime, parameter_id: return var return None + + def dl_parameter(self, start_time: datetime, stop_time: datetime, parameter_id: str, **kwargs) -> Optional[ + SpeasyVariable]: + dt = timedelta(days=1) + + if stop_time - start_time > dt: + var = None + curr_t = start_time + while curr_t < stop_time: + if curr_t + dt < stop_time: + var = merge([var, self.dl_parameter_chunk(curr_t, curr_t+dt, parameter_id, **kwargs)]) + else: + var = merge([var, self.dl_parameter_chunk(curr_t, stop_time, parameter_id, **kwargs)]) + curr_t += dt + return var + else: + return self.dl_parameter_chunk(start_time, stop_time, parameter_id, **kwargs) + def dl_user_parameter(self, start_time: datetime, stop_time: datetime, parameter_id: str, **kwargs) -> Optional[ SpeasyVariable]: username, password = _get_credentials() From 4fa5e20f6353f4da72917558c05c3fad2a65e8e6 Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Sun, 26 Jun 2022 18:31:30 +0200 Subject: [PATCH 07/14] [AMDA] Makes max chunk size configurable --- speasy/config/__init__.py | 1 + speasy/webservices/amda/_impl.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/speasy/config/__init__.py b/speasy/config/__init__.py index f98e36a7..1f3da08a 100644 --- a/speasy/config/__init__.py +++ b/speasy/config/__init__.py @@ -109,3 +109,4 @@ def remove_entry(entry: ConfigEntry): amda_username = ConfigEntry("AMDA", "username") amda_password = ConfigEntry("AMDA", "password") amda_user_cache_retention = ConfigEntry("AMDA", "user_cache_retention", "900") # 60 * 15 seconds +amda_max_chunk_size_days = ConfigEntry("AMDA", "max_chunk_size_days", "10") # 60 * 15 seconds diff --git a/speasy/webservices/amda/_impl.py b/speasy/webservices/amda/_impl.py index c6198fe1..125d76f7 100644 --- a/speasy/webservices/amda/_impl.py +++ b/speasy/webservices/amda/_impl.py @@ -11,7 +11,7 @@ from typing import Optional # General modules -from ...config import amda_password, amda_username, amda_user_cache_retention +from ...config import amda_password, amda_username, amda_user_cache_retention, amda_max_chunk_size_days from ...products.variable import SpeasyVariable, merge from ...inventory import data_tree, flat_inventories from ...inventory import reset_amda_inventory as reset_amda_flat_inventory @@ -85,9 +85,12 @@ def update_inventory(self): data_tree.amda.Parameters.__dict__.update(data.dataRoot.AMDA.__dict__) self._update_lists() - def dl_parameter_chunk(self, start_time: datetime, stop_time: datetime, parameter_id: str, **kwargs) -> Optional[SpeasyVariable]: + + def dl_parameter_chunk(self, start_time: datetime, stop_time: datetime, parameter_id: str, **kwargs) -> Optional[ + SpeasyVariable]: url = rest_client.get_parameter( - startTime=start_time.timestamp(), stopTime=stop_time.timestamp(), parameterID=parameter_id, timeFormat='UNIXTIME', + startTime=start_time.timestamp(), stopTime=stop_time.timestamp(), parameterID=parameter_id, + timeFormat='UNIXTIME', server_url=self.server_url, **kwargs) # check status until done if url is not None: @@ -100,17 +103,16 @@ def dl_parameter_chunk(self, start_time: datetime, stop_time: datetime, paramete return var return None - def dl_parameter(self, start_time: datetime, stop_time: datetime, parameter_id: str, **kwargs) -> Optional[ SpeasyVariable]: - dt = timedelta(days=1) + dt = timedelta(days=int(amda_max_chunk_size_days)) if stop_time - start_time > dt: var = None curr_t = start_time while curr_t < stop_time: if curr_t + dt < stop_time: - var = merge([var, self.dl_parameter_chunk(curr_t, curr_t+dt, parameter_id, **kwargs)]) + var = merge([var, self.dl_parameter_chunk(curr_t, curr_t + dt, parameter_id, **kwargs)]) else: var = merge([var, self.dl_parameter_chunk(curr_t, stop_time, parameter_id, **kwargs)]) curr_t += dt From 1fbdea4b8d473336bf6cedbce46f06aedf746732 Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Sun, 26 Jun 2022 18:32:26 +0200 Subject: [PATCH 08/14] [AMDA] Too long request message has to be a warning, not a debug message --- speasy/webservices/amda/rest_client.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/speasy/webservices/amda/rest_client.py b/speasy/webservices/amda/rest_client.py index b8c01950..4728565b 100644 --- a/speasy/webservices/amda/rest_client.py +++ b/speasy/webservices/amda/rest_client.py @@ -182,13 +182,12 @@ def send_request_json(endpoint: Endpoint, params: Dict = None, n_try: int = 3, js["success"] is True and \ "status" in js and \ js["status"]=="in progress": - log.debug("Warning: request duration is too long, consider reducing time range") + log.warning("This request duration is too long, consider reducing time range") while True: default_sleep_time = 10. time.sleep(default_sleep_time) url = request_url(Endpoint.GETSTATUS, server_url=server_url) - #status = send_request_json(Endpoint.GETSTATUS, js) status = http.get(url, params=js).json() if status is not None and status["status"] == "done": return status["dataFileURLs"] From 694223004113bdbd9f6c8407a5108a9e85430fdf Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Sun, 26 Jun 2022 18:33:18 +0200 Subject: [PATCH 09/14] [AMDA] Adds test for long requests which is disabled by default --- tests/test_amda.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/test_amda.py b/tests/test_amda.py index 7af60408..122227ba 100644 --- a/tests/test_amda.py +++ b/tests/test_amda.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """Tests for `amda` package.""" - +import logging import unittest from ddt import ddt, data, unpack import os @@ -72,6 +72,19 @@ def test_get_variable_over_midnight(self): disable_cache=True) self.assertIsNotNone(result) + def test_get_variable_long_request(self): + if "SPEASY_LONG_TESTS" not in os.environ: + self.skipTest("Long tests disabled") + with self.assertLogs('speasy.webservices.amda.rest_client', level='WARNING') as cm: + start_date = datetime(2021, 1, 1, 0, 0, 0, tzinfo=timezone.utc) + stop_date = datetime(2021, 1, 25, 0, 0, 0, tzinfo=timezone.utc) + parameter_id = "mms1_b_gse" + result = spz.amda.get_parameter(parameter_id, start_date, stop_date, disable_proxy=True, + disable_cache=True) + self.assertIsNotNone(result) + self.assertTrue( + any(["This request duration is too long, consider reducing time range" in line for line in cm.output])) + def test_get_product_range(self): param_range = spz.amda.parameter_range(spz.amda.list_parameters()[0]) self.assertIsNotNone(param_range) @@ -111,11 +124,11 @@ def test_get_timetable_from_Index(self): def test_get_catalog_from_Index(self): r = spz.amda.get_catalog(spz.amda.list_catalogs()[-1]) self.assertIsNotNone(r) + def test_get_multidimensional_data(self): r = spz.amda.get_data("psp_spe_EvsEvspa", "2021-07-30T00:00:00", "2021-07-30T00:05:00") self.assertIsNotNone(r) self.assertIsNotNone(r.data) - class PrivateProductsRequests(unittest.TestCase): From 228439eaed014df5558068748515c88d60ee58f7 Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Sun, 26 Jun 2022 18:35:02 +0200 Subject: [PATCH 10/14] [AMDA] Fix typo --- speasy/webservices/amda/_impl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/speasy/webservices/amda/_impl.py b/speasy/webservices/amda/_impl.py index 125d76f7..4313f3cf 100644 --- a/speasy/webservices/amda/_impl.py +++ b/speasy/webservices/amda/_impl.py @@ -105,7 +105,7 @@ def dl_parameter_chunk(self, start_time: datetime, stop_time: datetime, paramete def dl_parameter(self, start_time: datetime, stop_time: datetime, parameter_id: str, **kwargs) -> Optional[ SpeasyVariable]: - dt = timedelta(days=int(amda_max_chunk_size_days)) + dt = timedelta(days=int(amda_max_chunk_size_days.get())) if stop_time - start_time > dt: var = None From d6ac8aaf57394dabec9ec6b7320fbfc4f324a372 Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Sun, 26 Jun 2022 18:35:19 +0200 Subject: [PATCH 11/14] [Doc] set language to avoid sphinx warning --- docs/conf.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index c3b8c143..5a1fc9af 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,7 +31,6 @@ # # needs_sphinx = '1.0' -# Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', @@ -130,7 +129,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. From 9ac0d49ce6587dfc4145668e88cb2f98d86572ff Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Sun, 26 Jun 2022 19:05:32 +0200 Subject: [PATCH 12/14] [GH Actions] Adds long tests for CI Signed-off-by: Alexis Jeandet --- .github/workflows/PRs.yml | 10 +++++++++- .github/workflows/tests.yml | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/PRs.yml b/.github/workflows/PRs.yml index f62a9fe3..8b18987a 100644 --- a/.github/workflows/PRs.yml +++ b/.github/workflows/PRs.yml @@ -35,10 +35,18 @@ jobs: - name: install texlive for Pandoc run: sudo apt update && sudo apt install -y texlive pandoc && pip install wheel - name: Test with pytest + if: matrix.python-version != '3.8' run: | pip install pytest pytest-cov sphinx pandoc pip install -r docs/requirements.txt - pytest --cov=./ --cov-report=xml + pytest + make doctest + - name: Test with pytest (coverage + long tests) + if: matrix.python-version == '3.8' + run: | + pip install pytest pytest-cov sphinx pandoc + pip install -r docs/requirements.txt + SPEASY_AMDA_MAX_CHUNK_SIZE_DAYS=30 SPEASY_LONG_TESTS pytest --cov=./ --cov-report=xml make doctest - name: Check that release process is not broken if: matrix.python-version == '3.7' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a541b8c9..14d73f07 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,10 +35,18 @@ jobs: - name: install texlive for Pandoc run: sudo apt update && sudo apt install -y texlive pandoc && pip install wheel - name: Test with pytest + if: matrix.python-version != '3.8' run: | pip install pytest pytest-cov sphinx pandoc pip install -r docs/requirements.txt - pytest --cov=./ --cov-report=xml + pytest + make doctest + - name: Test with pytest (coverage + long tests) + if: matrix.python-version == '3.8' + run: | + pip install pytest pytest-cov sphinx pandoc + pip install -r docs/requirements.txt + SPEASY_AMDA_MAX_CHUNK_SIZE_DAYS=30 SPEASY_LONG_TESTS pytest --cov=./ --cov-report=xml make doctest - name: Check that release process is not broken if: matrix.python-version == '3.7' From 739032181e34e4a279799596ef137e25039677e4 Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Sun, 26 Jun 2022 19:08:25 +0200 Subject: [PATCH 13/14] [LGTM fix] Signed-off-by: Alexis Jeandet --- .github/workflows/PRs.yml | 2 +- .github/workflows/tests.yml | 2 +- speasy/webservices/amda/_impl.py | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/PRs.yml b/.github/workflows/PRs.yml index 8b18987a..8bf4b05d 100644 --- a/.github/workflows/PRs.yml +++ b/.github/workflows/PRs.yml @@ -46,7 +46,7 @@ jobs: run: | pip install pytest pytest-cov sphinx pandoc pip install -r docs/requirements.txt - SPEASY_AMDA_MAX_CHUNK_SIZE_DAYS=30 SPEASY_LONG_TESTS pytest --cov=./ --cov-report=xml + SPEASY_AMDA_MAX_CHUNK_SIZE_DAYS=30 SPEASY_LONG_TESTS="" pytest --cov=./ --cov-report=xml make doctest - name: Check that release process is not broken if: matrix.python-version == '3.7' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 14d73f07..296a408c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,7 +46,7 @@ jobs: run: | pip install pytest pytest-cov sphinx pandoc pip install -r docs/requirements.txt - SPEASY_AMDA_MAX_CHUNK_SIZE_DAYS=30 SPEASY_LONG_TESTS pytest --cov=./ --cov-report=xml + SPEASY_AMDA_MAX_CHUNK_SIZE_DAYS=30 SPEASY_LONG_TESTS="" pytest --cov=./ --cov-report=xml make doctest - name: Check that release process is not broken if: matrix.python-version == '3.7' diff --git a/speasy/webservices/amda/_impl.py b/speasy/webservices/amda/_impl.py index 4313f3cf..3a71e850 100644 --- a/speasy/webservices/amda/_impl.py +++ b/speasy/webservices/amda/_impl.py @@ -6,7 +6,6 @@ from .rest_client import auth_args from .exceptions import MissingCredentials -import numpy as np from datetime import datetime, timedelta from typing import Optional From 482c3c6a45d053358bf20df1f5ee46e5f39672e7 Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Mon, 27 Jun 2022 08:31:46 +0200 Subject: [PATCH 14/14] [AMDA] increase long request test coverage --- .github/workflows/PRs.yml | 2 +- .github/workflows/tests.yml | 2 +- tests/test_amda.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/PRs.yml b/.github/workflows/PRs.yml index 8bf4b05d..4294f202 100644 --- a/.github/workflows/PRs.yml +++ b/.github/workflows/PRs.yml @@ -46,7 +46,7 @@ jobs: run: | pip install pytest pytest-cov sphinx pandoc pip install -r docs/requirements.txt - SPEASY_AMDA_MAX_CHUNK_SIZE_DAYS=30 SPEASY_LONG_TESTS="" pytest --cov=./ --cov-report=xml + SPEASY_AMDA_MAX_CHUNK_SIZE_DAYS=25 SPEASY_LONG_TESTS="" pytest --cov=./ --cov-report=xml make doctest - name: Check that release process is not broken if: matrix.python-version == '3.7' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 296a408c..a56948b4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,7 +46,7 @@ jobs: run: | pip install pytest pytest-cov sphinx pandoc pip install -r docs/requirements.txt - SPEASY_AMDA_MAX_CHUNK_SIZE_DAYS=30 SPEASY_LONG_TESTS="" pytest --cov=./ --cov-report=xml + SPEASY_AMDA_MAX_CHUNK_SIZE_DAYS=25 SPEASY_LONG_TESTS="" pytest --cov=./ --cov-report=xml make doctest - name: Check that release process is not broken if: matrix.python-version == '3.7' diff --git a/tests/test_amda.py b/tests/test_amda.py index 122227ba..071c56b8 100644 --- a/tests/test_amda.py +++ b/tests/test_amda.py @@ -77,7 +77,7 @@ def test_get_variable_long_request(self): self.skipTest("Long tests disabled") with self.assertLogs('speasy.webservices.amda.rest_client', level='WARNING') as cm: start_date = datetime(2021, 1, 1, 0, 0, 0, tzinfo=timezone.utc) - stop_date = datetime(2021, 1, 25, 0, 0, 0, tzinfo=timezone.utc) + stop_date = datetime(2021, 1, 30, 0, 0, 0, tzinfo=timezone.utc) parameter_id = "mms1_b_gse" result = spz.amda.get_parameter(parameter_id, start_date, stop_date, disable_proxy=True, disable_cache=True)