Webapps

The webapps API can control all aspects of managing a webapp.

Example use cases

In all examples, project is a dataikuapi.dss.project.DSSProject handle, obtained using client.get_project() or client.get_default_project()

List the webapps of a project and get a handle for the first one.

By default, list_webapps() returns a list of dict items describing the webapps of a project. From the dict item, the dataikuAPI.dss.webapp.DSSWebApp handle can be obtained using the to_webapp() method. Documentation of the list_webapps() and get_webapp() methods can be found in the API projects documentation.

project_webapps = project.list_webapps()
my_webapp_dict = project_webapps[0]
print("Webapp name : %s" % my_webapp_dict["name"])
print("Webapp id : %s" % my_webapp_dict["id"])
my_webapp = project_webapps[0].to_webapp()

Get a webapp by id. Check if the webapp is running, and if not, start it.

A handle to a webapps state dataikuAPI.dss.webapp.DSSWebAppBackendState object can be obtained using the get_state() method.

my_webapp = project.get_webapp(my_webapp_id)
if (not my_webapp.get_state().running):
    my_webapp.start_or_restart_backend()

Stop a webapp backend.

my_webapp = project.get_webapp(my_webapp_id)
my_webapp.stop_backend()

Get the settings of a webapp to change the it’s name.

A handle to a webapps settings dataikuAPI.dss.webapp.DSSWebAppSettings object can be obtained using the get_settings() method.

my_webapp = project.get_webapp(my_webapp_id)
settings = my_webapp.get_settings()
print("Current webapp name : %s" % settings.data["name"])
settings.data["name"] = "new webapp name"
print("New webapp name : %s" % settings.data["name"])
settings.save()

Reference documentation

class dataikuapi.dss.webapp.DSSWebApp(client, project_key, webapp_id)

A handle to manage a webapp

get_state()

Return the backend state of the webapp :return: the state of the webapp :rtype: DSSWebAppBackendState

stop_backend()

Stop the backend of the webapp

start_or_restart_backend()

Restart the backend of the webapp :returns: a handle to a DSS future to track the progress of the restart :rtype: dataikuapi.dss.future.DSSFuture

get_settings()

Returns the settings of the webapp

Return type

DSSWebAppSettings

class dataikuapi.dss.webapp.DSSWebAppBackendState(webapp_id, state)

An object holding the state of the backend of a webapp

property state
property running
class dataikuapi.dss.webapp.DSSWebAppSettings(client, webapp, data)

A handle to manage a WebApp definition

get_raw()
save()

Save the current webapp settings and update it.

class dataikuapi.dss.webapp.DSSWebAppListItem(client, data)

An item in a list of webapps. Do not instantiate this class, use :meth:`dataikuapi.dss.project.DSSProject.list_webapps

to_webapp()

Gets the DSSWebApp corresponding to this webapp

property id
property name