Skip to content
This repository was archived by the owner on Jun 16, 2021. It is now read-only.

Commit 78e9d67

Browse files
committed
Prepare for initial 0.1.0 release
1 parent 248c69c commit 78e9d67

File tree

11 files changed

+135
-55
lines changed

11 files changed

+135
-55
lines changed

CONTRIBUTING.rst

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.. highlight:: shell
2-
31
============
42
Contributing
53
============
@@ -76,14 +74,12 @@ Ready to contribute? Here's how to set up `yarn_kernel_provider` for local devel
7674

7775
Now you can make your changes locally.
7876

79-
5. When you're done making changes, check that your changes pass flake8 and the
80-
tests, including testing other Python versions with tox::
77+
5. When you're done making changes, check that your changes pass flake8 and the tests::
8178

82-
$ flake8 yarn_kernel_provider tests
83-
$ python setup.py test or py.test
84-
$ tox
79+
$ flake8 yarn_kernel_provider
80+
$ make test or py.test
8581

86-
To get flake8 and tox, just pip install them into your virtualenv.
82+
To get flake8, just pip install it into your virtualenv.
8783

8884
6. Commit your changes and push your branch to GitHub::
8985

@@ -102,17 +98,10 @@ Before you submit a pull request, check that it meets these guidelines:
10298
2. If the pull request adds functionality, the docs should be updated. Put
10399
your new functionality into a function with a docstring, and add the
104100
feature to the list in README.rst.
105-
3. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check
101+
3. The pull request should work for Python 3.4, 3.5 and 3.6, and for PyPy. Check
106102
https://travis-ci.org/gateway-experiments/yarn_kernel_provider/pull_requests
107103
and make sure that the tests pass for all supported Python versions.
108104

109-
Tips
110-
----
111-
112-
To run a subset of tests::
113-
114-
115-
$ python -m unittest tests.test_yarn_kernel_provider
116105

117106
Deploying
118107
---------

HISTORY.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
History
33
=======
44

5-
0.1.0 (2019-05-30)
6-
------------------
5+
0.1.0 (Release date pending)
6+
----------------------------
77

88
* First release on PyPI.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ coverage: ## check code coverage quickly with the default Python
6464
docs: ## generate Sphinx HTML documentation, including API docs
6565
rm -f docs/yarn_kernel_provider.rst
6666
rm -f docs/modules.rst
67-
sphinx-apidoc -o docs/ yarn_kernel_provider
67+
#sphinx-apidoc -o docs/ yarn_kernel_provider
6868
$(MAKE) -C docs clean
6969
$(MAKE) -C docs html
7070
$(BROWSER) docs/_build/html/index.html

README.md

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,109 @@
22

33
__NOTE: This repository is experimental and undergoing frequent changes!__
44

