Open-EO / openeo-geopyspark-driver

OpenEO driver for GeoPySpark (Geotrellis)
Apache License 2.0
26 stars 5 forks source link

TypeError("can't subtract offset-naive and offset-aware datetimes") #880

Open soxofaan opened 2 months ago

soxofaan commented 2 months ago

@tcassaert found this recurring problem in the "500 response" alerts (CDSE prod webapp):

TypeError("can't subtract offset-naive and offset-aware datetimes")

Traceback (most recent call last):
  File "/opt/openeo/lib/python3.8/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/openeo/lib/python3.8/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "/opt/openeo/lib/python3.8/site-packages/openeo_driver/views.py", line 636, in validation
    errors = backend_implementation.processing.validate(process_graph=process_graph, env=env)
  File "/opt/openeo/lib/python3.8/site-packages/openeo_driver/ProcessGraphDeserializer.py", line 326, in validate
    errors.extend(self.extra_validation(
  File "/opt/openeo/lib/python3.8/site-packages/openeogeotrellis/backend.py", line 1260, in extra_validation
    number_of_temporal_observations: int = catalog.estimate_number_of_temporal_observations(
  File "/opt/openeo/lib/python3.8/site-packages/openeogeotrellis/layercatalog.py", line 915, in estimate_number_of_temporal_observations
    number_of_temporal_observations = (dateutil.parser.parse(to_date) - dateutil.parser.parse(
TypeError: can't subtract offset-naive and offset-aware datetimes

that date logic should be robust about timezone handling (e.g. default to UTC)

EmileSonneveld commented 2 weeks ago

This was probably fixed here: https://github.com/Open-EO/openeo-geopyspark-driver/commit/96546fd87d1331050eb73a2512f98052382f43bf