Commit 0361df8c authored by Łukasz Nowak's avatar Łukasz Nowak

jupyter: Introduce ERP5 Cluster Kernel

The kernel uses ERP5 HAL interface to connect to ERP5 and Cluster Data
Notebook implementation, based on activities (each Jupter cell runs in
separate activity).
parent 6f33a9df
......@@ -39,6 +39,7 @@ eggs =
${seaborn:egg}
${statsmodels:egg}
patsy
uritemplate
# additional eggs for jupyterlab
jupyterlab
jupyterlab-launcher
......
This diff is collapsed.
......@@ -16,7 +16,7 @@
[instance-jupyter-notebook]
filename = instance.cfg.in
md5sum = 78625cff193d7fdadd57670d30bc9a0d
md5sum = 244eef461a688ee5ba18c677046822e8
[jupyter-notebook-config]
filename = jupyter_notebook_config.py.jinja
......@@ -30,10 +30,14 @@ md5sum = b8d31441780b524a7e52d1710dd78385
filename = ERP5kernel.py
md5sum = 7d5309fe79afbcb455c0d8181b42e56c
[erp5-cluster-kernel]
filename = ERP5ClusterKernel.py
md5sum = 27cb813251dfd081ef972846754cc315
[kernel-json]
filename = kernel.json.jinja
md5sum = 33547be93a67530165e079dc3ecfdac3
[custom-js]
filename = custom.js
md5sum = 40d938bb09261c65421a7725b40f87dc
md5sum = 4cb260554271145797d268bb5c0f2e4c
......@@ -83,7 +83,7 @@
$([Jupyter.events]).on('notebook_loaded.Notebook', function(){
var kernelname = Jupyter.notebook.kernel_selector.current_selection;
var display_text="<div class='output_subarea output_text output_result'>\
var display_text_erp5="<div class='output_subarea output_text output_result'>\
<pre>Follow these steps to customize your notebook with ERP5 kernel :-</br>\
1. Make sure you have 'erp5_data_notebook' business template installed in your ERP5</br>\
2. <b>%erp5_user &lt;your_erp5_username&gt;</b></br>\
......@@ -114,8 +114,18 @@ $([Jupyter.events]).on('notebook_loaded.Notebook', function(){
<b>WARNING:</b> it is not recommended to have too many setup functions in the environment, </br>\
because they will be executed in every code cell and can cause a substantial slow down.\
</pre></div>";
var display_text_erp5_cluster="<div class='output_subarea output_text output_result'>\
<pre>Follow these steps to setup your notebook with ERP5 cluster kernel :-</br>\
1. Make sure you have 'erp5_data_notebook' business template installed in your ERP5</br>\
2. <b>%erp5_user &lt;your_erp5_username&gt;</b></br>\
3. <b>%erp5_password &lt;your_erp5_password&gt;</b></br>\
Then you can start using the kernel.</br>\
</div>";
if (kernelname=="erp5"){
$('div#notebook-container').prepend(display_text);
$('div#notebook-container').prepend(display_text_erp5);
}
if (kernelname=="erp5cluster"){
$('div#notebook-container').prepend(display_text_erp5_cluster);
}
});
......@@ -7,6 +7,8 @@ parts =
jupyter-notebook-config
erp5-kernel
kernel-json
erp5-cluster-kernel
cluster-kernel-json
custom-js
monitor-base
extends =
......@@ -101,6 +103,7 @@ jupyter_runtime_dir = ${:jupyter_dir}/runtime
jupyter_custom_dir = ${:jupyter_config_dir}/custom
jupyter_nbextensions_dir = ${:jupyter_dir}/nbextensions
erp5_kernel_dir = ${:jupyter_kernel_dir}/ERP5
erp5_cluster_kernel_dir = ${:jupyter_kernel_dir}/ERP5Cluster
[jupyter_notebook]
# This part is called like this because knowledge0.write uses the part name for
......@@ -134,6 +137,11 @@ recipe = slapos.cookbook:symbolic.link
link-binary = {{ erp5_kernel_location }}/{{ erp5_kernel_filename }}
target-directory = ${directory:erp5_kernel_dir}
[erp5-cluster-kernel]
recipe = slapos.cookbook:symbolic.link
link-binary = {{ erp5_cluster_kernel_location }}/{{ erp5_cluster_kernel_filename }}
target-directory = ${directory:erp5_cluster_kernel_dir}
[kernel-json]
<= dynamic-jinja2-template-base
template = {{ kernel_json_location }}/{{ kernel_json_filename }}
......@@ -146,6 +154,18 @@ context =
raw display_name ERP5
raw language_name python
[cluster-kernel-json]
<= dynamic-jinja2-template-base
template = {{ kernel_json_location }}/{{ kernel_json_filename }}
rendered = ${directory:erp5_cluster_kernel_dir}/kernel.json
# Use python2.7 executable bin file for kernel config
context =
raw python_executable {{ python_executable }}
raw kernel_dir ${erp5-cluster-kernel:target-directory}/{{ erp5_cluster_kernel_filename }}
key erp5_url slapconfiguration:configuration.erp5-url
raw display_name ERP5Cluster
raw language_name python
[custom-js]
recipe = slapos.cookbook:symbolic.link
target-directory = ${directory:jupyter_custom_dir}
......
......@@ -30,6 +30,9 @@ mode = 0644
[erp5-kernel]
<= download-file-base
[erp5-cluster-kernel]
<= download-file-base
[kernel-json]
<= download-file-base
......@@ -53,6 +56,8 @@ context =
key jupyter_set_password_filename jupyter-set-password:filename
key erp5_kernel_location erp5-kernel:location
key erp5_kernel_filename erp5-kernel:filename
key erp5_cluster_kernel_location erp5-cluster-kernel:location
key erp5_cluster_kernel_filename erp5-cluster-kernel:filename
key kernel_json_location kernel-json:location
key kernel_json_filename kernel-json:filename
key custom_js_location custom-js:location
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment