From 8bba3103cd545cb89539bb536d6bfebbb85d8946 Mon Sep 17 00:00:00 2001 From: Jan Van den bosch Date: Thu, 29 Feb 2024 09:49:50 +0100 Subject: [PATCH] fix test wrt/ absolute href to asset #676 I wonder why this worked before. Traceback (most recent call last): File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/flask/app.py", line 870, in full_dispatch_request rv = self.dispatch_request() File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/flask/app.py", line 855, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/openeo_driver/users/auth.py", line 88, in decorated return f(*args, **kwargs) File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/openeo_driver/views.py", line 655, in result result = backend_implementation.processing.evaluate(process_graph=process_graph, env=env) File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/openeo_driver/ProcessGraphDeserializer.py", line 301, in evaluate return evaluate(process_graph=process_graph, env=env) File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/openeo_driver/ProcessGraphDeserializer.py", line 377, in evaluate result = convert_node(result_node, env=env) File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/openeo_driver/ProcessGraphDeserializer.py", line 402, in convert_node process_result = apply_process(process_id=process_id, args=processGraph.get('arguments', {}), File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/openeo_driver/ProcessGraphDeserializer.py", line 1563, in apply_process args = {name: convert_node(expr, env=env) for (name, expr) in sorted(args.items())} File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/openeo_driver/ProcessGraphDeserializer.py", line 1563, in args = {name: convert_node(expr, env=env) for (name, expr) in sorted(args.items())} File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/openeo_driver/ProcessGraphDeserializer.py", line 416, in convert_node return convert_node(processGraph['node'], env=env) File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/openeo_driver/ProcessGraphDeserializer.py", line 402, in convert_node process_result = apply_process(process_id=process_id, args=processGraph.get('arguments', {}), File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/openeo_driver/ProcessGraphDeserializer.py", line 1595, in apply_process return process_function(args=ProcessArgs(args, process_id=process_id), env=env) File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/openeo_driver/ProcessGraphDeserializer.py", line 2204, in load_stac return env.backend_implementation.load_stac(url=url, load_params=load_params, env=env) File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/openeogeotrellis/backend.py", line 1004, in load_stac opensearch_client.add_feature( File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/py4j/java_gateway.py", line 1322, in __call__ return_value = get_return_value( File "/usr/local/spark/python/pyspark/errors/exceptions/captured.py", line 169, in deco return f(*a, **kw) File "/var/lib/jenkins/workspace/_openeo-geopyspark-driver_PR-687/venv38/lib64/python3.8/site-packages/py4j/protocol.py", line 326, in get_return_value raise Py4JJavaError( py4j.protocol.Py4JJavaError: An error occurred while calling o24174.add_feature. : java.lang.NullPointerException at java.base/java.net.URI$Parser.parse(URI.java:3104) at java.base/java.net.URI.(URI.java:600) at org.openeo.geotrellis.file.FixedFeaturesOpenSearchClient.$anonfun$add_feature$1(FixedFeaturesOpenSearchClient.scala:28) at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:286) at scala.collection.Iterator.foreach(Iterator.scala:943) at scala.collection.Iterator.foreach$(Iterator.scala:943) at scala.collection.AbstractIterator.foreach(Iterator.scala:1431) at scala.collection.IterableLike.foreach(IterableLike.scala:74) at scala.collection.IterableLike.foreach$(IterableLike.scala:73) at scala.collection.AbstractIterable.foreach(Iterable.scala:56) at scala.collection.TraversableLike.map(TraversableLike.scala:286) at scala.collection.TraversableLike.map$(TraversableLike.scala:279) at scala.collection.AbstractTraversable.map(Traversable.scala:108) at org.openeo.geotrellis.file.FixedFeaturesOpenSearchClient.add_feature(FixedFeaturesOpenSearchClient.scala:26) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:374) at py4j.Gateway.invoke(Gateway.java:282) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.ClientServerConnection.waitForCommands(ClientServerConnection.java:182) at py4j.ClientServerConnection.run(ClientServerConnection.java:106) at java.base/java.lang.Thread.run(Thread.java:829) --- openeogeotrellis/backend.py | 1 - tests/test_api_result.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/openeogeotrellis/backend.py b/openeogeotrellis/backend.py index 218cd8a33..d5c5f9256 100644 --- a/openeogeotrellis/backend.py +++ b/openeogeotrellis/backend.py @@ -1000,7 +1000,6 @@ def intersects_temporally(interval) -> bool: #this is one way to determine if a time dimension is used, but it does depend on the use of item_assets and datacube extension. netcdf_with_time_dimension = len(dimensions) == 1 and "time" in dimensions.pop() - for itm in intersecting_items: band_assets = {asset_id: asset for asset_id, asset in dict(sorted(itm.get_assets().items())).items() if is_band_asset(asset)} diff --git a/tests/test_api_result.py b/tests/test_api_result.py index 523817a0c..7088f17a9 100644 --- a/tests/test_api_result.py +++ b/tests/test_api_result.py @@ -3391,7 +3391,7 @@ def test_stac_api_item_search_bbox_is_epsg_4326(self, api110): "proj:epsg": 3035, "proj:bbox": [4309000, 3014000, 4310000, 3015000], "proj:shape": [100, 100]}, - assets={"result": Asset(href=f"file:{get_test_data_file('binary/load_stac/BVL_v1/BVL_v1_2021.tif')}", + assets={"result": Asset(href=f"file://{get_test_data_file('binary/load_stac/BVL_v1/BVL_v1_2021.tif')}", extra_fields={"eo:bands": [{"name": "class"}]})})] with mock.patch("pystac.read_file", return_value=self._mock_stac_api_collection()), mock.patch(