Skip to content

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.

my_deployment.disable()
The enabled property can be used to check the status of the deployment.
my_deployment.enabled

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:

my_deployment.get_online_serving_code(language="python")

For Shell script:

my_deployment.get_online_serving_code(language="sh")

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:

catalog.list_deployments()

To retrieve a specific Deployment by its name from the catalog, use the get_deployment() method:

deployment = catalog.get_deployment(<deployment_name>)

To retrieve a specific Deployment by its Object ID from the catalog, use the get_deployment_by_id() method:

deployment = catalog.get_deployment_by_id(<deployment_Object_ID>)

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.

Getting the Feature List Associated with a Deployment

Use the feature_list_id property to get the Object ID of the feature list associated with a Deployment object:

observation_table.feature_list_id

For a given a feature_list, the get_feature_jobs_status() method returns a report on the recent activity of scheduled feature jobs in your feature store.

feature_list = catalog.get_feature_list_by_id(<feature_list_id>)
feature_list.get_feature_jobs_status()