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 = ...@@ -39,6 +39,7 @@ eggs =
${seaborn:egg} ${seaborn:egg}
${statsmodels:egg} ${statsmodels:egg}
patsy patsy
uritemplate
# additional eggs for jupyterlab # additional eggs for jupyterlab
jupyterlab jupyterlab
jupyterlab-launcher jupyterlab-launcher
......
This diff is collapsed.
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
[instance-jupyter-notebook] [instance-jupyter-notebook]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = 78625cff193d7fdadd57670d30bc9a0d md5sum = 244eef461a688ee5ba18c677046822e8
[jupyter-notebook-config] [jupyter-notebook-config]
filename = jupyter_notebook_config.py.jinja filename = jupyter_notebook_config.py.jinja
...@@ -30,10 +30,14 @@ md5sum = b8d31441780b524a7e52d1710dd78385 ...@@ -30,10 +30,14 @@ md5sum = b8d31441780b524a7e52d1710dd78385
filename = ERP5kernel.py filename = ERP5kernel.py
md5sum = 7d5309fe79afbcb455c0d8181b42e56c md5sum = 7d5309fe79afbcb455c0d8181b42e56c
[erp5-cluster-kernel]
filename = ERP5ClusterKernel.py
md5sum = 27cb813251dfd081ef972846754cc315
[kernel-json] [kernel-json]
filename = kernel.json.jinja filename = kernel.json.jinja
md5sum = 33547be93a67530165e079dc3ecfdac3 md5sum = 33547be93a67530165e079dc3ecfdac3
[custom-js] [custom-js]
filename = custom.js filename = custom.js
md5sum = 40d938bb09261c65421a7725b40f87dc md5sum = 4cb260554271145797d268bb5c0f2e4c
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
$([Jupyter.events]).on('notebook_loaded.Notebook', function(){ $([Jupyter.events]).on('notebook_loaded.Notebook', function(){
var kernelname = Jupyter.notebook.kernel_selector.current_selection; 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>\ <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>\ 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>\ 2. <b>%erp5_user &lt;your_erp5_username&gt;</b></br>\
...@@ -114,8 +114,18 @@ $([Jupyter.events]).on('notebook_loaded.Notebook', function(){ ...@@ -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>\ <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.\ because they will be executed in every code cell and can cause a substantial slow down.\
</pre></div>"; </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"){ 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 = ...@@ -7,6 +7,8 @@ parts =
jupyter-notebook-config jupyter-notebook-config
erp5-kernel erp5-kernel
kernel-json kernel-json
erp5-cluster-kernel
cluster-kernel-json
custom-js custom-js
monitor-base monitor-base
extends = extends =
...@@ -101,6 +103,7 @@ jupyter_runtime_dir = ${:jupyter_dir}/runtime ...@@ -101,6 +103,7 @@ jupyter_runtime_dir = ${:jupyter_dir}/runtime
jupyter_custom_dir = ${:jupyter_config_dir}/custom jupyter_custom_dir = ${:jupyter_config_dir}/custom
jupyter_nbextensions_dir = ${:jupyter_dir}/nbextensions jupyter_nbextensions_dir = ${:jupyter_dir}/nbextensions
erp5_kernel_dir = ${:jupyter_kernel_dir}/ERP5 erp5_kernel_dir = ${:jupyter_kernel_dir}/ERP5
erp5_cluster_kernel_dir = ${:jupyter_kernel_dir}/ERP5Cluster
[jupyter_notebook] [jupyter_notebook]
# This part is called like this because knowledge0.write uses the part name for # This part is called like this because knowledge0.write uses the part name for
...@@ -134,6 +137,11 @@ recipe = slapos.cookbook:symbolic.link ...@@ -134,6 +137,11 @@ recipe = slapos.cookbook:symbolic.link
link-binary = {{ erp5_kernel_location }}/{{ erp5_kernel_filename }} link-binary = {{ erp5_kernel_location }}/{{ erp5_kernel_filename }}
target-directory = ${directory:erp5_kernel_dir} 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] [kernel-json]
<= dynamic-jinja2-template-base <= dynamic-jinja2-template-base
template = {{ kernel_json_location }}/{{ kernel_json_filename }} template = {{ kernel_json_location }}/{{ kernel_json_filename }}
...@@ -146,6 +154,18 @@ context = ...@@ -146,6 +154,18 @@ context =
raw display_name ERP5 raw display_name ERP5
raw language_name python 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] [custom-js]
recipe = slapos.cookbook:symbolic.link recipe = slapos.cookbook:symbolic.link
target-directory = ${directory:jupyter_custom_dir} target-directory = ${directory:jupyter_custom_dir}
......
...@@ -30,6 +30,9 @@ mode = 0644 ...@@ -30,6 +30,9 @@ mode = 0644
[erp5-kernel] [erp5-kernel]
<= download-file-base <= download-file-base
[erp5-cluster-kernel]
<= download-file-base
[kernel-json] [kernel-json]
<= download-file-base <= download-file-base
...@@ -53,6 +56,8 @@ context = ...@@ -53,6 +56,8 @@ context =
key jupyter_set_password_filename jupyter-set-password:filename key jupyter_set_password_filename jupyter-set-password:filename
key erp5_kernel_location erp5-kernel:location key erp5_kernel_location erp5-kernel:location
key erp5_kernel_filename erp5-kernel:filename 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_location kernel-json:location
key kernel_json_filename kernel-json:filename key kernel_json_filename kernel-json:filename
key custom_js_location custom-js:location 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