Skip to content

Commit

Permalink
Only load spawner_ui_config.yaml once every 10 minutes. closes kubefl…
Browse files Browse the repository at this point in the history
…ow#7259 (kubeflow#7260)

* Only load spawner_ui_config.yaml once every 10 minutes.

* Update cache to 60 seconds
  • Loading branch information
boarder7395 authored and kimwnasptd committed Oct 13, 2023
1 parent e28be5d commit 03ba57b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions components/crud-web-apps/jupyter/backend/apps/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import random
import string

from cachetools.func import ttl_cache
from kubeflow.kubeflow.crud_backend import helpers, logging
from kubernetes import client
from werkzeug import exceptions

from kubeflow.kubeflow.crud_backend import helpers, logging

from . import status

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -41,6 +41,7 @@ def load_notebook_template(**kwargs):
return helpers.load_param_yaml(NOTEBOOK_TEMPLATE_YAML, **kwargs)


@ttl_cache(ttl=60)
def load_spawner_ui_config():
for config in CONFIGS:
config_dict = helpers.load_yaml(config)
Expand Down Expand Up @@ -90,13 +91,15 @@ def pvc_from_dict(vol, namespace):
return None

return client.V1PersistentVolumeClaim(
metadata=client.V1ObjectMeta(name=vol["name"], namespace=namespace,),
metadata=client.V1ObjectMeta(
name=vol["name"],
namespace=namespace,
),
spec=client.V1PersistentVolumeClaimSpec(
access_modes=[vol["mode"]],
storage_class_name=get_storage_class(vol),
resources=client.V1ResourceRequirements(
requests={"storage": vol["size"]}
),
requests={"storage": vol["size"]}),
),
)

Expand Down Expand Up @@ -139,5 +142,5 @@ def notebook_dict_from_k8s_obj(notebook):
"memory": cntr["resources"]["requests"]["memory"],
"volumes": [v["name"] for v in cntr["volumeMounts"]],
"status": status.process_status(notebook),
"metadata": notebook["metadata"]
"metadata": notebook["metadata"],
}

0 comments on commit 03ba57b

Please sign in to comment.