Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ease-dev] Jupyter kernels

> Does anyone of you know of a better solution to this problem?

As Christian mentioned I think some more context may help to address this.

You can solve the issue of allocating ports though. Depending on who
is doing which part of the launching may affect this. For example when
launching Python from EASE I need unique ports in each direction. I
allocate first a port in Java, then launch Python, have Python
allocate the return direction port number and then Python calls back
into Java to notify it of the port.

Have a look of the current draft implementation of the Python engine
(using Py4J for comms):
https://git.eclipse.org/r/#/c/73149/7/plugins/org.eclipse.ease.lang.python.py4j/src/org/eclipse/ease/lang/python/py4j/internal/Py4jScriptEngine.java
In that you should be able to see that:
1. setupEngine starts the Java server side (setting java and python
ports to 0, meaning automatically allocate free port),
2. launches the Python process, passing the actually allocated port
3. waits for Python to notify it of the port in the other direction
(Python does this by calling back into Java method
pythonStartupComplete)

To allocate an unused port, use 0 when creating your socket, see
http://stackoverflow.com/questions/2675362/how-to-find-an-available-port
for a good example.

HTH,
Jonah
~~~
Jonah Graham
Kichwa Coders Ltd.
www.kichwacoders.com


On 29 May 2016 at 22:55, Martin Klösch <martin.kloesch@xxxxxxxxx> wrote:
> Hi,
>
> I've been working on launcher strategies for the EASE Jupyter kernels this
> week.
>
> The flow for launching Jupyter kernels is basically the opposite of what we
> want. To launch a new kernel, an executable is called with command line
> parameters, the most important of which specify the ports that will be used
> for communication. We would like to tell Jupyter which ports we are using as
> to have more control and be more customizable from within eclipse.
>
> I currently do not see an easy solution to this problem, so I decided to
> simply create a command line tool that will be called by Jupyter and
> dispatches the parameters over a socket to a running eclipse instance. This
> strategy has some downsides, the most obvious being that with this simple
> solution we can only have one eclipse instance running at a time.
>
> I would still like to keep this method for now as it allows me to continue
> with the actual implementation of the kernels. In the future it would be
> possible to dynamically add running eclipse instance to Jupyter using the
> same method but with different dispatching ports for each. This code would
> not be platform independent as Jupyter has different locations for its
> kernel information on each OS.
>
> Does anyone of you know of a better solution to this problem?
>
> Besides working on this topic, Tobias from the Science working group has
> given me his code regarding Jupyter clients in eclipse. I have been checking
> the code and it looks as if I could reuse some of it for the kernels as well
> (mostly zmq messaging). You can check out his code at:
> https://github.com/openanalytics/japyter
> https://github.com/openanalytics/jupyter-console
>
> Thanks again to him and the guys from the Science working group for the
> great collaboration. I think this project can help both teams and get EASE
> and eclipse even further...
>
> Best regards,
> Martin
>
>
> _______________________________________________
> ease-dev mailing list
> ease-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/ease-dev


Back to the top