Alerts API#
Handle#
get_alerts_api#
Project.get_alerts_api()
Get the alerts api for the project.
Returns
AlertsApi
: The Alerts Api handle
Methods#
create_alert_receiver#
AlertsApi.create_alert_receiver(
name, email_configs=None, slack_configs=None, pagerduty_configs=None, webhook_configs=None
)
Create a new alert receiver.
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"}])
- name
str
: The name of the alert receiver (e.g., email, webhook). - email_configs
List[hopsworks_common.alert_receiver.EmailConfig]
: List of email configurations (optional). - slack_configs
List[hopsworks_common.alert_receiver.SlackConfig]
: List of Slack configurations (optional). - pagerduty_configs
List[hopsworks_common.alert_receiver.PagerDutyConfig]
: List of PagerDuty configurations (optional). - webhook_configs
List[hopsworks_common.alert_receiver.WebhookConfig]
: List of webhook configurations (optional).
Returns
AlertReceiver
: The created alert receiver object.
Raises
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#
AlertsApi.create_feature_group_alert(
feature_store_id, feature_group_id, receiver, status, severity
)
Create a new feature group alert.
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")
- feature_store_id
int
: The ID of the feature store. - feature_group_id
int
: The ID of the feature group. - receiver
str
: The receiver of the alert (e.g., email, webhook). - status
Literal['success', 'warning', 'failure', 'validation_success', 'validation_warning', 'validation_failure', 'feature_validation_success', 'feature_validation_warning', 'feature_validation_failure'] | Literal['feature_monitor_shift_undetected', 'feature_monitor_shift_detected']
: The status that will trigger the alert (feature_validation_success, feature_validation_warning, feature_validation_failure, feature_monitor_shift_undetected, feature_monitor_shift_detected). - severity
Literal['warning', 'critical', 'info']
: The severity of the alert (warning, critical, info).
Returns
FeatureGroupAlert
: The created FeatureGroupAlert object.
Raises
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#
AlertsApi.create_feature_view_alert(
feature_store_id, feature_view_name, feature_view_version, receiver, status, severity
)
Create a new feature view alert.
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")
- feature_store_id
int
: The ID of the feature store. - feature_view_name
str
: The name of the feature view. - feature_view_version
int
: The version of the feature view. - receiver
str
: The receiver of the alert (e.g., email, webhook). - status
Literal['feature_monitor_shift_undetected', 'feature_monitor_shift_detected']
: The status that will trigger the alert (feature_monitor_shift_undetected, feature_monitor_shift_detected). - severity
Literal['warning', 'critical', 'info']
: The severity of the alert (warning, critical, info).
Returns
FeatureViewAlert
: The created FeatureViewAlert object.
Raises
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#
AlertsApi.create_job_alert(job_name, receiver, status, severity)
Create a new job alert.
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")
- job_name
str
: The name of the job. - receiver
str
: The receiver of the alert (e.g., email, webhook). - status
Literal['finished', 'failed', 'killed', 'long_running', 'job_finished', 'job_failed', 'job_killed', 'job_long_running']
: The status of the alert (finished, failed, killed, long_running). - severity
Literal['warning', 'critical', 'info']
: The severity of the alert (warning, critical, info).
Returns
JobAlert
: The created JobAlert object.
Raises
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#
AlertsApi.create_project_alert(receiver, status, severity, service, threshold=0)
Create a new alert.
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")
- status
Literal['validation_success', 'validation_warning', 'validation_failure', 'feature_validation_success', 'feature_validation_warning', 'feature_validation_failure', 'feature_monitor_shift_undetected', 'feature_monitor_shift_detected'] | Literal['job_finished', 'job_failed', 'job_killed', 'job_long_running']
: 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). - severity
Literal['warning', 'critical', 'info']
: The severity of the alert (warning, critical, info). - receiver
str
: The receiver of the alert (e.g., email, webhook). - service
Literal['Featurestore', 'Jobs']
: The service associated with the alert (Featurestore, Jobs). - threshold: The threshold for the alert (default is 0).
Returns
ProjectAlert
: The created ProjectAlert object.
Raises
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#
AlertsApi.delete_alert(alert_id)
Delete an alert by ID.
import hopsworks
project = hopsworks.login()
alerts_api = project.get_alerts_api()
alerts_api.delete_alert(alert_id=1)
- alert_id
int
: The ID of the alert to delete.
Returns
None
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_alert#
AlertsApi.get_alert(alert_id)
Get a specific project alert by ID.
import hopsworks
project = hopsworks.login()
alerts_api = project.get_alerts_api()
alert = alerts_api.get_alert(alert_id=1)
- alert_id
int
: The ID of the alert to retrieve.
Returns
ProjectAlert
: The ProjectAlert object.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_alert_receiver#
AlertsApi.get_alert_receiver(name)
Get a specific alert receivers by name.
import hopsworks
project = hopsworks.login()
alerts_api = project.get_alerts_api()
alert_receiver = alerts_api.get_alert_receiver("email")
- name
str
: The name of the alert receiver to retrieve.
Returns
AlertReceiver
: The alert receiver object.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_alert_receivers#
AlertsApi.get_alert_receivers()
Get all alert receivers.
import hopsworks
project = hopsworks.login()
alerts_api = project.get_alerts_api()
alert_receivers = alerts_api.get_alert_receivers()
List[AlertReceiver]
: List of alert receivers.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_alerts#
AlertsApi.get_alerts()
Get all project alerts.
import hopsworks
project = hopsworks.login()
alerts_api = project.get_alerts_api()
alert = alerts_api.get_alerts(alert_id=1)
List[ProjectAlert]
: List of ProjectAlert objects.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_feature_group_alert#
AlertsApi.get_feature_group_alert(feature_store_id, feature_group_id, alert_id)
Get a specific feature group alert by ID.
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)
- feature_store_id
int
: The ID of the feature store. - feature_group_id
int
: The ID of the feature group. - alert_id
int
: The ID of the alert to retrieve.
Returns
FeatureGroupAlert
: The FeatureGroupAlert object.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_feature_group_alerts#
AlertsApi.get_feature_group_alerts(feature_store_id, feature_group_id)
Get all feature group alerts.
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)
- feature_store_id
int
: The ID of the feature store. - feature_group_id
int
: The ID of the feature group.
Returns
List[FeatureGroupAlert]
: List of FeatureGroupAlert objects.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_feature_view_alert#
AlertsApi.get_feature_view_alert(
feature_store_id, feature_view_name, feature_view_version, alert_id
)
Get a specific feature view alert by ID.
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)
- feature_store_id
int
: The ID of the feature store. - feature_view_name
str
: The name of the feature view. - feature_view_version
int
: The version of the feature view. - alert_id
int
: The ID of the alert to retrieve.
Returns
FeatureViewAlert
: The FeatureViewAlert object.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_feature_view_alerts#
AlertsApi.get_feature_view_alerts(feature_store_id, feature_view_name, feature_view_version)
Get all feature view alerts.
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)
- feature_store_id
int
: The ID of the feature store. - feature_view_name
str
: The name of the feature view. - feature_view_version
int
: The version of the feature view.
Returns
List[FeatureViewAlert]
: List of FeatureViewAlert objects.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_job_alert#
AlertsApi.get_job_alert(job_name, alert_id)
Get a specific job alert by ID.
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)
- job_name
str
: The name of the job. - alert_id
int
: The ID of the alert to retrieve.
Returns
JobAlert
: The JobAlert object.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_job_alerts#
AlertsApi.get_job_alerts(job_name)
Get all job alerts.
import hopsworks
project = hopsworks.login()
alerts_api = project.get_alerts_api()
job_alerts = alerts_api.get_job_alerts(job_name="my_job")
- job_name
str
: The name of the job.
Returns
List[JobAlert]
: List of JobAlert objects.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_triggered_alerts#
AlertsApi.get_triggered_alerts(active=True, silenced=False, inhibited=False)
Get triggered alerts.
import hopsworks
project = hopsworks.login()
alerts_api = project.get_alerts_api()
triggered_alerts = alerts_api.get_triggered_alerts()
- active
bool
: Whether to include active alerts (default is True). - silenced
bool
: Whether to include silenced alerts (default is False). - inhibited
bool
: Whether to include inhibited alerts (default is False).
Returns
List[TriggeredAlert]
: The triggered alert objects.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
trigger_alert#
AlertsApi.trigger_alert(
receiver_name,
title,
summary,
description,
severity,
status,
name,
generator_url=None,
expire_after_sec=None,
)
Trigger an alert.
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")
- receiver_name
str
: The receiver of the alert (e.g., email, webhook). - summary
str
: The summary of the alert. - description
str
: The description of the alert. - severity
Literal['warning', 'critical', 'info']
: The severity of the alert (warning, critical, info). - status
str
: The status of the alert. - name
str
: The name of the alert. - generator_url
str
: The URL of the alert generator (optional). - expire_after_sec
int
: The time in seconds after which the alert should expire (optional).
Returns
None
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request