Skip to content
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
20 changes: 19 additions & 1 deletion hydra_base/lib/template/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,25 @@ def get_template(template_id, **kwargs):
Get a specific resource template, by ID.
"""
log.info("Getting template %s", template_id)
tmpl_j = cache.get(f"{CACHE_KEY}_{template_id}")

tmpl_j = None
try:
tmpl_j = cache.get(f"{CACHE_KEY}_{template_id}")
except ConnectionError as e:
cache_type = config.get('cache', 'type', 'memcached')
cache_host = config.get('cache', 'host', '127.0.0.1')
cache_port = config.get('cache', 'port', 11211)

log.critical(
f"Unable to connect to cache for template {template_id}: {e}; cache_type={cache_type} host={cache_host} port={cache_port}",
exc_info=True
)
except Exception as e:
log.critical(
f"Unexpected error when accessing cache for template {template_id}: {e}",
exc_info=True
)


if tmpl_j is not None:
log.info("Returning cached template")
Expand Down
Loading