Browse Source

HUE-3528 [oozie] Call correct metrics api to avoid 500 error

krish 9 years ago
parent
commit
18a114f
1 changed files with 10 additions and 3 deletions
  1. 10 3
      desktop/libs/liboozie/src/liboozie/conf.py

+ 10 - 3
desktop/libs/liboozie/src/liboozie/conf.py

@@ -82,9 +82,16 @@ def config_validator(user):
     if 'NORMAL' not in status:
       res.append((status, _('The Oozie server is not available')))
 
-    api = get_oozie(user)
-    intrumentation = api.get_instrumentation()
-    sharelib_url = [param['value'] for group in intrumentation['variables'] for param in group['data'] if param['name'] == 'sharelib.system.libpath']
+    api = get_oozie(user, api_version="v2")
+
+    configuration = api.get_configuration()
+    if 'org.apache.oozie.service.MetricsInstrumentationService' in [c.strip() for c in configuration.get('oozie.services.ext', '').split(',')]:
+      metrics = api.get_metrics()
+      sharelib_url = 'gauges' in metrics and 'libs.sharelib.system.libpath' in metrics['gauges'] and [metrics['gauges']['libs.sharelib.system.libpath']['value']] or []
+    else:
+      intrumentation = api.get_instrumentation()
+      sharelib_url = [param['value'] for group in intrumentation['variables'] for param in group['data'] if param['name'] == 'sharelib.system.libpath']
+
     if sharelib_url:
       sharelib_url = Hdfs.urlsplit(sharelib_url[0])[2]