Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion etc/pip_install/toree/toreeapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os
import os.path
import json
import shlex
from os import listdir
from traitlets import Unicode, Dict, Set
from jupyter_client.kernelspecapp import InstallKernelSpec
Expand Down Expand Up @@ -48,6 +49,7 @@ class ToreeInstall(InstallKernelSpec):
jupyter toree install
jupyter toree install --spark_home=/spark/home/dir
jupyter toree install --spark_opts='--master=local[4]'
jupyter toree install --kernel_opts='-- -Xmax-classfile-name 170'
jupyter toree install --kernel_name=toree_special
jupyter toree install --toree_opts='--nosparkcontext'
jupyter toree install --interpreters=PySpark,SQL
Expand All @@ -69,6 +71,9 @@ class ToreeInstall(InstallKernelSpec):
spark_opts = Unicode('', config=True,
help='''Specify command line arguments to proxy for spark config.'''
)
kernel_opts = Unicode('', config=True,
help='''Specify command line arguments to pass to the interpreter'''
)
python_exec = Unicode('python', config=True,
help='''Specify the python executable. Defaults to "python"'''
)
Expand All @@ -77,6 +82,7 @@ class ToreeInstall(InstallKernelSpec):
'spark_home': 'ToreeInstall.spark_home',
'toree_opts': 'ToreeInstall.toree_opts',
'spark_opts': 'ToreeInstall.spark_opts',
'kernel_opts': 'ToreeInstall.kernel_opts',
'interpreters' : 'ToreeInstall.interpreters',
'python_exec' : 'ToreeInstall.python_exec'
}
Expand All @@ -97,7 +103,8 @@ def create_kernel_json(self, location, interpreter):
interpreter_lang = INTERPRETER_LANGUAGES[interpreter]
kernel_spec.display_name = '{} - {}'.format(self.kernel_name, interpreter)
kernel_spec.language = interpreter_lang
kernel_spec.argv = [os.path.join(location, 'bin', 'run.sh'), '--profile', '{connection_file}']
kernel_spec.argv = [os.path.join(location, 'bin', 'run.sh'), '--profile', '{connection_file}'] + \
shlex.split(self.kernel_opts)
kernel_spec.env = {
DEFAULT_INTERPRETER : interpreter,
# The SPARK_OPTS values are stored in TOREE_SPARK_OPTS to allow the two values to be merged when kernels
Expand Down