Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
lochner_louw
Participant
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 to ML Scenario Manager and TensorBoard 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:

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



  1. Create the Solution directory structure:
    user@home ~ % mkdir -p custom_tensorboard_solution/content/vsystem/{apps,icons}


  2. 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


  3. 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


  4. Get an icon for the project:
    user@home ~ % curl https://tensorboard.dev/static/tb_sharing_2.png -o \
    content/vsystem/icons/TensorBoard.png


  5. Display solution structure:
    user@home ~ % tree .                                                      
    .
    ├── content
    │   └── vsystem
    │       ├── apps
    │       │   └── tensorboard-app.json
    │       └── icons
    │           └── TensorBoard.png
    └── manifest.json

    4 directories, 3 files


  6. 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



  1. Find the Solution package tensorboard-app.zip created in the previous step.

  2. Add the Solution to your tenant as described in the official Manage Strategies documentation. The steps are:

    1. Log in as tenant administrator on your SAP Data Intelligence tenant.

    2. Open the System Management application.

    3. Go to Tenant, select Solutions, and click +.

    4. Choose the tensorboard-app.zip file in the file dialog and confirm.

    5. Go to the Strategies section and click Edit Pencil.
      Add the newly added tensorboard-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.

    6. The TensorBoard application will now show up in the launchpad of all users who have rights to start any application.




Create custom policies



  1. 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:

    1. Log in as tenant administrator on your SAP DI tenant.

    2. Open the Policy Management application.

    3. Create a new policy by clicking on +.

    4. Enter custom.tensorboard.start as the Policy Id and deselect the Exposed option. Add a new resource by clicking + and enter the app name tensorboard-app, click Okay and then Create.

    5. Create another policy by clicking on + once again.

    6. Enter custom.developer as the Policy Id, add the policy created in step 4 and click Create.

    7. Navigate to the System Management application.

    8. Go to Users, create a new user or select an existing user.

    9. Click on + and select the role created in step 6 and click Assign.




The user will now have access to start an instance of the TensorBoard application


 

Create a scenario in ML Scenario Manager



  1. Log in as an ML User on your SAP Data Intelligence tenant.

  2. Open the ML Scenario Manager application.

  3. Click Create, enter TensorBoard Sample in name and click Create.

  4. Navigate to the Notebooks section and click Create. In the dialog window, enter TensorBoard Test in name and click Create.

  5. Launch a terminal from the file menu and install TensorFlow by entering pip install tensorflow==1.15 in the terminal and pressing enter.

  6. Add sample code to notebook TensorBoard Test run each cell and click save 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)


  7. 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:
7 Comments