浏览代码

[core] Make Oozielib backward compatible with Jobsub

Update the Hue ini and ini templates for Oozie app, oozielib, jobdesigner
Romain Rigaux 13 年之前
父节点
当前提交
3201daf

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

@@ -18,7 +18,7 @@
 
 
 import os.path
 import os.path
 
 
-from desktop.lib.conf import Config
+from desktop.lib.conf import Config, coerce_bool
 from desktop.lib import paths
 from desktop.lib import paths
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 
 
@@ -27,7 +27,6 @@ REMOTE_DATA_DIR = Config(
   default="/user/hue/jobsub",
   default="/user/hue/jobsub",
   help=_("Location on HDFS where the jobsub examples and templates are stored."))
   help=_("Location on HDFS where the jobsub examples and templates are stored."))
 
 
-# Where examples and templates are stored.
 LOCAL_DATA_DIR = Config(
 LOCAL_DATA_DIR = Config(
   key="local_data_dir",
   key="local_data_dir",
   default=os.path.join(os.path.dirname(__file__), "..", "..", "data"),
   default=os.path.join(os.path.dirname(__file__), "..", "..", "data"),
@@ -39,3 +38,20 @@ SAMPLE_DATA_DIR = Config(
   default=paths.get_thirdparty_root("sample_data"),
   default=paths.get_thirdparty_root("sample_data"),
   help=_("Location on local FS where sample data is stored"),
   help=_("Location on local FS where sample data is stored"),
   private=True)
   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'
     return 'ONE-OOZIE-ID-C'
 
 
 # Monkey patch Lib Oozie with Mock API
 # Monkey patch Lib Oozie with Mock API
+oozie_api.OriginalOozieApi = oozie_api.OozieApi
 oozie_api.OozieApi = MockOozieApi
 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
   # The URL where the Oozie service runs on. This is required in order for
   # users to submit jobs.
   # users to submit jobs.
-  oozie_url=http://localhost:11000/oozie
+  ## oozie_url=http://localhost:11000/oozie
 
 
   ## security_enabled=false
   ## 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
 # Settings to configure Beeswax
 ###########################################################################
 ###########################################################################
@@ -305,6 +330,21 @@
   ## share_saved_queries=true
   ## 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.
 # 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
   # The URL where the Oozie service runs on. This is required in order for
   # users to submit jobs.
   # users to submit jobs.
-  oozie_url=http://localhost:11000/oozie
+  ## oozie_url=http://localhost:11000/oozie
 
 
   ## security_enabled=false
   ## 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
 # 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]
 [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 dynamic_default a lambda to use to calculate the default
     @param required whether this must be set
     @param required whether this must be set
     @param help     some text to print out for help
     @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
                     str is the default. Should raise an exception in the case
                     that it cannot be coerced.
                     that it cannot be coerced.
     @param private  if True, does not emit help text
     @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,\
 from liboozie.types import WorkflowList, CoordinatorList, Coordinator, Workflow,\
   CoordinatorAction, WorkflowAction
   CoordinatorAction, WorkflowAction
 from liboozie.utils import config_gen
 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__)
 LOG = logging.getLogger(__name__)
 DEFAULT_USER = 'hue'
 DEFAULT_USER = 'hue'