Эх сурвалжийг харах

HUE-8679 [core] Avoid config checks false positive error in multi cluster mode

Romain Rigaux 7 жил өмнө
parent
commit
2466152450

+ 14 - 11
apps/jobbrowser/src/jobbrowser/conf.py

@@ -15,22 +15,25 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from desktop.lib.conf import Config, coerce_bool
 from django.utils.translation import ugettext_lazy as _
 
+from desktop.lib.conf import Config, coerce_bool
+
 
 SHARE_JOBS = Config(
   key='share_jobs',
   default=True,
   type=coerce_bool,
   help=_('Share submitted jobs information with all users. If set to false, '
-       'submitted jobs are visible only to the owner and administrators.'))
+       'submitted jobs are visible only to the owner and administrators.')
+)
 
 DISABLE_KILLING_JOBS = Config(
   key='disable_killing_jobs',
   default=False,
   type=coerce_bool,
-  help=_('Disable the job kill button for all users in the job browser.'))
+  help=_('Disable the job kill button for all users in the job browser.')
+)
 
 LOG_OFFSET = Config(
   key='log_offset',
@@ -40,10 +43,10 @@ LOG_OFFSET = Config(
 )
 
 ENABLE_V2 = Config(
-    key="enable_v2",
-    help=_("Show the version 2 of app which unifies all the past browsers into one."),
-    type=coerce_bool,
-    default=True
+  key="enable_v2",
+  help=_("Show the version 2 of app which unifies all the past browsers into one."),
+  type=coerce_bool,
+  default=True
 )
 
 MAX_JOB_FETCH = Config(
@@ -54,8 +57,8 @@ MAX_JOB_FETCH = Config(
 )
 
 ENABLE_QUERY_BROWSER = Config(
-    key="enable_query_browser",
-    help=_("Show the query section for listing and showing more troubleshooting information."),
-    type=coerce_bool,
-    default=True
+  key="enable_query_browser",
+  help=_("Show the query section for listing and showing more troubleshooting information."),
+  type=coerce_bool,
+  default=True
 )

+ 7 - 4
desktop/core/src/desktop/conf.py

@@ -1845,10 +1845,13 @@ def config_validator(user):
   res.extend(validate_database(user))
 
   # Validate if oozie email server is active
-  from oozie.views.editor2 import _is_oozie_mail_enabled
-
-  if not _is_oozie_mail_enabled(user):
-    res.append(('OOZIE_EMAIL_SERVER', unicode(_('Email notifications is disabled for Workflows and Jobs as SMTP server is localhost.'))))
+  try:
+    from oozie.views.editor2 import _is_oozie_mail_enabled
+  
+    if not _is_oozie_mail_enabled(user):
+      res.append(('OOZIE_EMAIL_SERVER', unicode(_('Email notifications is disabled for Workflows and Jobs as SMTP server is localhost.'))))
+  except Exception, e:
+    LOG.warn('Config check failed because Oozie app not installed %s' % e)
 
   from notebook.models import make_notebook
   from notebook.api import _save_notebook

+ 1 - 0
desktop/core/src/desktop/lib/fsmanager.py

@@ -40,6 +40,7 @@ if is_s3_enabled():
 if is_adls_enabled():
   FS_GETTERS['adl'] = azure.client.get_client
 
+
 def get_filesystem(name='default'):
   """
   Return the filesystem with the given name.

+ 1 - 1
desktop/libs/aws/src/aws/conf.py

@@ -192,7 +192,7 @@ AWS_ACCOUNTS = UnspecifiedConfigSection(
 
 
 def is_enabled():
-  return ('default' in AWS_ACCOUNTS.keys() and AWS_ACCOUNTS['default'].get_raw() and AWS_ACCOUNTS['default'].ACCESS_KEY_ID.get() is not None) or has_iam_metadata()
+  return ('default' in AWS_ACCOUNTS.keys() and AWS_ACCOUNTS['default'].get_raw() and AWS_ACCOUNTS['default'].ACCESS_KEY_ID.get()) or has_iam_metadata()
 
 
 def has_iam_metadata():

+ 2 - 2
desktop/libs/hadoop/src/hadoop/conf.py

@@ -184,8 +184,6 @@ def config_validator(user):
     res.append(("hadoop.hdfs_clusters", "You should have an HDFS called 'default'."))
 
   # YARN_CLUSTERS
-  if YARN_CLUSTERS.keys():
-    res.extend(test_yarn_configurations(user))
   for name in YARN_CLUSTERS.keys():
     cluster = YARN_CLUSTERS[name]
     if cluster.SUBMIT_TO.get():
@@ -194,6 +192,8 @@ def config_validator(user):
   if not submit_to:
     res.append(("hadoop", "Please designate one of the MapReduce or "
                 "Yarn clusters with `submit_to=true' in order to run jobs."))
+  else:
+    res.extend(test_yarn_configurations(user))
 
   return res
 

+ 6 - 1
desktop/libs/liboozie/src/liboozie/conf.py

@@ -82,10 +82,15 @@ def config_validator(user):
   from hadoop.cluster import get_all_hdfs
   from hadoop.fs.hadoopfs import Hdfs
   from liboozie.oozie_api import get_oozie
-  from oozie.conf import REMOTE_SAMPLE_DIR
 
   res = []
 
+  try:
+    from oozie.conf import REMOTE_SAMPLE_DIR
+  except Exception, e:
+    LOG.warn('Config check failed because Oozie app not installed: %s' % e)
+    return res
+
   if OOZIE_URL.get():
     status = get_oozie_status(user)
     if 'NORMAL' not in status: