Retrain triggers
This section offers an overview of setting up retrain triggers for your models. These triggers enable the automatic initiation of your retraining pipeline from the ML cube Platform.
A retrain trigger can be utilized within a Detection Event Rule. When specific criteria are met, it automatically generates the retrain report and activates the trigger. Alternatively, you can manually activate the trigger for the model on the retraining tool page.
A retrain trigger is designed as an integration with an external service and necessitates credentials with the appropriate privileges to execute the action.
Supported Triggers¶
The following retrain triggers are supported:
Amazon EventBridge
: puts an event in an Event Bus.GCP Pub/Sub
: puts an event in a Pub/Sub Topic.Azure Event Grid
: puts an event in an Event Grid Topic.
If your MLOps pipelines are set up in the AWS ecosystem, then you probably need the Amazon EventBridge retrain trigger.
The trigger, when activated, will create an event in a Event Bus of your AWS account with custom metadata.
You need to create an Event Bus rule that recognizes the ML cube Platform event pattern and attach the target action you want. Examples of targets are:
- launching a Lambda function;
- launching a SageMaker pipeline;
- sending a message to a SQS Queue with a retraining request.
Event Bus Setup¶
-
In the AWS console, open the Amazon EventBridge service and select the
Event buses
option in the left-side menu -
In the
Custom event bus
tab, create a new event bus with the default settings -
Select the
Rules
section on the left-side menu and click theCreate Rule
button -
Insert the rule name and the created Event Bus in the Event Bus section. Click
Next
Event source
: select the voice AWS events or EventBridge partner eventsSample event
: copy and paste this:Creation method
: select Custom pattern (JSON editor)Event pattern
: copy and paste this:- click the button Test pattern to check the match and then click next
-
Select the target that will handle the events. If you want to test the rule, you can add a CloudWatch target that stores the event to a new Log Group.
-
Create the rule
Retrain Trigger Setup
To integrate Amazon Event Bridge, you will need to create a set of AWS credentials, and add a policy that allows to put events in your event bus. Please refer to this page to know more.
Once the credentials and the policy have been created, you can set up the retrain trigger for your model through the SDK or the web application.
If your MLOps pipelines are set up in the Google Cloud Platform ecosystem, then you probably need the GCP Pub/Sub retrain trigger.
The trigger, when activated, will create an event in a Pub/Sub topic of your GCP project with custom metadata.
Topic Setup¶
-
In the Google Cloud console, open the Pub/Sub service and select the
Topics
option in the left-side menu -
Click on the
Create topic
button. Then give it a unique id and create it. -
Configure your subscriptions as needed to configure the service that will handle the events.
The ML cube platform will send events with this format:
{
"project_id": "your gcp project id",
"topic_name": "your unique topic id",
"source": "ml3_platform",
"event_type": "retrain_trigger",
"payload": {
"model_id": "id of the model on ml cube platform"
}
}
Retrain Trigger Setup
To integrate GCP Pub/Sub, you will need to create a set of GCP credentials, and add a policy that allows to put events in your Pub/Sub topic. Please refer to this page to know more.
Once the credentials and the policy have been created, you can set up the retrain trigger for your model through the SDK or the web application.
If your MLOps pipelines are set up in the Microsoft Azure ecosystem, then you probably need the Azure Event Grid retrain trigger.
The trigger, when activated, will create an event in an Event Grid topic of your Azure resource group with custom metadata.
Topic Setup¶
-
In the Azure console, open the Event Grid service and select the
Topics
option in the left-side menu -
Click on the
Create
button. Select an active subscription and the resource group, then give the topic a unique name, select your preferred region and create it. -
Configure your subscriptions as needed to configure the service that will handle the events.
The ML cube platform will send events with this format:
{
"subject": "ml3_platform",
"event_type": "retrain_trigger",
"data_version": "1.0",
"data": {
"model_id": "id of the model on ml cube platform"
}
}
Retrain Trigger Setup
To integrate Azure Event Grid, you will need to create a set of Azure credentials, and add a role that allows to publish events in your Event Grid topic. Please refer to this page to know more.
Once the credentials and the policy have been created, you can set up the retrain trigger for your model through the SDK or the web application.