Deployment
A Deployment object is used to manage the online and batch serving of a deployed FeatureList in a production environment.
Note
Distinguishing FeatureList and Deployment allows multiple deployments for a given FeatureList. This is useful when a FeatureList object is used for multiple use cases. This allows for better organization and management of use cases.
Creating Deployment Objects¶
A Deployment object is created when a feature list is deployed.
To create a Deployment object, the corresponding FeatureList object must have all its Feature objects labeled as "PRODUCTION_READY". After that, the deploy()
method can be used to create the Deployment object, and the enable()
method can be called to activate it.
# Check Feature objects are PRODUCTION_READY.
# A readiness metric of 100% should be returned.
display(my_feature_list.production_ready_fraction)
# Create deployment
my_deployment = my_feature_list.deploy(
name="Deployment of the improved feature list",
)
# Activate deployment
my_deployment.enable()
Important
Trying to deploy a feature list which has features that aren't labeled as "PRODUCTION_READY" will raise an error.
The disable()
method can be used to disable the deployment when it is no longer needed.
enabled
property can be used to check the status of the deployment.
Using Deployment for Online Serving¶
For online serving, the Deployment object provides REST API service templates that can be used to serve features. Python or shell script templates for the REST API service are retrieved from the Deployment object using the get_online_serving_code()
method.
For Python script:
For Shell script:
Using Deployment for Batch Serving¶
For batch serving, the Deployment object provides the compute_batch_feature_table()
method, which returns a BatchFeatureTable object representing a table in the feature store containing the batch feature values.
For more details, refer to the SDK reference for BatchFeatureTable object.
Listing and Retrieving Deployment Objects¶
From a Catalog¶
To list the Deployment objects in the catalog, use the list_deployments()
method:
To retrieve a specific Deployment by its name from the catalog, use the get_deployment()
method:
To retrieve a specific Deployment by its Object ID from the catalog, use the get_deployment_by_id()
method:
Across Catalogs¶
Use the Deployment object class methods to list deployments across all catalogs:
list()
to list all deployments across catalogs.get()
to get an Deployment object by its name.get_by_id()
to get a Deployment object by its Object ID.
Feature Job Status¶
For a given a deployment, the get_feature_jobs_status()
method returns a report on recent activities of scheduled feature jobs, including run history, success status, and durations.
deployment = catalog.get_deployment("feature_deployment")
deployment.get_feature_jobs_status(job_history_window=24)
In cases of failed or late jobs, it's advised to review data warehouse logs for insights, especially if the issue relates to compute capacity.