Przeglądaj źródła

HUE-792 [core] Move the Oozie lib from Jobsub to Desktop

Moved the oozie lib to desktop/libs/liboozie
Romain Rigaux 13 lat temu
rodzic
commit
4a1b4a8d77

+ 1 - 13
apps/jobsub/src/jobsub/conf.py

@@ -18,7 +18,7 @@
 
 import os.path
 
-from desktop.lib.conf import Config, coerce_bool
+from desktop.lib.conf import Config
 from desktop.lib import paths
 from django.utils.translation import ugettext_lazy as _
 
@@ -39,15 +39,3 @@ SAMPLE_DATA_DIR = Config(
   default=paths.get_thirdparty_root("sample_data"),
   help=_("Location on local FS where sample data is stored"),
   private=True)
-
-OOZIE_URL = Config(
-  key='oozie_url',
-  help=_('URL to Oozie server. This is required for job submission.'),
-  default='http://localhost:11000/oozie',
-  type=str)
-
-SECURITY_ENABLED = Config(
-  key="security_enabled",
-  help=_("Whether Oozie requires client to do perform Kerberos authentication"),
-  default=False,
-  type=coerce_bool)

+ 1 - 1
apps/jobsub/src/jobsub/submit.py

@@ -28,7 +28,7 @@ import hadoop.cluster
 from hadoop.fs.hadoopfs import Hdfs
 
 from jobsub import conf, models
-from jobsub.oozie_lib.oozie_api import get_oozie
+from liboozie.oozie_api import get_oozie
 
 from django.utils.translation import ugettext as _
 

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

@@ -42,7 +42,7 @@ from hadoop.fs.exceptions import WebHdfsException
 
 from jobsub import models, submit
 from jobsub.management.commands import jobsub_setup
-from jobsub.oozie_lib.oozie_api import get_oozie
+from liboozie.oozie_api import get_oozie
 import jobsub.forms
 
 from django.utils.translation import ugettext as _

+ 2 - 1
desktop/Makefile

@@ -40,7 +40,8 @@ DESKTOP_ROOT := $(realpath .)
 include $(ROOT)/Makefile.vars.priv
 
 APPS := core \
-	libs/hadoop
+	libs/hadoop \
+	libs/liboozie
 
 .PHONY: default
 default:: hue syncdb

+ 13 - 13
desktop/conf.dist/hue.ini

@@ -145,7 +145,7 @@
     # Whether to use a TLS (secure) connection when talking to the SMTP server
     tls=no
 
-    # Default email address to use for various automated notification from Hue  
+    # Default email address to use for various automated notification from Hue
     ## default_from_email=hue@localhost
 
 
@@ -252,6 +252,18 @@
       ## hadoop_conf_dir=/etc/hadoop/conf
 
 
+###########################################################################
+# Settings to configure Oozie
+###########################################################################
+
+[oozie]
+  # The URL where the Oozie service runs on. This is required in order for
+  # users to submit jobs.
+  oozie_url=http://localhost:11000/oozie
+
+  ## security_enabled=false
+
+
 ###########################################################################
 # Settings to configure Beeswax
 ###########################################################################
@@ -286,18 +298,6 @@
   ## share_saved_queries=true
 
 
-###########################################################################
-# Settings to configure Job Designer
-###########################################################################
-
-[jobsub]
-  # The URL where the Oozie service runs on. This is required in order for
-  # users to submit jobs.
-  oozie_url=http://localhost:11000/oozie
-
-  ## security_enabled=false
-
-
 ###########################################################################
 # Settings to configure Job Browser.
 ###########################################################################

+ 13 - 13
desktop/conf/pseudo-distributed.ini.tmpl

@@ -151,7 +151,7 @@
     # Whether to use a TLS (secure) connection when talking to the SMTP server
     tls=no
 
-    # Default email address to use for various automated notification from Hue  
+    # Default email address to use for various automated notification from Hue
     ## default_from_email=hue@localhost
 
 
@@ -255,6 +255,18 @@
       ## hadoop_conf_dir=/etc/hadoop/conf
 
 
+###########################################################################
+# Settings to configure Oozie
+###########################################################################
+
+[oozie]
+  # The URL where the Oozie service runs on. This is required in order for
+  # users to submit jobs.
+  oozie_url=http://localhost:11000/oozie
+
+  ## security_enabled=false
+
+
 ###########################################################################
 # Settings to configure Beeswax
 ###########################################################################
@@ -289,18 +301,6 @@
   ## share_saved_queries=true
 
 
