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 get_project() or 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 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 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 its name#

A handle to a webapps settings 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#

Classes#

dataikuapi.dss.project.DSSProject(client, ...)

A handle to interact with a project on the DSS instance.

dataikuapi.dss.webapp.DSSWebApp(client, ...)

A handle for the webapp.

dataikuapi.dss.webapp.DSSWebAppBackendState(...)

A wrapper object holding the webapp backend state.

dataikuapi.dss.webapp.DSSWebAppListItem(...)

An item in a list of webapps.

dataikuapi.dss.webapp.DSSWebAppSettings(...)

A handle for the webapp settings.

Functions#

get_default_project()

Get a handle to the current default project, if available (i.e.

get_project(project_key)

Get a handle to interact with a specific project.

get_settings()

returns:

A handle for the webapp settings.

get_state()

returns:

A wrapper object holding the webapp backend state.

get_webapp(webapp_id)

Get a handle to interact with a specific webapp

list_webapps([as_type])

List the webapp heads of this project

save()

Save the current webapp settings.

start_or_restart_backend()

Start or restart the webapp backend.

stop_backend()

Stop the webapp backend.

to_webapp()

Convert the current item.