Skip to content

Commit ae06bf3

Browse files
committed
Add 10 minutes TTL Cache for config fetch
1 parent cc7b9c3 commit ae06bf3

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

python/fedml/computing/scheduler/model_scheduler/modelops_configs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import certifi
66
import requests
7+
import cachetools.func
78

89
import fedml
910
from fedml.core.mlops.mlops_utils import MLOpsUtils
@@ -32,6 +33,7 @@ def get_instance(args):
3233
return ModelOpsConfigs._config_instance
3334

3435
@staticmethod
36+
@cachetools.func.ttl_cache(ttl=600)
3537
def get_request_params():
3638
url = fedml._get_backend_service()
3739
url = "{}/fedmlOpsServer/configs/fetch".format(url)

python/fedml/core/mlops/mlops_configs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import certifi
66
import requests
7+
import cachetools.func
78

89
import fedml
910
from fedml.core.mlops.mlops_utils import MLOpsUtils
@@ -41,6 +42,7 @@ def __init__(self):
4142
pass
4243

4344
@staticmethod
45+
@cachetools.func.ttl_cache(ttl=600)
4446
def get_request_params():
4547
url = fedml._get_backend_service()
4648
url = f"{url}/fedmlOpsServer/configs/fetch"

0 commit comments

Comments
 (0)