From: Scott Baker Date: Thu, 20 Mar 2014 06:44:39 +0000 (-0700) Subject: tolerate missing secrets without breaking the whole server X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=78ab1011ba7c67b793fa055be1bac50668165d34;p=plstackapi.git tolerate missing secrets without breaking the whole server --- diff --git a/planetstack/hpc_wizard/bigquery_analytics.py b/planetstack/hpc_wizard/bigquery_analytics.py index ca08025..44b5dbd 100644 --- a/planetstack/hpc_wizard/bigquery_analytics.py +++ b/planetstack/hpc_wizard/bigquery_analytics.py @@ -25,8 +25,13 @@ easy_install google_api_python_client PROJECT_NUMBER = '549187599759' -FLOW = flow_from_clientsecrets('/opt/planetstack/hpc_wizard/client_secrets.json', - scope='https://www.googleapis.com/auth/bigquery') +try: + FLOW = flow_from_clientsecrets('/opt/planetstack/hpc_wizard/client_secrets.json', + scope='https://www.googleapis.com/auth/bigquery') +except: + print "exception while initializing bigquery flow" + traceback.print_exc() + FLOW = None MINUTE_MS = 60*1000 HOUR_MS = 60*60*1000 diff --git a/planetstack/hpc_wizard/planetstack_analytics.py b/planetstack/hpc_wizard/planetstack_analytics.py index cc34933..d567e22 100644 --- a/planetstack/hpc_wizard/planetstack_analytics.py +++ b/planetstack/hpc_wizard/planetstack_analytics.py @@ -1,5 +1,6 @@ from bigquery_analytics import BigQueryAnalytics import json +import traceback class PlanetStackAnalytics(BigQueryAnalytics): def __init__(self, tableName="demoevents"): diff --git a/planetstack/hpc_wizard/query.py b/planetstack/hpc_wizard/query.py index 3570a56..4ddf4f6 100644 --- a/planetstack/hpc_wizard/query.py +++ b/planetstack/hpc_wizard/query.py @@ -26,8 +26,13 @@ easy_install google_api_python_client PROJECT_NUMBER = '549187599759' -FLOW = flow_from_clientsecrets('/opt/planetstack/hpc_wizard/client_secrets.json', - scope='https://www.googleapis.com/auth/bigquery') +try: + FLOW = flow_from_clientsecrets('/opt/planetstack/hpc_wizard/client_secrets.json', + scope='https://www.googleapis.com/auth/bigquery') +except: + print "exception while initializing bigquery flow" + traceback.print_exc() + FLOW = None MINUTE_MS = 60*1000 HOUR_MS = 60*60*1000