hopsworks.app #
App #
Represents a Hopsworks Python App.
Returned by
agent_chat_app property #
agent_chat_app: bool
Whether the app is an agent's own chat app (Agent.create_chat_app()), as opposed to an app of your own that reaches an agent.
agent_deployment_id property #
agent_deployment_id: int | None
The id of the agent deployment the app reaches, if it was created with agent= or is an agent's chat app; None otherwise.
cold_start_timeout_seconds property #
cold_start_timeout_seconds: int | None
Seconds the first request waits for the app to wake, when idle_scale_to_zero is set.
db_access property #
db_access: bool
Whether the app gets access to the project's online feature store database.
When True, the database is created on demand when the app starts and the MYSQL_* connection environment variables are injected into the app container. Trino access to the offline tables (TRINO_*) does not depend on this flag.
entrypoint_script property #
entrypoint_script: str | None
Configured Git-backed Streamlit entrypoint script.
git_auto_redeploy property #
git_auto_redeploy: bool
Whether the app is rolled to the branch HEAD when a new commit is pushed.
idle_cooldown_seconds property #
idle_cooldown_seconds: int | None
Seconds without a request before the app scales to zero, when idle_scale_to_zero is set.
idle_scale_to_zero property #
idle_scale_to_zero: bool
Whether the app scales to zero when idle.
The pod goes away once no request has been in flight for idle_cooldown_seconds, the app shows the IDLE state, and the next request brings the pod back, held for up to cold_start_timeout_seconds.
latest_branch property #
latest_branch: str | None
Branch the running clone resolved to.
Only set when no branch was configured, in which case this is the repository's default branch that the app actually checked out.
managed_db property #
managed_db: bool
Whether the app owns a registered set of tables in the project's online database.
Such an app connects as its own database user, which can read the project database but can only create and write tables registered with register_table. Apps created before table registration existed connect as the user who started them and have no registered tables.
proxy_path_mode property #
proxy_path_mode: str | None
ROOT when the proxy strips the browser mount before the app sees a request, PREFIX when it forwards it.
public_access property #
public_access: bool
Whether the app is publicly accessible without a Hopsworks login.
public_url property #
public_url: str | None
Public share URL.
None when the app is not public, or when the caller is not a data owner (only data owners receive the share token from the backend).
state property #
state: str
Current state of the app (RUNNING, IDLE, KILLED, FAILED, STOPPED, etc.).
IDLE is an app that scales to zero when idle and has no pod right now; opening it wakes it.
table_prefix property #
table_prefix: str | None
The prefix every table of the app must start with, for example app_reviews__; None when managed_db is False.
alter_table #
Change a table of the app, for example to add a column; the table stays on disk.
| PARAMETER | DESCRIPTION |
|---|---|
name | The table name, with or without the app's TYPE: |
alteration | What follows TYPE: |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the app does not own the table, if the alteration sets an engine, tablespace or storage, or if the database refuses it. |
create_table #
Create a table of the app in the project's online database, stored on disk in RonDB.
The app's database user cannot create or alter tables, so Hopsworks runs the CREATE TABLE, registering the table first. Hopsworks sets the engine, tablespace and STORAGE DISK; RonDB keeps primary-key and other indexed columns in memory. Creating a table that exists does nothing, so it is safe on every start.
| PARAMETER | DESCRIPTION |
|---|---|
name | The table name, with or without the app's TYPE: |
definition | The columns and indexes, as written inside the parentheses of TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
str | The full table name to use in SQL. |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the name is refused as by |
delete #
Delete the app entirely.
This stops the app if running and removes the job configuration.
get_logs #
Get stdout and stderr logs for the latest app execution.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, str] | Dictionary with |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.JobExecutionException | If the app has no execution. |
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when retrieving logs. |
get_table #
get_tables #
get_url #
get_url() -> str
Get URL to view the app in Hopsworks UI.
| RETURNS | DESCRIPTION |
|---|---|
str | The URL to the app page in the Hopsworks UI. |
make_private #
Revoke public access.
Every outstanding public link stops working immediately.
make_public #
make_public() -> str | None
Make this app reachable without a Hopsworks login.
| RETURNS | DESCRIPTION |
|---|---|
str | None |
|
Danger
Anyone with the link can use the app with the app's own credentials, data access, and secrets. This is not read-only access. Only data owners can enable it, and only when the administrator allows public apps.
preview_table #
redeploy #
Redeploy the app by rolling its Kubernetes deployment.
This stops the current running execution and starts a new one using the same app configuration and runtime parameters.
| PARAMETER | DESCRIPTION |
|---|---|
await_serving | If True, wait until the app is serving before returning. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
App | Self, with updated state. |
register_table #
Reserve a table name for the app in the project's online database, without creating the table.
The app's database user is granted the registered table only, and the table is dropped when the app is deleted. create_table registers the table too, so most apps only call that. Registering a table the app already owns does nothing, so it is safe on every start.
| PARAMETER | DESCRIPTION |
|---|---|
name | The table name, with or without the app's TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
str | The full table name to use in SQL. |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the name is not lowercase |
run #
Start the app.
Example
| PARAMETER | DESCRIPTION |
|---|---|
await_serving | If True, wait until the app is serving before returning. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
App | Self, with updated state. |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.JobExecutionException | If the app fails to start or the serving timeout is exceeded. |