Skip to content
Snippets Groups Projects

Per process shared memory

Open Karsten Prehn requested to merge fix/per-process-shared-mem into main
Files
2
+ 10
1
@@ -63,6 +63,9 @@ class DataManager(TilesDatabase, Quadtile):
# Disable geos error messages
logging.getLogger("shapely.geos").setLevel(logging.CRITICAL)
# A list of the calculation quadkeys of the Discretizer process
self._quadkeys = kwargs.get("quadkeys", [])
# Location of static data on the file system
self.FILE_LAND_POLYS = self._config.get("FILE_LAND_POLYS", "")
self.FILE_WATER_POLYS = self._config.get("FILE_WATER_POLYS", "")
@@ -162,7 +165,13 @@ class DataManager(TilesDatabase, Quadtile):
def path_to_hash(self, filepath):
"""Turns a path to a file into its hash representation"""
return hashlib.md5(os.path.realpath(filepath).encode("utf-8")).hexdigest()
_quadkeys = sorted(self._quadkeys, key=len)
_quadkeys_str = "-".join(_quadkeys)
# Return a hash value unique to the Discretizer process
return hashlib.md5(
os.path.realpath(f"{filepath}/{_quadkeys_str}").encode("utf-8")
).hexdigest()
def features(self, filepath, **kwargs):
"""
Loading