Analytical Applications

This topic describes how to use an ML workspace to create long-running web applications.

About this task:

This feature gives data scientists a way to create ML web applications/dashboards and easily share them with other business stakeholders. Applications can range from single visualizations embedded in reports, to rich dashboard solutions such as Tableau. They can be interactive or non-interactive.

Applications stand alongside other existing forms of workloads in CML (sessions, jobs, experiments, models). Like all other workloads, applications must be created within the scope of a project. Each application is launched within its own isolated engine. Additionally, like models, engines launched for applications do not time out automatically. They will run as long as the web application needs to be accessible by any users and must be stopped manually when needed.

Before you begin:

Testing applications before you deploy

Before you deploy an application using the steps described here, make sure your application has been thoroughly tested. You can use sessions to develop, test, and debug your applications. You can test web apps by embedding them in sessions as described here: https://docs.cloudera.com/machine-learning/1.4.1/projects/topics/ml-embedded-web-apps.html.

  1. Go to a project's Overview page.
  2. Click Applications.
  3. Click New Application.
  4. Fill out the following fields.
    • Name: Enter a name for the application.
    • Subdomain: Enter a subdomain that will be used to construct the URL for the web application. For example, if you use test-app as the subdomain, the application will be accessible at test-app.<ml-workspace-domain-name>.

      Subdomains should be valid DNS hostname characters: letters from a to z, digits from 0 to 9, and the hyphen.

    • Description: Enter a description for the application.
    • Script: Select a script that hosts a web application on either CDSW_READONLY_PORT or CDSW_APP_PORT. Applications running on either of these ports are available to any users with at least read access to the project. The Python template project includes an entry.py script that you can use to test this out.
    • Engine Kernel and Resource Profile: Select the kernel and computing resources needed for this application.

    • Set Environment Variables: Click Set Environment Variables, enter the name and value for the new application variable, and click Add.

      If there is a conflict between the project-level and application-level environment variables, the application-level environment variables override the project-level environment variables.

  5. Click Create Application.

To create an application using the API, refer to this example:

Here is an example of using the Application API.

application_request = cmlapi.CreateApplicationRequest(
     name = "application_name",
     description = "application_description",
     project_id = project_id,
     subdomain = "application-subdomain",
     kernel = "python3",
     script = "entry.py",
     environment = {"KEY": "VAL"}
)
app = client.create_application(
     project_id = project_id,
     body = application_request
)

Results:

In a few minutes, you should see the application status change to Running on the Applications page. Click on the name of the application to access the web application interface.

What to do next:

You can Stop, Restart, or Delete an application from the Applications page.

If you want to make changes to an existing application, click Overview under the application name. Then go to the Settings tab to make any changes and update the application.