Skip to content

On-premise users: click in-app to access the full platform documentation for your version of DataRobot.

Host custom applications with DRApps

DRApps is a simple command line interface (CLI) providing the tools required to host a custom application, such as a Streamlit app, in DataRobot using a DataRobot execution environment. This allows you to run apps without building your own Docker image. Custom applications don't provide any storage; however, you can access the full DataRobot API and other services. Alternatively, you can upload an AI App (Classic) or a custom application (NextGen) in a Docker container.

Paused custom applications

Custom applications are paused after a period of inactivity. The first time you access a paused custom application, a loading screen appears while it restarts.

Install the DRApps CLI tool

To install the DRApps CLI tool, run either of the following commands:

pip install git+https://github.com/datarobot/dr-apps

First, clone the dr-apps repository, then, run:

python setup.py install

Use the DRApps CLI

After you install the DRApps CLI tool, you can use the drapps --help command to access the following information:

$ drapps --help
Usage: drapps [OPTIONS] COMMAND [ARGS]...

CLI tools for custom applications.

You can use drapps COMMAND --help for getting more info about command.

Options:
  --help  Show this message and exit.

Commands:
  create     Creates new custom application from docker image or base...
  logs       Provides logs for custom application.
  ls         Provides list of custom applications or execution environments.
  terminate  Stops custom application and removes it from the list.

Additionally, you can use --help for each command listed on this page.

create command

Creates a new custom application from a Docker image or base environment. If the application is created from a project folder, the custom application image is created or the existing application is updated. For more information, use the drapps create --help command:

$ drapps create --help
Usage: drapps create [OPTIONS] APPLICATION_NAME

  Creates a new custom application from a Docker image or base environment.

Options:
  -t, --token TEXT      Pubic API access token. You can use
                        DATAROBOT_API_TOKEN env instead.
  -E, --endpoint TEXT   DataRobot Public API endpoint. You can use
                        DATAROBOT_ENDPOINT instead. Default:
                        https://app.datarobot.com/api/v2
  -e, --base-env TEXT   Name or ID for execution environment.
  -p, --path DIRECTORY  Path to folder with files that should be uploaded.
  -i, --image FILE      Path to tar archive with custom application docker
                        images.
  --skip-wait           Do not wait for ready status.
  --help                Show this message and exit.

More detailed descriptions for each argument are provided in the table below:

Argument Description
APPLICATION_NAME Enter the name of your custom application. This name is also used to generate the name of the custom application image, adding the Image suffix.
--token Enter your API Key, found on the Developer Tools page of your DataRobot account.
You can also provide your API Key using the DATAROBOT_API_TOKEN environment variable.
--endpoint Enter the URL for the DataRobot Public API. The default value is https://app.datarobot.com/api/v2.
You can also provide the URL to Public API using the DATAROBOT_ENDPOINT environment variable.
--base-env Enter the UUID or name of execution environment used as base for your Streamlit app. The execution environment contains the libraries and packages required by your application. You can find list of available environments in the Custom Model Workshop on the Environments page.
For a custom Streamlit application, use --base-env '[DataRobot] Python 3.9 Streamlit'.
--path Enter the path to a folder used to create the custom application. Files from this folder are uploaded to DataRobot and used to create the custom application image. The custom application is started from this image.
To use the current working directory, use --path ..
--image Enter the path to an archive containing an application docker image.
You can save your docker image to file with the docker save <image_name> > <file_name>.tar command.
--skip-wait Enables exiting the script immediately after the application creation request is sent, without waiting until the application setup completes.

logs command

Returns the logs generated for a custom application. For more information, use the drapps logs --help command:

$ drapps logs --help
Usage: drapps logs [OPTIONS] APPLICATION_ID_OR_NAME

  Provides logs for custom application.

Options:
  -t, --token TEXT     Pubic API access token. You can use
                       DATAROBOT_API_TOKEN env instead.
  -E, --endpoint TEXT  DataRobot Public API endpoint. You can use
                       DATAROBOT_ENDPOINT instead. Default:
                       https://app.datarobot.com/api/v2
  -f, --follow         Output append data as new log records appear.
  --help               Show this message and exit.
