From f52ea0264fd02db8e234776ee6631f05f1d75bfd Mon Sep 17 00:00:00 2001 From: Daniel Thiex Date: Tue, 3 Oct 2023 12:56:12 +0200 Subject: [PATCH 1/3] update readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 97499533..f366d992 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,13 @@ Then the REST API server can be run: $ python app.py ``` -To locally run the REST API server on HTTPS, so you can use it in the [openEO editor](https://editor.openeo.org/), start it with: +To locally run the REST API server on HTTPS, start it with: ``` $ python app.py https ``` +To use it in the [openEO editor](https://editor.openeo.org/), you must first access the endpoint directly via a Browser and "Accept the Risk and Continue" (there is no valid security certificate behind this secure connection). + ### Troubleshooting If validator complains about process graphs that are clearly correct (and which are valid on production deployment), there are two things than can be done: From 23e0f6d78f6c24efce1c9411ce933887e518493b Mon Sep 17 00:00:00 2001 From: Zan Pecovnik Date: Wed, 4 Oct 2023 14:14:55 +0200 Subject: [PATCH 2/3] Make all deployments use rate limiting --- rest/processing/processing_api_request.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rest/processing/processing_api_request.py b/rest/processing/processing_api_request.py index b5194d5f..f1ac62b5 100644 --- a/rest/processing/processing_api_request.py +++ b/rest/processing/processing_api_request.py @@ -60,6 +60,10 @@ def make_request(self): return requests.post(self.url, data=json.dumps(self.data), headers=self.get_headers()) def has_rate_limiting_with_backoff(self): - if self.url.startswith(SentinelhubDeployments.USWEST): + if ( + self.url.startswith(SentinelhubDeployments.MAIN) + or self.url.startswith(SentinelhubDeployments.USWEST) + or self.url.startswith(SentinelhubDeployments.CREODIAS) + ): return True return False From 36eaa963cff3d2ff851de4b3b7a26eaf0edaf84b Mon Sep 17 00:00:00 2001 From: Zan Pecovnik Date: Thu, 5 Oct 2023 10:36:42 +0200 Subject: [PATCH 3/3] Add tests for eu-central and creo deployment --- tests/test_units.py | 71 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/tests/test_units.py b/tests/test_units.py index b05ba2e6..04a692c3 100644 --- a/tests/test_units.py +++ b/tests/test_units.py @@ -986,9 +986,40 @@ def test_get_roles(filename, expected_roles): "endpoint,access_token,api_responses,min_exec_time,should_raise_error,expected_error", [ ("https://services.sentinel-hub.com", None, [{"status": 200}], 0, False, None), - ("https://services.sentinel-hub.com", None, [{"status": 429}], 0, True, "Too Many Requests"), - ("https://services.sentinel-hub.com", "some-token", [{"status": 200}], 0, False, None), - ("https://services.sentinel-hub.com", "some-token", [{"status": 429}], 0, True, "Too Many Requests"), + ( + "https://services.sentinel-hub.com", + None, + [ + {"status": 429, "headers": {"retry-after": "2"}}, + {"status": 429, "headers": {"retry-after": "7"}}, + {"status": 200}, + ], + 9, + False, + None, + ), + ( + "https://services.sentinel-hub.com", + None, + [ + {"status": 429, "headers": {"retry-after": "2"}}, + {"status": 429, "headers": {"retry-after": "2"}}, + {"status": 429, "headers": {"retry-after": "2"}}, + {"status": 429, "headers": {"retry-after": "2"}}, + ], + 0, + True, + "Out of retries.", + ), + ( + "https://services.sentinel-hub.com", + None, + [{"status": 429, "headers": {"retry-after": "2"}}, {"status": 500}], + 0, + True, + "Internal Server Error", + ), + ("https://services-uswest2.sentinel-hub.com", None, [{"status": 200}], 0, False, None), ( "https://services-uswest2.sentinel-hub.com", None, @@ -1022,6 +1053,40 @@ def test_get_roles(filename, expected_roles): True, "Internal Server Error", ), + ("https://creodias.sentinel-hub.com", None, [{"status": 200}], 0, False, None), + ( + "https://creodias.sentinel-hub.com", + None, + [ + {"status": 429, "headers": {"retry-after": "2"}}, + {"status": 429, "headers": {"retry-after": "7"}}, + {"status": 200}, + ], + 9, + False, + None, + ), + ( + "https://creodias.sentinel-hub.com", + None, + [ + {"status": 429, "headers": {"retry-after": "2"}}, + {"status": 429, "headers": {"retry-after": "2"}}, + {"status": 429, "headers": {"retry-after": "2"}}, + {"status": 429, "headers": {"retry-after": "2"}}, + ], + 0, + True, + "Out of retries.", + ), + ( + "https://creodias.sentinel-hub.com", + None, + [{"status": 429, "headers": {"retry-after": "2"}}, {"status": 500}], + 0, + True, + "Internal Server Error", + ), ], ) def test_processing_api_request(