GitHub user astroshim reopened a pull request:
https://github.com/apache/zeppelin/pull/2106
[WIP] Rewrite PythonInterpreter.
### What is this PR for?
I've been testing the python interpreter and I found at least 4 major
issues in the current python interpreter.
1. not working streaming output.
- https://issues.apache.org/jira/browse/ZEPPELIN-2225
2. printed "..." when there is indent in the python code.
- https://issues.apache.org/jira/browse/ZEPPELIN-1929
3. very slow output of matplotlib
- https://issues.apache.org/jira/browse/ZEPPELIN-1894
- https://issues.apache.org/jira/browse/ZEPPELIN-1360
4. Unexpected output of matplotlib.
- https://issues.apache.org/jira/browse/ZEPPELIN-2107
so I changed python interpreter to use py4j based on pyspark interpreter
and would be fixed above issues.
and I am going to recreate conda, docker for python interpreter ASAP.
### What type of PR is it?
Bug Fix | Hot Fix | Refactoring
### How should this be tested?
1. not working streaming output.
```
import time
for x in range(0, 5):
print x
time.sleep(1)
```
2. printed "..." when there is indent in the python code.
```
def fn():
print("hi")
fn()
```
3. very slow output of matplotlib.
```
import matplotlib
import sys
import matplotlib.pyplot as plt
plt.plot([1,2,3])
```
4. Unexpected output of matplotlib.
```
import matplotlib.pyplot as plt
import matplotlib as mpl
# Make a figure and axes with dimensions as desired.
fig = plt.figure(figsize=(8, 3))
ax1 = fig.add_axes([0.05, 0.80, 0.9, 0.15])
ax2 = fig.add_axes([0.05, 0.475, 0.9, 0.15])
ax3 = fig.add_axes([0.05, 0.15, 0.9, 0.15])
# Set the colormap and norm to correspond to the data for which
# the colorbar will be used.
cmap = mpl.cm.cool
norm = mpl.colors.Normalize(vmin=5, vmax=10)
# ColorbarBase derives from ScalarMappable and puts a colorbar
# in a specified axes, so it has everything needed for a
# standalone colorbar. There are many more kwargs, but the
# following gives a basic continuous colorbar with ticks
# and labels.
cb1 = mpl.colorbar.ColorbarBase(ax1, cmap=cmap,
norm=norm,
orientation='horizontal')
cb1.set_label('Some Units')
# The second example illustrates the use of a ListedColormap, a
# BoundaryNorm, and extended ends to show the "over" and "under"
# value colors.
cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c'])
cmap.set_over('0.25')
cmap.set_under('0.75')
# If a ListedColormap is used, the length of the bounds array must be
# one greater than the length of the color list. The bounds must be
# monotonically increasing.
bounds = [1, 2, 4, 7, 8]
norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
cb2 = mpl.colorbar.ColorbarBase(ax2, cmap=cmap,
norm=norm,
# to use 'extend', you must
# specify two extra boundaries:
boundaries=[0] + bounds + [13],
extend='both',
ticks=bounds, # optional
spacing='proportional',
orientation='horizontal')
cb2.set_label('Discrete intervals, some other units')
# The third example illustrates the use of custom length colorbar
# extensions, used on a colorbar with discrete intervals.
cmap = mpl.colors.ListedColormap([[0., .4, 1.], [0., .8, 1.],
[1., .8, 0.], [1., .4, 0.]])
cmap.set_over((1., 0., 0.))
cmap.set_under((0., 0., 1.))
bounds = [-1., -.5, 0., .5, 1.]
norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
cb3 = mpl.colorbar.ColorbarBase(ax3, cmap=cmap,
norm=norm,
boundaries=[-10] + bounds + [10],
extend='both',
# Make the length of each extension
# the same as the length of the
# interior colors:
extendfrac='auto',
ticks=bounds,
spacing='uniform',
orientation='horizontal')
cb3.set_label('Custom extension lengths, some other units')
plt.show()
```
### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/astroshim/zeppelin py4jPythonInterpreter
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/2106.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2106
----
commit 7304919def595312c971e04b7fc5a24c23bd93e8
Author: astroshim <[email protected]>
Date: 2017-03-07T01:43:58Z
initialize python interpreter using py4j
commit 276011e32d5ba7fb416744fbbd212916b4e57ce7
Author: astroshim <[email protected]>
Date: 2017-03-07T04:20:49Z
add py4j lib
commit 1395875b51795e646ed559b52156d9e8f302e5b0
Author: astroshim <[email protected]>
Date: 2017-03-07T09:34:10Z
removed unnecessary code.
commit c3f5b78d765a4aa01d0973d6ad79134ab62eb21a
Author: astroshim <[email protected]>
Date: 2017-03-08T05:15:32Z
Merge branch 'master' of https://github.com/apache/zeppelin into
py4jPythonInterpreter
commit af097ac95ce047cdf61498fc91c727bb805584c9
Author: astroshim <[email protected]>
Date: 2017-03-08T05:16:46Z
add testcase
commit f17bff45759143624be39fa8ec3fca959541c055
Author: astroshim <[email protected]>
Date: 2017-03-08T06:01:13Z
fix testcase failure.
commit 5ae5120615756ddae5be818433b1a595c3aa293d
Author: astroshim <[email protected]>
Date: 2017-03-08T08:10:32Z
fix interpreter-setting
commit cbbc15c3e3f2dc3bdd564c779de39813a3225751
Author: astroshim <[email protected]>
Date: 2017-03-08T08:35:29Z
fix py4j path
commit a50179e54f479fe0f999f14f34ed35d1c092cb13
Author: astroshim <[email protected]>
Date: 2017-03-08T17:05:39Z
add conda interpreter
commit 3c9585fe2a54f9fbcee2688e4bc42397147cfb83
Author: astroshim <[email protected]>
Date: 2017-03-08T17:26:07Z
update interpreter-setting.json
commit a48df58c6a832828cb50989d67f9b19b7cd498d4
Author: astroshim <[email protected]>
Date: 2017-03-08T17:27:03Z
Merge branch 'master' into py4jPythonInterpreter
commit 574bd2166b99b191ec6b75e2c12cb536b28cbbfb
Author: astroshim <[email protected]>
Date: 2017-03-08T17:32:39Z
fix interpreter-setting error
commit 60e982045fa52b1b93d62f49a4b93f2c319dfd5a
Author: astroshim <[email protected]>
Date: 2017-03-08T17:44:16Z
bug fix about copying library
commit e49ad246449b2095e350aa87bffacaf656fd615a
Author: astroshim <[email protected]>
Date: 2017-03-13T17:25:08Z
add pandas
commit 046db8816a6e8af2ed17c265cbfbeb8af3663931
Author: astroshim <[email protected]>
Date: 2017-03-14T14:06:17Z
add testcase
commit f8e19bef1a726504b358a74779fa3e129044fb82
Author: astroshim <[email protected]>
Date: 2017-03-14T15:10:52Z
fix matplotlib testcase
commit be5db4d5e9ffe789eaba44989a151f03d66ffd6b
Author: astroshim <[email protected]>
Date: 2017-03-15T02:55:31Z
fix pandas sql testcase
commit e8570d2b6d842051ab7046d16c70f66185299140
Author: astroshim <[email protected]>
Date: 2017-03-15T04:12:53Z
fix ci for pandassql
commit ac92cdb514f1f1b5e29ee34406a925c07ff89f41
Author: astroshim <[email protected]>
Date: 2017-03-15T04:43:46Z
fix python interpreter testcase
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---