Skip to content

Commit

Permalink
Disable cache for statistical surfaces (#1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
HansKallekleiv authored Jan 22, 2025
1 parent 2b63b6d commit cdf9343
Showing 1 changed file with 1 addition and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from webviz_subsurface._utils.enum_shim import StrEnum
from webviz_subsurface._utils.perf_timer import PerfTimer

from ._stat_surf_cache import StatSurfCache
from ._surface_discovery import SurfaceFileInfo
from .ensemble_surface_provider import (
EnsembleSurfaceProvider,
Expand All @@ -26,7 +25,6 @@

REL_SIM_DIR = "sim"
REL_OBS_DIR = "obs"
REL_STAT_CACHE_DIR = "stat_cache"


# pylint: disable=too-few-public-methods
Expand All @@ -53,8 +51,6 @@ def __init__(
self._provider_dir = provider_dir
self._inventory_df = surface_inventory_df

self._stat_surf_cache = StatSurfCache(self._provider_dir / REL_STAT_CACHE_DIR)

@staticmethod
# pylint: disable=too-many-locals
def write_backing_store(
Expand Down Expand Up @@ -237,22 +233,10 @@ def _get_or_create_statistical_surface(
) -> Optional[xtgeo.RegularSurface]:
timer = PerfTimer()

surf = self._stat_surf_cache.fetch(address)
if surf:
LOGGER.debug(
f"Fetched statistical surface from cache in: {timer.elapsed_s():.2f}s"
)
return surf

surf = self._create_statistical_surface(address)
et_create_s = timer.lap_s()

self._stat_surf_cache.store(address, surf)
et_write_cache_s = timer.lap_s()

LOGGER.debug(
f"Created and wrote statistical surface to cache in: {timer.elapsed_s():.2f}s ("
f"create={et_create_s:.2f}s, store={et_write_cache_s:.2f}s), "
f"Created statistical surface in: {timer.elapsed_s():.2f}s ("
f"[stat={address.statistic}, "
f"attr={address.attribute}, name={address.name}, date={address.datestr}]"
)
Expand Down

0 comments on commit cdf9343

Please sign in to comment.