DHI/terracotta

Missing Executor?

bartwalczak opened this issue · 1 comments

It's probably something that I'm doing wrong, but no matter if I run terracotta in Docker container or locally (on OS X), I always keep getting this Python error:

terra-docker-ios-terra-1  | 172.18.0.1 - - [28/Oct/2022 11:42:37] "GET /singleband/nox/8/140/87.png?colormap=hot&stretch_range=[0.06780135631561279,12.038280487060547] HTTP/1.1" 500 -
terra-docker-ios-terra-1  | Traceback (most recent call last):
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2548, in __call__
terra-docker-ios-terra-1  |     return self.wsgi_app(environ, start_response)
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2528, in wsgi_app
terra-docker-ios-terra-1  |     response = self.handle_exception(e)
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2525, in wsgi_app
terra-docker-ios-terra-1  |     response = self.full_dispatch_request()
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1822, in full_dispatch_request
terra-docker-ios-terra-1  |     rv = self.handle_user_exception(e)
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1820, in full_dispatch_request
terra-docker-ios-terra-1  |     rv = self.dispatch_request()
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1796, in dispatch_request
terra-docker-ios-terra-1  |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/terracotta/server/singleband.py", line 120, in get_singleband
terra-docker-ios-terra-1  |     return _get_singleband_image(keys, tile_xyz)
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/terracotta/server/singleband.py", line 164, in _get_singleband_image
terra-docker-ios-terra-1  |     image = singleband(parsed_keys, tile_xyz=tile_xyz, **options)
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/contextlib.py", line 79, in inner
terra-docker-ios-terra-1  |     return func(*args, **kwds)
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/terracotta/handlers/singleband.py", line 43, in singleband
terra-docker-ios-terra-1  |     tile_data = xyz.get_tile_data(
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/terracotta/xyz.py", line 44, in get_tile_data
terra-docker-ios-terra-1  |     return driver.get_raster_tile(
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/terracotta/drivers/terracotta_driver.py", line 263, in get_raster_tile
terra-docker-ios-terra-1  |     return self.raster_store.get_raster_tile(
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/terracotta/drivers/geotiff_raster_store.py", line 150, in get_raster_tile
terra-docker-ios-terra-1  |     future = submit_to_executor(retrieve_tile)
terra-docker-ios-terra-1  |   File "/usr/local/lib/python3.9/site-packages/terracotta/drivers/geotiff_raster_store.py", line 53, in submit_to_executor
terra-docker-ios-terra-1  |     if context.executor is None:
terra-docker-ios-terra-1  | AttributeError: '_thread._local' object has no attribute 'executor'

I tried Python 3.9, 3.6, 3.10 with the same result, I tried different cog files, I tried using pip install terracotta as well as pip install git+https://github.com/DHI-GRAS/terracotta.git. Doesn't make a difference.

Any thoughts?

Fixed on master, feel free to reopen if this persists.