|
@@ -15,42 +15,31 @@
|
|
|
# See the License for the specific language governing permissions and
|
|
# See the License for the specific language governing permissions and
|
|
|
# limitations under the License.
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
-"""
|
|
|
|
|
-Starts the livy server.
|
|
|
|
|
-"""
|
|
|
|
|
|
|
+import logging
|
|
|
|
|
+import os
|
|
|
|
|
|
|
|
from django.core.management.base import BaseCommand
|
|
from django.core.management.base import BaseCommand
|
|
|
import spark.conf
|
|
import spark.conf
|
|
|
-import desktop.conf
|
|
|
|
|
-import hadoop.cluster
|
|
|
|
|
|
|
|
|
|
-import logging
|
|
|
|
|
-import os
|
|
|
|
|
-import sys
|
|
|
|
|
|
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
+
|
|
|
class Command(BaseCommand):
|
|
class Command(BaseCommand):
|
|
|
"""
|
|
"""
|
|
|
Starts livy server.
|
|
Starts livy server.
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
- args = '<process|yarn>'
|
|
|
|
|
|
|
+ args = '<process(default)|yarn>'
|
|
|
help = 'start livy server with process or yarn workers'
|
|
help = 'start livy server with process or yarn workers'
|
|
|
|
|
|
|
|
def handle(self, *args, **kwargs):
|
|
def handle(self, *args, **kwargs):
|
|
|
- session_kind = args[0]
|
|
|
|
|
-
|
|
|
|
|
- cluster_conf = hadoop.cluster.get_cluster_conf_for_job_submission()
|
|
|
|
|
- if cluster_conf is None:
|
|
|
|
|
- LOG.error("Configuration does not contain any MR/Yarn clusters with "
|
|
|
|
|
- "`submit_to' enabled. Cannot start BeeswaxServer.")
|
|
|
|
|
- sys.exit(1)
|
|
|
|
|
|
|
+ if not args:
|
|
|
|
|
+ session_kind = 'process'
|
|
|
|
|
+ else:
|
|
|
|
|
+ session_kind = args[0].lower()
|
|
|
|
|
|
|
|
env = os.environ.copy()
|
|
env = os.environ.copy()
|
|
|
- def set_if_present(name, val):
|
|
|
|
|
- if val:
|
|
|
|
|
- env[name] = val
|
|
|
|
|
|
|
|
|
|
args = [
|
|
args = [
|
|
|
os.path.join(
|
|
os.path.join(
|