description |
---|
Documentation on how notifications work for feature groups in Hopsworks. |
Changes to online-enabled feature groups can be captured by listening to events on specified topics. This optimizes the user experience by allowing users to proactively make predictions as soon as there is an update on the features.
In this guide you will learn how to enable notifications for online feature groups within Hopsworks, showing examples in HSFS APIs as well as the user interface.
Before you begin this guide we suggest you read the Feature Group concept page to understand what a feature group is and how it fits in the ML pipeline.
To begin with, you will need to have a topic where the notifications will be sent.
To create a topic in Hopsworks you can navigate to the Kafka
subsection of project settings
and click on Add a new topic
.
After specifying topic details it can be created by clicking on the Create Topic
button.
To enable notifications for an online-enabled feature group using the HSFS APIs you need to create a feature group and set the notification_topic_name
properties value to the previously created topic.
=== "Python"
```python
fg = fs.create_feature_group(name="feature_group_name", version=feature_group_version, primary_key=feature_group_primary_keys, online_enabled=True, notification_topic_name="notification_topic_name")
```
The notification topic name can be changed after the creation of the feature group.
By setting the notification_topic_name
value to None
or empty string notification will be disabled.
It can take some time for these changes to take place since the onlinefs service internally caches feature groups for a set amount of time.
=== "Python"
```python
fg.update_notification_topic_name(notification_topic_name="new_notification_topic_name")
```
During the creation of the feature group enable online feature serving.
When enabled you will be able to set the CDC topic name
property.
CDC stands for change data capture.
The notification topic name can be changed after creation by editing the feature group.
By setting the CDC topic name
value to empty the notifications will be disabled.
It can take some time for changes to notifications to take place.
Once properly set up the online feature store service will produce events to the provided notification topic when data ingestion is completed for records.
Here is an example output:
{
"projectId":119,
"featureStoreId":67,
"featureGroupId":14,
"entry":{
"id":"15",
"text":"test"
},
"featureViews":[
{
"id":9,
"name":"test",
"version":1,
"featurestoreId":67
}
]
}