Adding a custom batch materialization engine
Last updated
Was this helpful?
Last updated
Was this helpful?
Feast batch materialization operations (materialize
and materialize-incremental
) execute through a BatchMaterializationEngine
.
Custom batch materialization engines allow Feast users to extend Feast to customize the materialization process. Examples include:
Setting up custom materialization-specific infrastructure during feast apply
(e.g. setting up Spark clusters or Lambda Functions)
Launching custom batch ingestion (materialization) jobs (Spark, Beam, AWS Lambda)
Tearing down custom materialization-specific infrastructure during feast teardown
(e.g. tearing down Spark clusters, or deleting Lambda Functions)
Feast comes with built-in materialization engines, e.g, LocalMaterializationEngine
, and an experimental LambdaMaterializationEngine
. However, users can develop their own materialization engines by creating a class that implements the contract in the .
The fastest way to add custom logic to Feast is to extend an existing materialization engine. The most generic engine is the LocalMaterializationEngine
which contains no cloud-specific logic. The guide that follows will extend the LocalProvider
with operations that print text to the console. It is up to you as a developer to add your custom code to the engine methods, but the guide below will provide the necessary scaffolding to get you started.
The first step is to define a custom materialization engine class. We've created the MyCustomEngine
below.
Notice how in the above engine we have only overwritten two of the methods on the LocalMaterializatinEngine
, namely update
and materialize
. These two methods are convenient to replace if you are planning to launch custom batch jobs.
Notice how the batch_engine
field above points to the module and class where your engine can be found.
Now you should be able to use your engine by running a Feast command:
It may also be necessary to add the module root path to your PYTHONPATH
as follows:
That's it. You should now have a fully functional custom engine!
Configure your file to point to your new engine class: