Skip to content

Alerts API#

AlertsApi #

Alerts API handle.

To obtain an object of this type, use project.get_alerts_api().

create_alert_receiver #

create_alert_receiver(
    name: str,
    email_configs: list[alert_receiver.EmailConfig]
    | None = None,
    slack_configs: list[alert_receiver.SlackConfig]
    | None = None,
    pagerduty_configs: list[alert_receiver.PagerDutyConfig]
    | None = None,
    webhook_configs: list[alert_receiver.WebhookConfig]
    | None = None,
) -> alert_receiver.AlertReceiver

Create a new alert receiver.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

new_alert_receiver = alerts_api.create_alert_receiver(name="email", email_configs=[{"to": "email@mail.com"}])
PARAMETER DESCRIPTION
name

The name of the alert receiver (e.g., email, webhook).

TYPE: str

email_configs

List of email configurations.

TYPE: list[alert_receiver.EmailConfig] | None DEFAULT: None

slack_configs

List of Slack configurations.

TYPE: list[alert_receiver.SlackConfig] | None DEFAULT: None

pagerduty_configs

List of PagerDuty configurations.

TYPE: list[alert_receiver.PagerDutyConfig] | None DEFAULT: None

webhook_configs

List of webhook configurations.

TYPE: list[alert_receiver.WebhookConfig] | None DEFAULT: None

RETURNS DESCRIPTION
alert_receiver.AlertReceiver

The created alert receiver object.

RAISES DESCRIPTION
ValueError

If multiple configurations are provided.

ValueError

If the global channel for the configuration is not configured.

TimeoutError

If the alert receiver creation times out.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

create_feature_group_alert #

create_feature_group_alert(
    feature_store_id: int,
    feature_group_id: int,
    receiver: str,
    status: _VALIDATION_STATUS_ARG | _MONITORING_STATUS_ARG,
    severity: _SEVERITY_ARG,
) -> alert.FeatureGroupAlert

Create a new feature group alert.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

new_alert = alerts_api.create_feature_group_alert(67, 1, receiver="email", status="feature_validation_warning", severity="warning")
PARAMETER DESCRIPTION
feature_store_id

The ID of the feature store.

TYPE: int

feature_group_id

The ID of the feature group.

TYPE: int

receiver

The receiver of the alert (e.g., email, webhook).

TYPE: str

status

The status that will trigger the alert (feature_validation_success, feature_validation_warning, feature_validation_failure, feature_monitor_shift_undetected, feature_monitor_shift_detected).

TYPE: _VALIDATION_STATUS_ARG | _MONITORING_STATUS_ARG

severity

The severity of the alert (warning, critical, info).

TYPE: _SEVERITY_ARG

RETURNS DESCRIPTION
alert.FeatureGroupAlert

The created FeatureGroupAlert object.

RAISES DESCRIPTION
ValueError

If the status is not valid.

ValueError

If the severity is not valid.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

create_feature_view_alert #

create_feature_view_alert(
    feature_store_id: int,
    feature_view_name: str,
    feature_view_version: int,
    receiver: str,
    status: _MONITORING_STATUS_ARG,
    severity: _SEVERITY_ARG,
) -> alert.FeatureViewAlert

Create a new feature view alert.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

new_alert = alerts_api.create_feature_view_alert(67, "fv", 1, receiver="email", status="feature_monitor_shift_undetected", severity="warning")
PARAMETER DESCRIPTION
feature_store_id

The ID of the feature store.

TYPE: int

feature_view_name

The name of the feature view.

TYPE: str

feature_view_version

The version of the feature view.

TYPE: int

receiver

The receiver of the alert (e.g., email, webhook).

TYPE: str

status

The status that will trigger the alert (feature_monitor_shift_undetected, feature_monitor_shift_detected).

TYPE: _MONITORING_STATUS_ARG

severity

The severity of the alert (warning, critical, info).

TYPE: _SEVERITY_ARG

RETURNS DESCRIPTION
alert.FeatureViewAlert

The created FeatureViewAlert object.

RAISES DESCRIPTION
ValueError

if status is not valid.

ValueError

if severity is not valid.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

create_job_alert #

create_job_alert(
    job_name: str,
    receiver: str,
    status: _JOB_STATUS_ARG,
    severity: _SEVERITY_ARG,
) -> alert.JobAlert

Create a new job alert.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

new_alert = alerts_api.create_job_alert(job_name="my_job", receiver="email", status="finished", severity="warning")
PARAMETER DESCRIPTION
job_name

The name of the job.

TYPE: str

receiver

The receiver of the alert (e.g., email, webhook).

TYPE: str

status

The status of the alert (finished, failed, killed, long_running).

TYPE: _JOB_STATUS_ARG

severity

The severity of the alert (warning, critical, info).

TYPE: _SEVERITY_ARG

RETURNS DESCRIPTION
alert.JobAlert

The created JobAlert object.

RAISES DESCRIPTION
ValueError

If the job name is not provided.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

create_project_alert #

create_project_alert(
    receiver: str,
    status: _PROJECT_FS_STATUS_ARG
    | _PROJECT_JOB_STATUS_ARG,
    severity: _SEVERITY_ARG,
    service: _SERVICES_ARG,
    threshold=0,
) -> alert.ProjectAlert

Create a new alert.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

new_alert = alerts_api.create_project_alert(receiver="email", status="job_finished", severity="warning", service="Jobs")
PARAMETER DESCRIPTION
status

The status that will trigger the alert (job_finished, job_failed, job_killed, job_long_running, feature_validation_success, feature_validation_warning, feature_validation_failure, feature_monitor_shift_undetected, feature_monitor_shift_detected).

TYPE: _PROJECT_FS_STATUS_ARG | _PROJECT_JOB_STATUS_ARG

severity

The severity of the alert (warning, critical, info).

TYPE: _SEVERITY_ARG

receiver

The receiver of the alert (e.g., email, webhook).

TYPE: str

service

The service associated with the alert (Featurestore, Jobs).

TYPE: _SERVICES_ARG

threshold

The threshold for the alert.

DEFAULT: 0

RETURNS DESCRIPTION
alert.ProjectAlert

The created ProjectAlert object.

RAISES DESCRIPTION
ValueError

If the service is not Featurestore or Jobs, or if the status is not valid for the specified service.

ValueError

If the severity is not valid.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

delete_alert #

delete_alert(alert_id: int)

Delete an alert by ID.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

alerts_api.delete_alert(alert_id=1)
PARAMETER DESCRIPTION
alert_id

The ID of the alert to delete.

TYPE: int

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_alert #

get_alert(alert_id: int) -> alert.ProjectAlert | None

Get a specific project alert by ID.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

alert = alerts_api.get_alert(alert_id=1)
PARAMETER DESCRIPTION
alert_id

The ID of the alert to retrieve.

TYPE: int

RETURNS DESCRIPTION
alert.ProjectAlert | None

The ProjectAlert object.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_alert_receiver #

get_alert_receiver(
    name: str,
) -> alert_receiver.AlertReceiver | None

Get a specific alert receivers by name.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

alert_receiver = alerts_api.get_alert_receiver("email")
PARAMETER DESCRIPTION
name

The name of the alert receiver to retrieve.

TYPE: str

RETURNS DESCRIPTION
alert_receiver.AlertReceiver | None

The alert receiver object.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_alert_receivers #

get_alert_receivers() -> list[alert_receiver.AlertReceiver]

Get all alert receivers.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

alert_receivers = alerts_api.get_alert_receivers()
RETURNS DESCRIPTION
list[alert_receiver.AlertReceiver]

List of alert receivers.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_alerts #

get_alerts() -> list[alert.ProjectAlert]

Get all project alerts.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

alert = alerts_api.get_alerts(alert_id=1)
RETURNS DESCRIPTION
list[alert.ProjectAlert]

List of ProjectAlert objects.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_feature_group_alert #

get_feature_group_alert(
    feature_store_id: int,
    feature_group_id: int,
    alert_id: int,
) -> alert.FeatureGroupAlert | None

Get a specific feature group alert by ID.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

feature_group_alerts = alerts_api.get_feature_group_alert(feature_store_id=1, feature_group_id=1, alert_id=1)
PARAMETER DESCRIPTION
feature_store_id

The ID of the feature store.

TYPE: int

feature_group_id

The ID of the feature group.

TYPE: int

alert_id

The ID of the alert to retrieve.

TYPE: int

RETURNS DESCRIPTION
alert.FeatureGroupAlert | None

The FeatureGroupAlert object.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_feature_group_alerts #

get_feature_group_alerts(
    feature_store_id: int, feature_group_id: int
) -> list[alert.FeatureGroupAlert]

Get all feature group alerts.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

feature_group_alerts = alerts_api.get_feature_group_alerts(feature_store_id=1, feature_group_id=1)
PARAMETER DESCRIPTION
feature_store_id

The ID of the feature store.

TYPE: int

feature_group_id

The ID of the feature group.

TYPE: int

RETURNS DESCRIPTION
list[alert.FeatureGroupAlert]

List of FeatureGroupAlert objects.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_feature_view_alert #

get_feature_view_alert(
    feature_store_id: int,
    feature_view_name: str,
    feature_view_version: int,
    alert_id: int,
) -> alert.FeatureViewAlert | None

Get a specific feature view alert by ID.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

feature_view_alerts = alerts_api.get_feature_view_alert(feature_store_id=1, feature_view_name="my_feature_view", feature_view_version=1, alert_id=1)
PARAMETER DESCRIPTION
feature_store_id

The ID of the feature store.

TYPE: int

feature_view_name

The name of the feature view.

TYPE: str

feature_view_version

The version of the feature view.

TYPE: int

alert_id

The ID of the alert to retrieve.

TYPE: int

RETURNS DESCRIPTION
alert.FeatureViewAlert | None

The FeatureViewAlert object.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_feature_view_alerts #

get_feature_view_alerts(
    feature_store_id: int,
    feature_view_name: str,
    feature_view_version: int,
) -> list[alert.FeatureViewAlert]

Get all feature view alerts.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

feature_view_alerts = alerts_api.get_feature_view_alerts(feature_store_id=1, feature_view_name="my_feature_view", feature_view_version=1, alert_id=1)
PARAMETER DESCRIPTION
feature_store_id

The ID of the feature store.

TYPE: int

feature_view_name

The name of the feature view.

TYPE: str

feature_view_version

The version of the feature view.

TYPE: int

RETURNS DESCRIPTION
list[alert.FeatureViewAlert]

List of FeatureViewAlert objects.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_job_alert #

get_job_alert(
    job_name: str, alert_id: int
) -> alert.JobAlert | None

Get a specific job alert by ID.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

job_alerts = alerts_api.get_job_alert(job_name="my_job", alert_id=1)
PARAMETER DESCRIPTION
job_name

The name of the job.

TYPE: str

alert_id

The ID of the alert to retrieve.

TYPE: int

RETURNS DESCRIPTION
alert.JobAlert | None

The JobAlert object.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_job_alerts #

get_job_alerts(job_name: str) -> list[alert.JobAlert]

Get all job alerts.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

job_alerts = alerts_api.get_job_alerts(job_name="my_job")
PARAMETER DESCRIPTION
job_name

The name of the job.

TYPE: str

RETURNS DESCRIPTION
list[alert.JobAlert]

List of JobAlert objects.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_triggered_alerts #

get_triggered_alerts(
    active: bool = True,
    silenced: bool = False,
    inhibited: bool = False,
) -> list[triggered_alert.TriggeredAlert]

Get triggered alerts.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

triggered_alerts = alerts_api.get_triggered_alerts()
PARAMETER DESCRIPTION
active

Whether to include active alerts.

TYPE: bool DEFAULT: True

silenced

Whether to include silenced alerts.

TYPE: bool DEFAULT: False

inhibited

Whether to include inhibited alerts.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
list[triggered_alert.TriggeredAlert]

The triggered alert objects.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

trigger_alert #

trigger_alert(
    receiver_name: str,
    title: str,
    summary: str,
    description: str,
    severity: _SEVERITY_ARG,
    status: str,
    name: str,
    generator_url: str | None = None,
    expire_after_sec: int | None = None,
)

Trigger an alert.

Example
import hopsworks

project = hopsworks.login()

alerts_api = project.get_alerts_api()

alerts_api.trigger_alert(receiver_name="email", title="Title", summary="Alert summary", description="Alert description", severity="info", status="script_finished", name="my_alert")
PARAMETER DESCRIPTION
receiver_name

The receiver of the alert (e.g., email, webhook).

TYPE: str

summary

The summary of the alert.

TYPE: str

description

The description of the alert.

TYPE: str

severity

The severity of the alert (warning, critical, info).

TYPE: _SEVERITY_ARG

status

The status of the alert.

TYPE: str

name

The name of the alert.

TYPE: str

generator_url

The URL of the alert generator.

TYPE: str | None DEFAULT: None

expire_after_sec

The time in seconds after which the alert should expire.

TYPE: int | None DEFAULT: None

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request