From 09fad0257209bde94b5ec38da63d7583f7f632be Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Wed, 30 Apr 2014 09:50:01 -0700 Subject: [PATCH] error handling when HyperCache slice does not exist --- planetstack/core/plus/views.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/planetstack/core/plus/views.py b/planetstack/core/plus/views.py index 9411712..bee590b 100644 --- a/planetstack/core/plus/views.py +++ b/planetstack/core/plus/views.py @@ -243,7 +243,7 @@ def getCDNOperatorData(randomizeData = False, wait=True): bq = PlanetStackAnalytics() - rows = bq.get_cached_query_results(bq.compose_latest_query(groupByFields=["%hostname", "event", "%slice"]), wait) + rows = bq.get_cached_query_results(bq.compose_latest_query(groupByFields=["%hostname", "event", "%slice"]), wait) # why did we need %slice ?? # wait=False on the first time the Dashboard is opened. This means we might # not have any rows yet. The dashboard code polls every 30 seconds, so it @@ -259,8 +259,11 @@ def getCDNOperatorData(randomizeData = False, wait=True): else: stats_rows = {} - slice = Slice.objects.get(name=HPC_SLICE_NAME) - slice_slivers = list(slice.slivers.all()) + slice = Slice.objects.filter(name=HPC_SLICE_NAME) + if slice: + slice_slivers = list(slice[0].slivers.all()) + else: + slice_slivers = [] new_rows = {} for site in Site.objects.all(): -- 2.43.0