-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: install openmpp as jupyterlab service * fix: generate dockerfiles * chore: trigger auto-deploy * fix: copy oms startup script * fix: copy script in correct docker bit * fix: make script executable * fix: update openm version, fix config * fix: sync issue * fix: prepare openmpp config for prod deployment * fix: move config to start-oms script
- Loading branch information
Showing
43 changed files
with
1,345 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
output/docker-stacks-datascience-notebook/jupyter-ompp-proxy/jupyter_ompp_proxy/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
import logging | ||
|
||
logger = logging.getLogger(__name__) | ||
logger.setLevel("INFO") | ||
|
||
def setup_ompp(): | ||
|
||
def _get_cmd(): | ||
|
||
return [ | ||
"bash", | ||
"-c", | ||
"/usr/local/bin/start-oms.sh" | ||
] | ||
|
||
def _rewrite_response(response): | ||
if 'Location' in response.headers: | ||
response.headers['Location'] = response.headers['Location'].replace('/SASStudio', os.environ.get('NB_PREFIX') + '/sasstudio/SASStudio') | ||
|
||
return { | ||
"command": _get_cmd, | ||
"timeout": 60, | ||
"port": 4040, | ||
"launcher_entry": { | ||
"title": "OpenM++", | ||
"icon_path": os.path.join(os.getenv("OMPP_INSTALL_DIR", None), "html", "icons", "openmpp.svg"), | ||
}, | ||
"rewrite_response": _rewrite_response, | ||
} |
23 changes: 23 additions & 0 deletions
23
output/docker-stacks-datascience-notebook/jupyter-ompp-proxy/setup.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
name="jupyter-ompp-proxy", | ||
version='0.0.1', | ||
url="https://github.com/StatCan/jupyter-ompp-proxy", | ||
author="Her Majesty The Queen In Right of Canada", | ||
description="Jupyter extension to proxy OpenM++ webui", | ||
packages=setuptools.find_packages(), | ||
keywords=['SAS'], | ||
classifiers=['Framework :: Jupyter'], | ||
install_requires=[ | ||
'jupyter-server-proxy>=3.2.0' | ||
], | ||
entry_points={ | ||
'jupyter_serverproxy_servers': [ | ||
'ompp = jupyter_ompp_proxy:setup_ompp' | ||
] | ||
}, | ||
# package_data={ | ||
# 'jupyter_sasstudio_proxy': ['icons/sasstudio.svg'], | ||
# }, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# It does: | ||
# ulimit -S -s 65536 | ||
# OM_ROOT=${OM_ROOT} bin/oms -oms.Listen http://localhost:${OMS_PORT} -oms.HomeDir models/home -oms.AllowDownload -oms.AllowUpload -oms.AllowMicrodata -oms.LogRequest | ||
# | ||
# Environment: | ||
# OM_ROOT - openM++ root folder, default: current directory | ||
# OMS_PORT - oms web-service port to listen, default: 4040 | ||
|
||
# set -e | ||
set -m | ||
|
||
# large models may require stack limit increase | ||
# | ||
ulimit -S -s 65536 | ||
status=$? | ||
|
||
if [ $status -ne 0 ] ; | ||
then | ||
echo "FAILED to set: ulimit -S -s 65536" | ||
echo -n "Press Enter to exit..." | ||
read any | ||
exit $status | ||
fi | ||
|
||
# set openM++ root folder | ||
# | ||
self=$(basename $0) | ||
|
||
OM_ROOT="$OMPP_INSTALL_DIR" | ||
|
||
[ "$OM_ROOT" != "$PWD" ] && pushd $OM_ROOT | ||
|
||
# allow to use $MODEL_NAME.ini file in UI for model run | ||
# | ||
export OM_CFG_INI_ALLOW=true | ||
export OM_CFG_INI_ANY_KEY=true | ||
export OMS_URL=${JUPYTER_SERVER_URL}ompp | ||
|
||
# OpenM++ default configuraton | ||
if [[ "$KUBERNETES_SERVICE_HOST" =~ ".131." ]]; then | ||
#DEV | ||
export OMS_MODEL_DIR=/home/jovyan/models | ||
export OMS_HOME_DIR=/home/jovyan/ | ||
else | ||
if [ -d "/etc/protb" ]; then | ||
export OMS_MODEL_DIR=/home/jovyan/buckets/aaw-protected-b/microsim/models | ||
export OMS_HOME_DIR=/home/jovyan/buckets/aaw-protected-b/microsim/ | ||
else | ||
export OMS_MODEL_DIR=/home/jovyan/buckets/aaw-unclassified/microsim/models | ||
export OMS_HOME_DIR=/home/jovyan/buckets/aaw-unclassified/microsim/ | ||
fi | ||
fi | ||
|
||
# start oms web-service | ||
# | ||
[ -z "$OMS_PORT" ] && OMS_PORT=4040 | ||
|
||
echo "OM_ROOT=$OM_ROOT" | ||
echo "OMS_PORT=$OMS_PORT" | ||
echo "OMS_URL=$OMS_URL" | ||
|
||
echo "OMS_MODEL_DIR=$OMS_MODEL_DIR" | ||
if [ ! -d $OMS_MODEL_DIR ]; then | ||
mkdir -p $OMS_MODEL_DIR | ||
fi | ||
|
||
echo "OMS_HOME_DIR=$OMS_HOME_DIR" | ||
if [ ! -d $OMS_HOME_DIR ]; then | ||
mkdir -p $OMS_HOME_DIR | ||
fi | ||
|
||
OM_ROOT=$OM_ROOT ./bin/oms -l localhost:${OMS_PORT} -oms.ModelDir ${OMS_MODEL_DIR} -oms.HomeDir ${OMS_HOME_DIR} -oms.AllowDownload -oms.AllowUpload -oms.AllowMicrodata -oms.LogRequest | ||
status=$? | ||
|
||
if [ $status -ne 0 ] ; | ||
then | ||
[ $status -eq 130 ] && echo " oms web-service terminated by Ctrl+C" | ||
[ $status -ne 130 ] && echo " FAILED to start oms web-service" | ||
fi | ||
|
||
echo "." | ||
echo -n "Press Enter to exit..." | ||
read any | ||
exit $status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
output/jupyterlab-cpu/jupyter-ompp-proxy/jupyter_ompp_proxy/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
import logging | ||
|
||
logger = logging.getLogger(__name__) | ||
logger.setLevel("INFO") | ||
|
||
def setup_ompp(): | ||
|
||
def _get_cmd(): | ||
|
||
return [ | ||
"bash", | ||
"-c", | ||
"/usr/local/bin/start-oms.sh" | ||
] | ||
|
||
def _rewrite_response(response): | ||
if 'Location' in response.headers: | ||
response.headers['Location'] = response.headers['Location'].replace('/SASStudio', os.environ.get('NB_PREFIX') + '/sasstudio/SASStudio') | ||
|
||
return { | ||
"command": _get_cmd, | ||
"timeout": 60, | ||
"port": 4040, | ||
"launcher_entry": { | ||
"title": "OpenM++", | ||
"icon_path": os.path.join(os.getenv("OMPP_INSTALL_DIR", None), "html", "icons", "openmpp.svg"), | ||
}, | ||
"rewrite_response": _rewrite_response, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
name="jupyter-ompp-proxy", | ||
version='0.0.1', | ||
url="https://github.com/StatCan/jupyter-ompp-proxy", | ||
author="Her Majesty The Queen In Right of Canada", | ||
description="Jupyter extension to proxy OpenM++ webui", | ||
packages=setuptools.find_packages(), | ||
keywords=['SAS'], | ||
classifiers=['Framework :: Jupyter'], | ||
install_requires=[ | ||
'jupyter-server-proxy>=3.2.0' | ||
], | ||
entry_points={ | ||
'jupyter_serverproxy_servers': [ | ||
'ompp = jupyter_ompp_proxy:setup_ompp' | ||
] | ||
}, | ||
# package_data={ | ||
# 'jupyter_sasstudio_proxy': ['icons/sasstudio.svg'], | ||
# }, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.