utils.rcclient.entities.dataapp
This module defines a dataclass for Dataapp, which represents a data application in the RC platform. It also defines two other dataclasses:
DataappParam and DataappParamMetadata, which represent the parameters and metadata for a Dataapp parameters, respectively.
The Dataapp class has several attributes such as name, app_type, display_name, description, url, zipped_code_loc, local_code_loc, is_global, requirements, params, cores, mem_in_mbs, disk_in_gbs, env_type, and _id. It has various class and instance methods to create, find, publish and launch a Dataapp.
The DataappParamMetadata class defines the metadata for a parameter, such as input_name, is_required, tooltip, default_value, and multiple. The DataappParam class defines a parameter for a Dataapp and includes a reference to its metadata.
Overall, this module provides a convenient and extensible way to interact with Dataapps in the RC platform.
Module Contents
Classes
Dataapp represents a data application that can be published and launched. |
Attributes
- utils.rcclient.entities.dataapp.logger
- class utils.rcclient.entities.dataapp.DataappConfig
- property file_path
- name: str
- dl_id: str
- tenant_id: str
- project_id: str
- scenario_id: str
- classmethod from_(res_dto: utils.rcclient.dtos.response_dtos.DataAppConfigResponseDto)
- class utils.rcclient.entities.dataapp.Dataapp
Dataapp represents a data application that can be published and launched. :param name: The name of the data application. :type name: str :param app_type: The type of the data application. :type app_type: AppType :param display_name: The display name of the data application.
Defaults to None.
- Parameters:
description (str, optional) – The description of the data application. Defaults to None.
url (str, optional) – The URL of the data application. Defaults to None.
zipped_code_loc (str, optional) – The location of the zipped code of the data application. Defaults to None.
local_code_loc (str, optional) – The local location of the code of the data application. Defaults to None.
is_global (bool, optional) – Whether the data application is global or not. Defaults to False.
requirements (str, optional) – The requirements of the data application. Defaults to None.
params (List[DataappParam], optional) – The parameters of the data application. Defaults to an empty list.
cores (int, optional) – The number of cores required for the data application. Defaults to None.
mem_in_mbs (int, optional) – The amount of memory in megabytes required for the data application. Defaults to None.
disk_in_gbs (int, optional) – The amount of disk space in gigabytes required for the data application. Defaults to None.
env_type (EnvType, optional) – The type of environment required for the data application. Defaults to EnvType.EXTRA_SMALL.
_id (str, optional) – The ID of the data application. Defaults to None.
- name: str
- project_id: str
- app_template_id: str
- scenario_id: str
- display_name: str
- dl_id: str
- dl_id: str
- description: str
- url: str
- params: Dict[str, str]
- metadata: Dict[str, str]
- cores: int
- mem_in_mbs: int
- disk_in_gbs: int
- env_type: utils.rc.dtos.env.EnvType
- tenant_id: str
- group_id: str
- launch_status: utils.rcclient.enums.LaunchStatus
- _id: str
- slug: str
- _dataapp_service: ClassVar[utils.rcclient.services.dataapp_service.DataAppService]
- _app_template_service: ClassVar[utils.rcclient.services.app_template_service.AppTemplateService]
- classmethod from_(res: utils.rcclient.dtos.response_dtos.DataAppResponseDto) Dataapp
- classmethod mark_dataapp_accessed(_id: str)
Mark a DataApp as accessed in the system. This class method updates the accessed status of the DataApp identified by the provided ID. It is typically used to track when a user accesses a DataApp. :param _id: The ID of the DataApp to be marked as accessed. :type _id: str
- Returns:
None
- classmethod create(name: str, app_template_id: str, project_id: str, _id: str = None, display_name: str = None, dl_id: str = None, description: str = None, logo: str = None, params: Dict[str, str] = {}, metadata: Dict[str, str] = {}, env_type: utils.rc.dtos.env.EnvType = EnvType.EXTRA_SMALL, cores: int = None, mem_in_mbs: int = None, disk_in_gbs: int = None, scenario_id: str = None, pages: Dict[str, str] = {}, group_id: str = None, slug: str = None) Dataapp
Creates a new instance of the Dataapp class with the given parameters. :param name: The name of the data app. :type name: str :param display_name: The display name of the data app.
Defaults to None.
- Parameters:
description (str, optional) – The description of the data app. Defaults to None.
project_id (str, optional) – The project_id of the data app. Defaults to None.
app_type (AppType, optional) – The type of the data app. Defaults to AppType.STREAMLIT.
params (List[DataappParam], optional) – The parameters of the data app. Defaults to [].
env_type (EnvType, optional) – The environment type of the data app. Defaults to EnvType.EXTRA_SMALL.
- Returns:
A new instance of the Dataapp class.
- Return type:
- classmethod fetch_config(dl_id: str)
- classmethod get_or_create(name: str, app_template_id: str, project_id: str = None, display_name: str = None, dl_id: str = None, description: str = None, logo: str = None, params: Dict[str, str] = {}, metadata: Dict[str, str] = {}, env_type: utils.rc.dtos.env.EnvType = EnvType.EXTRA_SMALL, cores: int = None, mem_in_gbs: int = None, disk_in_gbs: int = 20, scenario_id: str = None, pages: Dict[str, str] = {}, group_id: str = None, slug: str = None) Dataapp
Creates a new instance of the Dataapp class with the given parameters. :param name: The name of the data app. :type name: str :param display_name: The display name of the data app.
Defaults to None.
- Parameters:
description (str, optional) – The description of the data app. Defaults to None.
project_id (str, optional) – The project_id of the data app. Defaults to None.
app_type (AppType, optional) – The type of the data app. Defaults to AppType.STREAMLIT.
params (List[DataappParam], optional) – The parameters of the data app. Defaults to [].
env_type (EnvType, optional) – The environment type of the data app. Defaults to EnvType.EXTRA_SMALL.
- Returns:
A new instance of the Dataapp class.
- Return type:
- classmethod find_by_name(name: str)
Finds a Dataapp instance with the specified name. :param name: A string representing the name of the Dataapp to find. :param is_global: A boolean indicating whether to search for the Dataapp
globally or locally.
- Returns:
A Dataapp instance with the specified name.
- Raises:
ValueError – If a Dataapp with the specified name cannot be found.
- add_page(name: str, path: str)
- add_logo(path: str)
- save()
- launch(live_logs=True)
Launches the data app. This method calls the webapp which launches the dataapp for the same tenant. Once launched the dataapp can be accessed via following url scheme:
/dataapps/<app_template_name>-<tenant_id>
- delete()
- stop()
Stop the DataApp. This method stops the execution of the DataApp. :returns: None
- get_logs()
Get logs for the DataApp. This method retrieves the logs associated with the DataApp. :returns: None
- check_resource_usage()
- launch_dev_mode(test_id=None, start_server=True, app_template=None)
Launch the application in development mode. This method allows the user to launch the application in development mode. Development mode enables features like hot-reloading for faster development and testing. :param test_id: The ID of the test to be used during development (default is None). :type test_id: str, optional :param If provided: :param the application will be launched with the specified test configuration.: :param start_server: Whether to start the server during development (default is False). :type start_server: bool, optional :param If True: :param the server will be started: :param allowing the application to be accessed via a web browser.: :param app_template: The path to a custom application template to be used during development (default is None). :type app_template: str, optional :param If provided: :param this template will be used to render the application during development.:
- Returns:
None
- stop_dev_mode()
Stop the application’s development mode. This method stops the application’s development mode, if it was previously launched. :returns: None