Technical Articles
Extending SAP Data Intelligence Part 2: Packaging, deploying and running solution containing custom application
Just a side note – You will need to log a ticket to activate custom applications
on SAP Data Intelligence Cloud. I recently tried and found a bunch of errors when trying to active one. Please log ticket under CA-DI-OPS or CA-DI.
Introduction
This post documents the hands-on technical steps I followed during my journey of exploring extensibility of SAP Data Intelligence and is a continuation of my post titled “Extending SAP Data Intelligence Part 1: Configuring a Custom Solution for TensorBoard”. In the first post, I described how to develop the application descriptor and solution manifest file required to create a custom solution. As with the first post, take this as the result of personal experience and not as a “best practice” guide.
Prerequisites
- Access to an SAP Data Intelligence instance.
- SAP Data Intelligence (cloud edition) Version: 2006.1.8 was used in this post.
- You will need to have
admin
permissions on the SAP DI tenant to install the application and create custom policies. - To use
Jupyter Notebooks
you will need a user that has access toML Scenario Manager
andTensorBoard App
Overview
In this post, I will go through the steps of packaging, deploying a custom solution for SAP Data Intelligence. I also included animated GIFs that I created to visually explain where to go if you are not familiar with the UI.
At the time writing the post I noticed that it was a bit too lengthy to pack into a single post. For that reason, I split it into 2 separate posts to show what I did for my colleagues:
- Part 1: Configuring a Custom Solution for TensorBoard in SAP DI (previous post) and
- Part 2: Packaging, deploying and running solution containing the custom application (this post).
The environment to TensorBoard consists of the following systems and tools:
- SAP Data Intelligence
- ML Scenario Manager
- TensorBoard
- Tensorflow installed in Jupyter Lab
Create a deployable Solution
- Create the Solution directory structure:
user@home ~ % mkdir -p custom_tensorboard_solution/content/vsystem/{apps,icons}
- Create
manifest.json
:user@home ~ % cd custom_tensorboard_solution user@home ~ % cat << EOF > manifest.json { "name": "tensorboard-app", "version": "0.0.2", "format": "2", "dependencies": [] } EOF
- Create blank application descriptor and copy/paste descriptor from the previous article or download from a GitHub Gist link:
user@home ~ % touch content/vsystem/apps/tensorboard-app.json
- Get an icon for the project:
user@home ~ % curl https://tensorboard.dev/static/tb_sharing_2.png -o \ content/vsystem/icons/TensorBoard.png
- Display solution structure:
user@home ~ % tree . . ├── content │ └── vsystem │ ├── apps │ │ └── tensorboard-app.json │ └── icons │ └── TensorBoard.png └── manifest.json 4 directories, 3 files
- Create a solution package
user@home ~ % zip -r tensorboard-app.zip manifest.json content/
Alternatively, if you have the System Management Command-Line Client (vctl) installed then the packaging can be done as follows:
user@home ~ % vctl solution bundle custom_tensorboard_solution/
Deploy Custom Solution
- Find the Solution package
tensorboard-app.zip
created in the previous step. - Add the Solution to your tenant as described in the official Manage Strategies documentation. The steps are:
- Log in as
tenant administrator
on your SAP Data Intelligence tenant.
- Open the
System Management
application. - Go to
Tenant
, selectSolutions
, and click+
. - Choose the
tensorboard-app.zip
file in the file dialog and confirm. - Go to the
Strategies
section and clickEdit Pencil
.
Add the newly addedtensorboard-app
to the strategy and click save.
NOTE: In case you are not able to edit the strategy (edit button does not exist) you need to login to the SAP Data Intelligence system tenant and assign the solution to the strategy there.
- The
TensorBoard
application will now show up in the launchpad of all users who have rights to start any application.
- Log in as
Create custom policies
- Create the policies and user in your tenant as described in the official Manage Policies and Manage Users documentation. The steps to do this are:
- Log in as
tenant administrator
on your SAP DI tenant. - Open the
Policy Management
application. - Create a new policy by clicking on
+
. - Enter
custom.tensorboard.start
as thePolicy Id
and deselect theExposed
option. Add a new resource by clicking+
and enter the app nametensorboard-app
, clickOkay
and thenCreate
. - Create another policy by clicking on + once again.
- Enter
custom.developer
as thePolicy Id
, add the policy created in step 4 and clickCreate
. - Navigate to the
System Management
application. - Go to
Users
, create a new user or select an existing user. - Click on
+
and select the role created in step 6 and clickAssign
.
- Log in as
The user will now have access to start an instance of the TensorBoard application
Create a scenario in ML Scenario Manager
- Log in as an
ML User
on your SAP Data Intelligence tenant. - Open the
ML Scenario Manager
application. - Click
Create
, enterTensorBoard Sample
inname
and clickCreate
.
- Navigate to the Notebooks section and click
Create
. In the dialog window, enterTensorBoard Test
inname
and clickCreate
.
- Launch a terminal from the file menu and install TensorFlow by entering
pip install tensorflow==1.15
in the terminal and pressingenter
.
- Add sample code to notebook
TensorBoard Test
run each cell and clicksave icon
.
NOTE: I used a tutorial for TensorBoard code from this link to test if the app is working.# Import TensorFlow and show version import tensorflow as tf tf.__version__
import numpy as np X_train = (np.random.sample((10000,5))) y_train = (np.random.sample((10000,1))) X_train.shape feature_columns = [ tf.feature_column.numeric_column('x', shape=X_train.shape[1:])] DNN_reg = tf.estimator.DNNRegressor(feature_columns=feature_columns, # Indicate where to store the log file model_dir='/vhome/tf/train/linreg', hidden_units=[500, 300], optimizer=tf.train.ProximalAdagradOptimizer( learning_rate=0.1, l1_regularization_strength=0.001 ) ) # Train the estimator train_input = tf.estimator.inputs.numpy_input_fn( x={"x": X_train}, y=y_train, shuffle=False,num_epochs=None) DNN_reg.train(train_input,steps=3000)
- Click on the Quick Launch navigation for TensorBoard and see written logs.
Closing and further reading
It was a great experience exploring how to extend SAP Data Intelligence with custom solutions and applications. Creating and deploying is really easy once you understand the components and the steps in creating a Solution.
I hope you enjoyed this blog post and that it gives you a general understanding of components that are part of a custom solution and how to deploy a solution in SAP Data Intelligence. Let me know if you have questions or feedback in the comments section.
If you want more information about everything SAP Data Intelligence related I recommend the following:
- openSAP: SAP Data Intelligence for Enterprise AI
- openSAP: Freedom of Data with SAP Data Hub
- Official SAP Data Intelligence 3.0 Administration Guide
- Official SAP Data Intelligence Cloud Page
- SAP Data Intelligence: Git Workflow and CI/CD Process Blog by Christian Sengstock (@christian.sengstock)
- SAP Data Intelligence 3.0 Walkthrough Blog by Swapan Saha (@swapan.saha)
- Zen and the Art of SAP Data Intelligence. Episode 3: vctl, the hidden pearl you must know by Gianluca De Lorenzo (@gianlucadelorenzo)
Hello Lochner,
Thanks for the great read! Very informative.
I was wondering is the same possible to host a custom ReactJS app running on Node inside DI?
Hi Denish,
That is possible although I haven't tested it myself and will have to go through the changelogs to note any new restrictions on custom apps.
An easy way to do this is to create a DockerFile that encapsulates the app. (look at link for example of a ReactJS app that is Dockerized with NodeJS). You can then publish DockerFile on a public repo and then follow the setup from my blog post in part 1.
You can technically deploy anything that can run in Kubernetes on DI (with trial and error). The application descriptor file is essentially a Kubernetes deployment file.
Thank you for the reply Lochner!
Trial and Error is what I was doing till now :), will try publishing the DockerFile and then try and refer it in the deployment JSON file.
Will keep you posted and if it works.
Cheers and stay safe,
Dinesh
Hi Lochner Louw
I did try somethings out but with no luck. It would help us a lot if you could check this once and if it rings any familiar bells.
When I installed this solution in DI, I did get a new tile in DI for the app but when I launched it, a container would not be assigned to it, and the app failed with the below error,
This is the react-app.json descriptor file I am using
Hi Dinesh,
I took a look at your docker and compared the app descriptor file.
You need to do the following if you want to use the image you currently pushed:
I don't see npm installed in the container and I am not sure where you put the react app. Take a look at this link on React and Kubernetes before attempting it on DI.
Make sure you get the docker container working locally before trying again. This will mean that you need to bundle everything into a docker image. I would recommend looking more into Docker and Kubernetes and also check out SAP Data Intelligence: Git Workflow and CI/CD Process post by Christian Sengstock. The post links to a git repo that contains an example for running Code Server in DI. This will be more helpful on what the DockerFIle looks like.
Hi Dinesh,
I haven't come around in testing this but from what I've seen there may have been some changes in how the security works on Data Intelligence Cloud.
You need to log a ticket on the Launchpad to allow Third-Party apps now.
Check this link for reference.
Cheers