Skip to content

Commit

Permalink
Devex: Update SQLAlchemy, Flask, Sphinx and friends (#12338)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 7095b2d12c737826acedb179a08c3c325efc4e0e
  • Loading branch information
stephencpope authored and Descartes Labs Build committed Dec 18, 2023
1 parent 1f0c3dd commit c89c593
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion descarteslabs/core/catalog/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
from .image_types import DownloadFileFormat, ResampleAlgorithm


@cachetools.cached(cachetools.TTLCache(maxsize=256, ttl=600), key=lambda p, c: p)
BANDS_BY_PRODUCT_CACHE = cachetools.TTLCache(maxsize=256, ttl=600)


@cachetools.cached(BANDS_BY_PRODUCT_CACHE, key=lambda p, c: p)
def cached_bands_by_product(product_id, client):
bands = {
band.name: band
Expand Down
12 changes: 9 additions & 3 deletions descarteslabs/core/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,19 @@

def clear_client_state():
"""Clear all cached client state."""
from .auth import Auth
from descarteslabs.auth import Auth
from ..common.http.service import DefaultClientMixin
from ..scenes.helpers import BANDS_BY_PRODUCT_CACHE
from descarteslabs.catalog.helpers import (
BANDS_BY_PRODUCT_CACHE as catalog_bands_by_product_cache,
)
from descarteslabs.scenes.helpers import (
BANDS_BY_PRODUCT_CACHE as scenes_bands_by_product_cache,
)

Auth.set_default_auth(None)
DefaultClientMixin.clear_all_default_clients()
BANDS_BY_PRODUCT_CACHE.clear()
catalog_bands_by_product_cache.clear()
scenes_bands_by_product_cache.clear()


__all__ = ["clear_client_state"]

0 comments on commit c89c593

Please sign in to comment.