Argument Description
APPLICATION_ID_OR_NAME Enter the ID or the name of an application for which you want to view the logs.
--token Enter your API Key, found on the Developer Tools page of your DataRobot account.
You can also provide your API Key using the DATAROBOT_API_TOKEN environment variable.
--endpoint Enter the URL for the DataRobot Public API. The default value is https://app.datarobot.com/api/v2.
You can also provide the URL to Public API using the DATAROBOT_ENDPOINT environment variable.
--follow Enables the script to continue checking for new log records to display as they appear.

ls command

Returns a list of custom applications or execution environments. For more information, use the drapps ls --help command:

$ drapps ls --help
Usage: drapps ls [OPTIONS] {apps|envs}

  Provides list of custom applications or execution environments.

Options:
  -t, --token TEXT     Pubic API access token. You can use
                       DATAROBOT_API_TOKEN env instead
  -E, --endpoint TEXT  DataRobot Public API endpoint. You can use
                       DATAROBOT_ENDPOINT instead. Default:
                       https://app.datarobot.com/api/v2
  --id-only            Output only ids
  --help               Show this message and exit.
Argument Description
--token Enter your API Key, found on the Developer Tools page of your DataRobot account.
You can also provide your API Key using the DATAROBOT_API_TOKEN environment variable.
--endpoint Enter the URL for the DataRobot Public API. The default value is https://app.datarobot.com/api/v2.
You can also provide the URL to Public API using the DATAROBOT_ENDPOINT environment variable.
--id-only Enables showing only the IDs of the entity.
This command can be useful with piping to terminate the command.

terminate command

Stops the custom application and removes it from the applications list. For more information, use the drapps terminate --help command:

$ drapps terminate --help
Usage: drapps terminate [OPTIONS] APPLICATION_ID_OR_NAME...

  Stops custom application and removes it from the list.

Options:
  -t, --token TEXT     Pubic API access token. You can use
                       DATAROBOT_API_TOKEN env instead
  -E, --endpoint TEXT  DataRobot Public API endpoint. You can use
                       DATAROBOT_ENDPOINT instead. Default:
                       https://app.datarobot.com/api/v2.
  --help               Show this message and exit.
Argument Description
APPLICATION_ID_OR_NAME Enter a space separated list of IDs or names of the applications to be removed.
--token Enter your API Key, found on the Developer Tools page of your DataRobot account.
You can also provide your API Key using the DATAROBOT_API_TOKEN environment variable.
--endpoint Enter the URL for the DataRobot Public API. The default value is https://app.datarobot.com/api/v2.
You can also provide the URL to Public API using the DATAROBOT_ENDPOINT environment variable.

Deploy an example app

First, clone the dr-apps repository so you can access example apps. You can then deploy an example Streamlit app using the following command from the root of the dr-apps repository:

drapps create -t <your_api_token> -e "[Experimental] Python 3.9 Streamlit" -p ./examples/demo-streamlit DemoApp

This example script works as follows:

  1. Finds the execution environment through the /api/v2/executionEnvironments/ endpoint by the name or UUID you provided, verifying if the environment can be used for the custom application and retrieving the ID of the latest environment version.

  2. Finds or creates the custom application image through the /api/v2/customApplicationImages/ endpoint, named by adding the Image suffix to the provided application name (i.e., CustomApp Image).

  3. Creates a new version of a custom application image through the customApplicationImages/<appImageId>/versions endpoint, uploading all files from the directory you provided and setting the execution environment version defined in the first step.

  4. Starts a new application with the custom application image version created in the previous step.

When this script runs successfully, a link to the app on the Applications tab appears in the terminal.

Application access

To access the application, you must be logged into the DataRobot instance and account associated with the application.

Feature considerations

Consider the following when creating a custom app:

  • The root directory of the custom application must contain a start-app.sh file, used as the entry point for starting your application server.

  • The web server of the application must listen on port 8080.

  • The required packages can be listed in a requirements.txt file in the application's root directory for automatic installation during application setup.

  • The application should authenticate with the DataRobot API through the DATAROBOT_API_TOKEN environment variable using a key found in the DataRobot Developer Tools. The DataRobot package on PyPi already authenticates this way. This environment variable is added automatically to your running container by the custom apps service.

  • The application should access the DataRobot Public API URL for the current environment through the DATAROBOT_ENDPOINT environment variable. The DataRobot package on PyPi already uses this route. This environment variable is added automatically to your running container by the custom apps service.


Updated March 26, 2024