Browse Source

[search] Update dashboard page for Django 1.6

Update warning when Spark Server is not running
Romain Rigaux 10 years ago
parent
commit
4518874ed2

+ 1 - 1
apps/search/src/search/views.py

@@ -216,7 +216,7 @@ def admin_collections(request, is_redirect=False):
         'absoluteUrl': collection.get_absolute_url()
         'absoluteUrl': collection.get_absolute_url()
       }
       }
       collections.append(massaged_collection)
       collections.append(massaged_collection)
-    return JsonResponse(collections)
+    return JsonResponse(collections, safe=False)
 
 
   return render('admin_collections.mako', request, {
   return render('admin_collections.mako', request, {
     'existing_hue_collections': existing_hue_collections,
     'existing_hue_collections': existing_hue_collections,

+ 5 - 7
apps/spark/src/spark/conf.py

@@ -16,7 +16,6 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import json
 import json
-import os
 import sys
 import sys
 
 
 from django.utils.translation import ugettext_lazy as _t, ugettext as _
 from django.utils.translation import ugettext_lazy as _t, ugettext as _
@@ -31,7 +30,7 @@ def coerce_json(j):
 
 
 JOB_SERVER_URL = Config(
 JOB_SERVER_URL = Config(
   key="server_url",
   key="server_url",
-  help=_t("URL of the Spark Job Server."),
+  help=_t("URL of the Livy Spark Server."),
   default="http://localhost:8998/"
   default="http://localhost:8998/"
 )
 )
 
 
@@ -48,16 +47,15 @@ LANGUAGES = Config(
   ]"""
   ]"""
 )
 )
 
 
+
 def get_spark_status(user):
 def get_spark_status(user):
   from spark.job_server_api import get_api
   from spark.job_server_api import get_api
   status = None
   status = None
 
 
   try:
   try:
     if not 'test' in sys.argv: # Avoid tests hanging
     if not 'test' in sys.argv: # Avoid tests hanging
-      status = str(get_api(user).get_status())
-  except ValueError:
-    # No json returned
-    status = 'OK'
+      get_api(user).get_status()
+      status = 'OK'
   except:
   except:
     pass
     pass
 
 
@@ -70,6 +68,6 @@ def config_validator(user):
   status = get_spark_status(user)
   status = get_spark_status(user)
 
 
   if status != 'OK':
   if status != 'OK':
-    res.append((NICE_NAME, _("The app won't work without a running Job Server")))
+    res.append((NICE_NAME, _("The app won't work without a running Livy Spark Server")))
 
 
   return res
   return res

+ 3 - 0
apps/spark/src/spark/job_server_api.py

@@ -79,6 +79,9 @@ class JobServerApi(object):
       self._thread_local.user = user.username
       self._thread_local.user = user.username
     else:
     else:
       self._thread_local.user = user
       self._thread_local.user = user
+  
+  def get_status(self):
+    return self._root.get('sessions')
 
 
   def create_session(self, **kwargs):
   def create_session(self, **kwargs):
     return self._root.post('sessions', data=json.dumps(kwargs), contenttype='application/json')
     return self._root.post('sessions', data=json.dumps(kwargs), contenttype='application/json')

+ 1 - 1
desktop/core/src/desktop/conf.py

@@ -840,7 +840,7 @@ def config_validator(user):
 
 
   res = []
   res = []
   if not SECRET_KEY.get():
   if not SECRET_KEY.get():
-    res.append((SECRET_KEY, unicode(_("Secret key should be configured as a random string."))))
+    res.append((SECRET_KEY, unicode(_("Secret key should be configured as a random string. All sessions will be lost on restart"))))
 
 
   # Validate SSL setup
   # Validate SSL setup
   if SSL_CERTIFICATE.get():
   if SSL_CERTIFICATE.get():

+ 0 - 1
desktop/core/src/desktop/settings.py

@@ -326,7 +326,6 @@ DEFAULT_FROM_EMAIL = desktop.conf.SMTP.DEFAULT_FROM.get()
 # Used for securely creating sessions.  Should be unique and not shared with anybody.
 # Used for securely creating sessions.  Should be unique and not shared with anybody.
 SECRET_KEY = desktop.conf.SECRET_KEY.get()
 SECRET_KEY = desktop.conf.SECRET_KEY.get()
 if SECRET_KEY == "":
 if SECRET_KEY == "":
-  logging.warning("secret_key is not configured. all sessions will be lost on restart")
   import uuid
   import uuid
   SECRET_KEY = str(uuid.uuid4())
   SECRET_KEY = str(uuid.uuid4())