5-
The Yarn Kernel Provider package provides support necessary for launching Jupyter kernels within YARN clusters. This is accomplished via two classes:
5+
The Yarn Kernel Provider package provides support necessary for launching Jupyter kernels within YARN clusters. It adheres to requirements set forth in the [Jupyter Kernel Management](https://github.com/takluyver/jupyter_kernel_mgmt) refactoring for kernel management and discovery. This is accomplished via two classes:
66

77
1. [`YarnKernelProvider`](https://github.com/gateway-experiments/yarn_kernel_provider/blob/master/yarn_kernel_provider/provider.py) is invoked by the application to locate and identify specific kernel specificiations (kernelspecs) that manage kernel lifecycles within a YARN cluster.
88
2. [`YarnKernelLifecycleManager`](https://github.com/gateway-experiments/yarn_kernel_provider/blob/master/yarn_kernel_provider/yarn.py) is instantiated by the [`RemoteKernelManager`](https://github.com/gateway-experiments/remote_kernel_provider/blob/master/remote_kernel_provider/manager.py) to peform the kernel lifecycle management. It performs post-launch discovery of the application and handles its termination via the [YARN REST API](https://github.com/toidi/hadoop-yarn-api-python-client).
99

10+
Installation of yarn_kernel_provider also includes a Jupyter application that can be used to create appropriate kernel specifications relative to YARN Spark and Dask.
11+
1012
## Installation
11-
`YarnKernelProvider` is a pip-installable package:
13+
Yarn Kernel Provider is a pip-installable package:
1214
```bash
1315
pip install yarn_kernel_provider
1416
```
1517

16-
## YARN Kernel Specifications
17-
Criteria for discovery of the kernel specification via the `YarnKernelProvider` is that a `kernel.json` file exist in a sub-directory of `yarn_kernels`.
18+
##Usage
19+
Because this version of Jupyter kernel management is still in its experimental stages, a [special branch of Notebook](https://github.com/takluyver/notebook/tree/jupyter-kernel-mgmt) is required, which includes the machinery to leverage the new framework. An installable build of this branch is available as an asset on the [interim-dev release](https://github.com/gateway-experiments/remote_kernel_provider/releases/tag/v0.1-interim-dev) of the Remote Kernel Provider on which Yarn Kernel Provider depends.
20+
21+
### YARN Kernel Specifications
22+
Criteria for discovery of the kernel specification via the `YarnKernelProvider` is that a `yarnkp_kernel.json` file exist in a sub-directory named `kernels` in the Jupyter path hierarchy.
23+
24+
Such kernel specifications should be initially created using the included Jupyter application`jupyter-yarn-kernelspec` to insure the minimally viable requirements exist. This application can be used to create specifications for YARN Spark and Dask. Spark support is available for three languages: Python, Scala and R, while Dask support is available for Python.
25+
26+
To create kernel specifications for use by YarnKernelProvider use `juptyer yarn-kernelspec install`. Here are it's parameter options, produced using `jupyter yarn-kernelspec install --help`. All parameters are optional with no parameters yielding a Python-based kernelspec for Spark on the local YARN cluster. However, locations for SPARK_HOME and Python runtimes may likely require changes if not provided.
27+
28+
```
29+
A Jupyter kernel for talking to Spark/Dask within a YARN cluster
30+
31+
Options
32+
-------
33+
34+
Arguments that take values are actually convenience aliases to full
35+
Configurables, whose aliases are listed on the help line. For more information
36+
on full configurables, see '--help-all'.
37+
38+
--user
39+
Install to the per-user kernel registry
40+
--sys-prefix
41+
Install to Python's sys.prefix. Useful in conda/virtual environments.
42+
--dask
43+
Install kernelspec for Dask YARN.
44+
--debug
45+
set log level to logging.DEBUG (maximize logging output)
46+
--prefix=<Unicode> (YKP_SpecInstaller.prefix)
47+
Default: ''
48+
Specify a prefix to install to, e.g. an env. The kernelspec will be
49+
installed in PREFIX/share/jupyter/kernels/
50+
--kernel_name=<Unicode> (YKP_SpecInstaller.kernel_name)
51+
Default: 'yarnkp_spark_python'
52+
Install the kernel spec into a directory with this name.
53+
--display_name=<Unicode> (YKP_SpecInstaller.display_name)
54+
Default: 'Spark Python (YARN Cluster)'
55+
The display name of the kernel - used by user-facing applications.
56+
--yarn_endpoint=<Unicode> (YKP_SpecInstaller.yarn_endpoint)
57+
Default: None
58+
The http url specifying the YARN Resource Manager. Note: If this value is
59+
NOT set, the YARN library will use the files within the local
60+
HADOOP_CONFIG_DIR to determine the active resource manager.
61+
(YKP_YARN_ENDPOINT env var)
62+
--alt_yarn_endpoint=<Unicode> (YKP_SpecInstaller.alt_yarn_endpoint)
63+
Default: None
64+
The http url specifying the alternate YARN Resource Manager. This value
65+
should be set when YARN Resource Managers are configured for high
66+
availability. Note: If both YARN endpoints are NOT set, the YARN library
67+
will use the files within the local HADOOP_CONFIG_DIR to determine the
68+
active resource manager. (YKP_ALT_YARN_ENDPOINT env var)
69+
--yarn_endpoint_security_enabled=<Bool> (YKP_SpecInstaller.yarn_endpoint_security_enabled)
70+
Default: False
71+
Is YARN Kerberos/SPNEGO Security enabled (True/False).
72+
(YKP_YARN_ENDPOINT_SECURITY_ENABLED env var)
73+
--language=<Unicode> (YKP_SpecInstaller.language)
74+
Default: 'Python'
75+
The language of the underlying kernel. Must be one of 'Python', 'R', or
76+
'Scala'. Default = 'Python'.
77+
--python_root=<Unicode> (YKP_SpecInstaller.python_root)
78+
Default: '/opt/conda'
79+
Specify where the root of the python installation resides (parent dir of
80+
bin/python).
81+
--spark_home=<Unicode> (YKP_SpecInstaller.spark_home)
82+
Default: '/usr/hdp/current/spark2-client'
83+
Specify where the spark files can be found.
84+
--spark_init_mode=<Unicode> (YKP_SpecInstaller.spark_init_mode)
85+
Default: 'lazy'
86+
Spark context initialization mode. Must be one of 'lazy', 'eager', or
87+
'none'. Default = 'lazy'.
88+
--extra_spark_opts=<Unicode> (YKP_SpecInstaller.extra_spark_opts)
89+
Default: ''
90+
Specify additional Spark options.
91+
--extra_dask_opts=<Unicode> (YKP_SpecInstaller.extra_dask_opts)
92+
Default: ''
93+
Specify additional Dask options.
94+
--log-level=<Enum> (Application.log_level)
95+
Default: 30
96+
Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL')
97+
Set the log level by value or name.
98+
--config=<Unicode> (JupyterApp.config_file)
99+
Default: ''
100+
Full path of a config file.
101+
102+
To see all available configurables, use `--help-all`
103+
104+
Examples
105+
--------
106+
107+
jupyter-yarn-kernelspec install --language=R --spark_home=/usr/local/spark
108+
jupyter-yarn-kernelspec install --kernel_name=dask_python --dask --yarn_endpoint=http://foo.bar:8088/ws/v1/cluster
109+
jupyter-yarn-kernelspec install --language=Scala --spark_init_mode='eager'
110+
```

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
# Add any Sphinx extension module names here, as strings. They can be
3434
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
35-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
35+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'm2r']
3636

3737
# Add any paths that contain templates here, relative to this directory.
3838
templates_path = ['_templates']
@@ -41,7 +41,7 @@
4141
# You can specify multiple suffix as a list of string:
4242
#
4343
# source_suffix = ['.rst', '.md']
44-
source_suffix = '.rst'
44+
source_suffix = ['.rst', '.md']
4545

4646
# The master toctree document.
4747
master_doc = 'index'

docs/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Welcome to Yarn Kernel Provider's documentation!
2-
======================================
2+
================================================
33

44
.. toctree::
55
:maxdepth: 2
@@ -8,7 +8,6 @@ Welcome to Yarn Kernel Provider's documentation!
88
readme
99
installation
1010
usage
11-
modules
1211
contributing
1312
history
1413

docs/readme.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.. include:: ../README.rst
1+
.. mdinclude:: ../README.md

requirements_dev.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
pip==18.1
2-
bumpversion==0.5.3
3-
wheel==0.32.1
4-
watchdog==0.9.0
5-
flake8==3.5.0
6-
tox==3.5.2
7-
coverage==4.5.1
8-
Sphinx==1.8.1
9-
twine==1.12.1
1+
pip>=18.1
2+
bumpversion>=0.5.3
3+
wheel>=0.32.1
4+
watchdog>=0.9.0
5+
flake8>=3.5.0
6+
tox>=3.5.2
7+
coverage>=4.5.1
8+
Sphinx>=1.8.1
9+
twine>=1.12.1
1010

1111

tox.ini

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
[tox]
2-
envlist = py27, py34, py35, py36, flake8
2+
envlist = py34, py35, py36, flake8
33

44
[travis]
55
python =
66
3.6: py36
77
3.5: py35
88
3.4: py34
9-
2.7: py27
109

1110
[testenv:flake8]
1211
basepython = python
@@ -17,5 +16,5 @@ commands = flake8 yarn_kernel_provider
1716
setenv =
1817
PYTHONPATH = {toxinidir}
1918

20-
commands = python setup.py test
19+
commands = make test
2120

yarn_kernel_provider/kernelspecapp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
class YKP_SpecInstaller(JupyterApp):
4444
"""CLI for extension management."""
4545
name = u'jupyter-yarn-kernelspec'
46-
description = u'A Jupyter kernel for talking to Spark within a YARN cluster'
46+
description = u'A Jupyter kernel for talking to Spark/Dask within a YARN cluster'
4747
examples = '''
4848
jupyter-yarn-kernelspec install --language=R --spark_home=/usr/local/spark
4949
jupyter-yarn-kernelspec install --kernel_name=dask_python --dask --yarn_endpoint=http://foo.bar:8088/ws/v1/cluster
50-
jupyter-yarn-kernelspec install --spark_init_mode='eager'
50+
jupyter-yarn-kernelspec install --language=Scala --spark_init_mode='eager'
5151
'''
5252
kernel_spec_manager = Instance(KernelSpecManager)
5353

@@ -282,17 +282,17 @@ def _log_and_exit(self, msg, exit_status=1):
282282

283283
class YarnKernelProviderApp(Application):
284284
version = __version__
285-
name = 'jupyter yarn-kernel-provider'
285+
name = 'jupyter yarn-kernelspec'
286286
description = '''Application used to create kernelspecs for use on Hadoop YARN clusters
287287
288288
\tYarn Kernel Provider Version: {}
289289
'''.format(__version__)
290290
examples = '''
291-
jupyter yarn_kernel_provider install-spec - Installs the kernel as a Jupyter Kernel.
291+
jupyter yarn-kernelspec install - Installs the kernel as a Jupyter Kernel.
292292
'''
293293

294294
subcommands = Dict({
295-
'install-spec': (YKP_SpecInstaller, YKP_SpecInstaller.description.splitlines()[0]),
295+
'install': (YKP_SpecInstaller, YKP_SpecInstaller.description.splitlines()[0]),
296296
})
297297

298298
aliases = {}

0 commit comments

Comments
 (0)