Bladeren bron

[core] Make Oozielib backward compatible with Jobsub

Update the Hue ini and ini templates for Oozie app, oozielib, jobdesigner
Romain Rigaux 13 jaren geleden
bovenliggende
commit
3201daf

+ 18 - 2
apps/jobsub/src/jobsub/conf.py

@@ -18,7 +18,7 @@
 
 import os.path
 
-from desktop.lib.conf import Config
+from desktop.lib.conf import Config, coerce_bool
 from desktop.lib import paths
 from django.utils.translation import ugettext_lazy as _
 
@@ -27,7 +27,6 @@ REMOTE_DATA_DIR = Config(
   default="/user/hue/jobsub",
   help=_("Location on HDFS where the jobsub examples and templates are stored."))
 
-# Where examples and templates are stored.
 LOCAL_DATA_DIR = Config(
   key="local_data_dir",
   default=os.path.join(os.path.dirname(__file__), "..", "..", "data"),
@@ -39,3 +38,20 @@ SAMPLE_DATA_DIR = Config(
   default=paths.get_thirdparty_root("sample_data"),
   help=_("Location on local FS where sample data is stored"),
   private=True)
+
+
+# Deprecated!
+# These configs were moved to desktop liboozie.
+# If liboozie is not configured these settings will be used.
+# They also have priority if liboozie defines them.
+OOZIE_URL = Config(
+  key='oozie_url',
+  help=_('Deprecated, please use liboozie.conf.OOZIE_URL instead. '
+         'URL to Oozie server. This is required for job submission.'),
+  type=str)
+
+SECURITY_ENABLED = Config(
+  key="security_enabled",
+  help=_("Deprecated, please use liboozie.conf.SECURITY_ENABLED instead. "
+         "Whether Oozie requires client to do perform Kerberos authentication"),
+  type=coerce_bool)

+ 1 - 0
apps/oozie/src/oozie/tests.py

@@ -103,6 +103,7 @@ class MockOozieCoordinatorApi(MockOozieApi):
     return 'ONE-OOZIE-ID-C'
 
 # Monkey patch Lib Oozie with Mock API
+oozie_api.OriginalOozieApi = oozie_api.OozieApi
 oozie_api.OozieApi = MockOozieApi
 
 

+ 43 - 3
desktop/conf.dist/hue.ini

@@ -260,17 +260,42 @@
 
 
 ###########################################################################
-# Settings to configure Oozie
+# Settings to configure liboozie
 ###########################################################################
 
-[oozie]
+[liboozie]
   # The URL where the Oozie service runs on. This is required in order for
   # users to submit jobs.
-  oozie_url=http://localhost:11000/oozie
+  ## oozie_url=http://localhost:11000/oozie
 
   ## security_enabled=false
 
 
+###########################################################################
+# Settings to configure the Oozie app
+###########################################################################
+
+[oozie]
+  # Location on local FS where the examples are stored.
+  ## local_data_dir=..../examples
+
+  # Location on local FS where the data for the examples is stored.
+  ## sample_data_dir=...thirdparty/sample_data
+
+  # Location on HDFS where the oozie examples and templates are stored.
+  ## remote_data_dir=/user/hue/oozie/examples
+
+  # Location on HDFS where the workflows/coordinator are deployed when submitted.
+  ## remote_data_dir=/user/hue/oozie/deployments",
+
+  # Share workflows and coordinators information with all users. If set to false,
+  # they will be visible only to the owner and administrators.
+  ## share_jobs=True
+
+  # Maximum of Oozie workflows or coodinators to retrieve in one API call.
+  ## oozie_jobs_count=100
+
+
 ###########################################################################
 # Settings to configure Beeswax
 ###########################################################################
@@ -305,6 +330,21 @@
   ## share_saved_queries=true
 
 
+###########################################################################
+# Settings to configure Job Designer
+###########################################################################
+
+[jobsub]
+  # Location on HDFS where the jobsub examples and templates are stored.
+  ## remote_data_dir=/user/hue/jobsub
+
+  # Location on local FS where examples and template are stored.
+  ## local_data_dir=..../data
+
+  # Location on local FS where sample data is stored
+  ## sample_data_dir=...thirdparty/sample_data
+
+
 ###########################################################################
 # Settings to configure Job Browser.
 ###########################################################################

+ 44 - 4
desktop/conf/pseudo-distributed.ini.tmpl

@@ -263,17 +263,42 @@
 
 
 ###########################################################################
-# Settings to configure Oozie
+# Settings to configure liboozie
 ###########################################################################
 
-[oozie]
+[liboozie]
   # The URL where the Oozie service runs on. This is required in order for
   # users to submit jobs.
-  oozie_url=http://localhost:11000/oozie
+  ## oozie_url=http://localhost:11000/oozie
 
   ## security_enabled=false
 
 
+###########################################################################
+# Settings to configure the Oozie app
+###########################################################################
+
+[oozie]
+  # Location on local FS where the examples are stored.
+  ## local_data_dir=..../examples
+
+  # Location on local FS where the data for the examples is stored.
+  ## sample_data_dir=...thirdparty/sample_data
+
+  # Location on HDFS where the oozie examples and templates are stored.
+  ## remote_data_dir=/user/hue/oozie/examples
+
+  # Location on HDFS where the workflows/coordinator are deployed when submitted.
+  ## remote_data_dir=/user/hue/oozie/deployments",
+
+  # Share workflows and coordinators information with all users. If set to false,
+  # they will be visible only to the owner and administrators.
+  ## share_jobs=True
+
+  # Maximum of Oozie workflows or coodinators to retrieve in one API call.
+  ## oozie_jobs_count=100
+
+
 ###########################################################################
 # Settings to configure Beeswax
 ###########################################################################
@@ -309,7 +334,22 @@
 
 
 ###########################################################################
-# Settings to configure Job Browser.
+# Settings to configure Job Designer
+###########################################################################
+
+[jobsub]
+  # Location on HDFS where the jobsub examples and templates are stored.
+  ## remote_data_dir=/user/hue/jobsub
+
+  # Location on local FS where examples and template are stored.
+  ## local_data_dir=..../data
+
+  # Location on local FS where sample data is stored
+  ## sample_data_dir=...thirdparty/sample_data
+
+
+###########################################################################
+# Settings to configure Job Browser
 ###########################################################################
 
 [jobbrowser]

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

@@ -181,7 +181,7 @@ class Config(object):
     @param dynamic_default a lambda to use to calculate the default
     @param required whether this must be set
     @param help     some text to print out for help
-    @param type    a callable that coerces a string into the expected type.
+    @param type     a callable that coerces a string into the expected type.
                     str is the default. Should raise an exception in the case
                     that it cannot be coerced.
     @param private  if True, does not emit help text

+ 13 - 1
desktop/libs/liboozie/src/liboozie/oozie_api.py

@@ -24,8 +24,20 @@ from desktop.lib.rest.resource import Resource
 from liboozie.types import WorkflowList, CoordinatorList, Coordinator, Workflow,\
   CoordinatorAction, WorkflowAction
 from liboozie.utils import config_gen
-from liboozie.conf import SECURITY_ENABLED, OOZIE_URL
 
+# Manage deprecation after HUE-792.
+# To Remove in Hue 3.
+import jobsub.conf as jobsub_conf
+
+if jobsub_conf.SECURITY_ENABLED.get() is not None:
+  from jobsub.conf import SECURITY_ENABLED
+else:
+  from liboozie.conf import SECURITY_ENABLED
+
+if jobsub_conf.OOZIE_URL.get() is not None:
+  from jobsub.conf import OOZIE_URL
+else:
+  from liboozie.conf import OOZIE_URL
 
 LOG = logging.getLogger(__name__)
 DEFAULT_USER = 'hue'