-###########################################################################
-# Settings to configure Job Designer.
-###########################################################################
-
-[jobsub]
-  # The URL where the Oozie service runs on. This is required in order for
-  # users to submit jobs.
-  oozie_url=http://localhost:11000/oozie
-
-  ## security_enabled=false
-
-
 ###########################################################################
 # Settings to configure Job Browser.
 ###########################################################################

+ 1 - 1
desktop/libs/hadoop/setup.py

@@ -18,7 +18,7 @@ from setuptools import setup, find_packages
 
 setup(
       name = "hadoop",
-      version = "1.2.0",
+      version = "2.1.0",
       url = 'http://github.com/cloudera/hue',
       description = "Hadoop Libraries",
       # Note that we're cheating by installing gen-py

+ 37 - 0
desktop/libs/liboozie/Makefile

@@ -0,0 +1,37 @@
+#
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+ifeq ($(ROOT),)
+  $(error "Error: Expect the environment variable $$ROOT to point to the Desktop installation")
+endif
+
+include $(ROOT)/Makefile.sdk
+
+default::
+	@echo '  env-install    : Install into virtual-env'
+
+#
+# env-install
+#   Install app into the virtual environment.
+#
+.PHONY: env-install
+env-install: compile ext-env-install
+	@echo '--- Installing $(APP_NAME) into virtual-env'
+	@$(ENV_PYTHON) setup.py develop -N -q
+

+ 30 - 0
desktop/libs/liboozie/setup.py

@@ -0,0 +1,30 @@
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from setuptools import setup, find_packages
+
+setup(
+      name = "liboozie",
+      version = "2.1.0",
+      url = 'http://github.com/cloudera/hue',
+      description = "Oozie Libraries",
+      packages = find_packages('src'),
+      package_dir = {'': 'src' },
+      install_requires = ['setuptools', 'desktop'],
+      # Even libraries need to be registered as desktop_apps,
+      # if they have configuration, like this one.
+      entry_points = { 'desktop.sdk.lib': 'liboozie=liboozie' },
+)

+ 0 - 0
apps/jobsub/src/jobsub/oozie_lib/__init__.py → desktop/libs/liboozie/src/liboozie/__init__.py


+ 33 - 0
desktop/libs/liboozie/src/liboozie/conf.py

@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# 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 _
+
+
+OOZIE_URL = Config(
+  key='oozie_url',
+  help=_('URL to Oozie server. This is required for job submission.'),
+  default='http://localhost:11000/oozie',
+  type=str)
+
+SECURITY_ENABLED = Config(
+  key="security_enabled",
+  help=_("Whether Oozie requires client to do perform Kerberos authentication"),
+  default=False,
+  type=coerce_bool)

+ 5 - 5
apps/jobsub/src/jobsub/oozie_lib/oozie_api.py → desktop/libs/liboozie/src/liboozie/oozie_api.py

@@ -21,9 +21,9 @@ import threading
 from desktop.lib.rest.http_client import HttpClient
 from desktop.lib.rest.resource import Resource
 
-from jobsub.oozie_lib.types import WorkflowList, Workflow
-from jobsub.oozie_lib.utils import config_gen
-import jobsub.conf
+from liboozie.types import WorkflowList, Workflow
+from liboozie.utils import config_gen
+from liboozie.conf import SECURITY_ENABLED, OOZIE_URL
 
 
 LOG = logging.getLogger(__name__)
@@ -43,8 +43,8 @@ def get_oozie():
     _api_cache_lock.acquire()
     try:
       if _api_cache is None:
-        secure = jobsub.conf.SECURITY_ENABLED.get()
-        _api_cache = OozieApi(jobsub.conf.OOZIE_URL.get(), secure)
+        secure = SECURITY_ENABLED.get()
+        _api_cache = OozieApi(OOZIE_URL.get(), secure)
     finally:
       _api_cache_lock.release()
   return _api_cache

+ 1 - 1
apps/jobsub/src/jobsub/oozie_lib/types.py → desktop/libs/liboozie/src/liboozie/types.py

@@ -11,7 +11,7 @@ from desktop.lib.django_util import PopupException
 from desktop.log.access import access_warn
 
 import hadoop.confparse
-from jobsub.oozie_lib.utils import parse_timestamp
+from liboozie.utils import parse_timestamp
 
 from django.utils.translation import ugettext as _
 

+ 0 - 0
apps/jobsub/src/jobsub/oozie_lib/utils.py → desktop/libs/liboozie/src/liboozie/utils.py