GitHub user Leemoonsoo opened a pull request:
https://github.com/apache/incubator-zeppelin/pull/763
[ZEPPELIN-713] Expand ResourceId and put InterpreterResult into ResourcePool
### What is this PR for?
ResourcePool is introduced by ZEPPELIN-619.
However, it didn't provide any automatic resource release on paragraph /
note removal unlike paragraph scope angular object which is quite helpful in
practical use.
This PR adds noteId and paragraphId to ResourceId, so resource can be
identified by noteId and paragraphId in addition to resourcePoolId and name.
By using informations in ResourceId, automatically release resource when
note / paragraph remove.
So now, it's possible to put InterpreterResult into the resource pool
safely, which might be useful for ZEPPELIN-374 and ZEPPELIN-533.
### What type of PR is it?
Improvement
### Todos
* [x] - Add noteId and paragraphId to ResourceId
* [x] - Release resource when note / paragraph remove
* [x] - Put InterpreterResult into resource pool
* [x] - Unit test
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-713
### How should this be tested?
You can get resourcePool from InterpreterContext and print items inside of
spark interpreter. (note. resource pool is not spark interpreter specific
feature. But so far spark interpreter provides user api to access it)
You can see InterpreterResult is automatically shared to resourcePool and
they're removed on note/paragraph remove.
```
%md
hello world
%spark
// print items in resource pool.
import collection.JavaConversions._
val pool = z.getInterpreterContext.getResourcePool
pool.getAll.foreach(i=>println(i + " " + i.get))
```
### Screenshots (if appropriate)
### 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/Leemoonsoo/incubator-zeppelin ZEPPELIN-713
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-zeppelin/pull/763.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 #763
----
commit 11d138cc632bcf26b419c66b8468e3bdc825c9fe
Author: Lee moon soo <[email protected]>
Date: 2016-03-05T06:08:19Z
Remove resource on note / paragraph removal
commit b2e4fcc9e2002a431e0bf167e15474c198df8632
Author: Lee moon soo <[email protected]>
Date: 2016-03-05T06:38:07Z
put interpreter result into resource pool
----
---
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.
---