Open-EO / openeo-geopyspark-driver

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

weird TypeError DryRunDataCube is not JSON serializable #567

Open soxofaan opened 10 months ago

soxofaan commented 10 months ago

reported by @jdries earlier today: sometimes GET https://openeo.dataspace.copernicus.eu/openeo/1.1/processes fails with

TypeError('Object of type DryRunDataCube is not JSON serializable')
soxofaan commented 10 months ago

from logs in kibana:

Traceback (most recent call last):
  File "/opt/openeo/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/openeo/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/opt/openeo/lib/python3.8/site-packages/openeo_driver/util/view_helpers.py", line 42, in wrapped
    return func(*args, **kwargs)
  File "/opt/openeo/lib/python3.8/site-packages/openeo_driver/views.py", line 672, in processes
    return jsonify({'processes': processes, 'links': []})
  File "/opt/openeo/lib/python3.8/site-packages/flask/json/__init__.py", line 361, in jsonify
    f"{dumps(data, indent=indent, separators=separators)}\n",
  File "/opt/openeo/lib/python3.8/site-packages/flask/json/__init__.py", line 139, in dumps
    rv = _json.dumps(obj, **kwargs)
  File "/usr/lib64/python3.8/json/__init__.py", line 234, in dumps
    return cls(
  File "/usr/lib64/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib64/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/opt/openeo/lib/python3.8/site-packages/flask/json/__init__.py", line 57, in default
    return super().default(o)
  File "/usr/lib64/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type DryRunDataCube is not JSON serializable
soxofaan commented 10 months ago

At the moment it also happens op openeo.vito.be, e.g.

soxofaan commented 10 months ago

This one is hard to figure out, but I'm working on this hypothesis: we have this process graph node caching feature, which manipulates the process graph in-place (to cache values) and this manipulated process graph leaks into places where we assume the process graph is immutable. Did first attempt to workaround this with https://github.com/Open-EO/openeo-python-driver/commit/bf93bffb890bb9bba08f603cc32942215956a767