Skip to content

Disable cache for statistical surfaces #1314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading