Commit 26dd2b49 authored by Daniel Scheffler's avatar Daniel Scheffler Committed by Mathias Peters
Browse files

Revised spatial query within DEM generation -> now uses plain pgSQL as fallback.

parent 3897c345
......@@ -485,22 +485,27 @@ class DEM_Creator(object):
# get overlapping SRTM scene IDs from GMS database
try:
SpIM = SpatialIndexMediator(host=CFG.spatial_index_server_host, port=CFG.spatial_index_server_port,
timeout=20, retries=10)
timeout=30, retries=10)
scenes = SpIM.getFullSceneDataForDataset(envelope=corner_coord_to_minmax(tgt_corner_coord_lonlat),
timeStart=datetime(1970, 1, 1),
timeEnd=datetime(2100, 12, 31),
timeStart=datetime(1970, 1, 1, 0, 0, 0),
timeEnd=datetime(2100, 12, 31, 0, 0, 0),
minCloudCover=0, maxCloudCover=100,
datasetid=self.dsID_dic[self.dem_sensor])
sceneIDs_srtm = [scene.sceneid for scene in scenes]
except ConnectionRefusedError:
dsID = self.dsID_dic[self.dem_sensor]
sceneIDs_srtm = get_overlapping_scenes_from_postgreSQLdb(self.db_conn,
table='scenes',
tgt_corners_lonlat=tgt_corner_coord_lonlat,
conditions=['datasetid=%s' % dsID],
timeout=20000) # default (15sec) is not enough
sceneIDs_srtm = [i[0] for i in sceneIDs_srtm]
# except ConnectionRefusedError:
if not sceneIDs_srtm:
dsID = self.dsID_dic[self.dem_sensor]
sceneIDs_srtm = get_overlapping_scenes_from_postgreSQLdb(self.db_conn,
table='scenes',
tgt_corners_lonlat=tgt_corner_coord_lonlat,
conditions=['datasetid=%s' % dsID],
timeout=30000) # default (15sec) is not enough
sceneIDs_srtm = [i[0] for i in sceneIDs_srtm]
except TimeoutError:
raise TimeoutError('Spatial database query for %s DEM generation timed out after 30 seconds.'
% self.dem_sensor)
if not sceneIDs_srtm:
raise RuntimeError('No matching %s scene IDs for DEM generation found.' % self.dem_sensor)
......
......@@ -278,6 +278,7 @@ class SpatialIndexMediator:
scenes.append(Scene(scenedata[0], timestamp, scenedata[8], scenedata[9], scenedata[10], bounds))
break
except socket.timeout:
if i < self.retries - 1:
continue
......
......@@ -454,7 +454,9 @@ class Test_in_normal_mode(unittest.TestCase):
# self.job_id = 26186740 # Testjob Landsat-8
# self.job_id = 26186906 # Bug Input Validator
# self.job_id = 26186925 # 1 Sentinel-2A, Bug NoneType' object has no attribute 'find'
self.job_id = 26187051 # 1 Landsat, FileNotFoundError
# self.job_id = 26187051 # GMS41: 1 Landsat, FileNotFoundError
# self.job_id = 26187052 # GMS41: 1 Landsat, DB query returns no DEM
self.job_id = 26187053 # GMS41: AC: The input 'list_GMS_objs' contains duplicates: ['', '']
self.PC = process_controller(self.job_id, **dict(is_test=False, parallelization_level='scenes', db_host=db_host,
delete_old_output=True, disable_exception_handler=True))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment