feast icon indicating copy to clipboard operation
feast copied to clipboard

feast.errors.FeastClassImportError: Could not import class 'MyCustomEngine' from module 'feast_custom_engine'

Open newsbreak-tonglin opened this issue 3 years ago • 4 comments

try to add a custom engine(https://docs.feast.dev/how-to-guides/customizing-feast/creating-a-custom-materialization-engine), but got some errors below: feast.errors.FeastClassImportError: Could not import class 'MyCustomEngine' from module 'feast_custom_engine'

my project structure: . ├── init.py ├── data │   ├── driver_stats.parquet │   ├── online_store.db │   └── registry.db ├── entity_example.py ├── example.py ├── feast_custom_engine │   ├── init.py │   ├── pycache │   │   └── init.cpython-38.pyc │   └── my_custom_engine.py └── feature_store.yaml

command: PYTHONPATH=$PYTHONPATH:/Users/xx/feast_test/my_project/feast_custom_engine feast --log-level DEBUG materialize 2022-01-01 2022-12-12

error details: Traceback (most recent call last): File "/Users/xx/.pyenv/versions/3.8.10/bin/feast", line 8, in sys.exit(cli()) File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/click/core.py", line 829, in call return self.main(*args, **kwargs) File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func return f(get_current_context(), *args, **kwargs) File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/feast/cli.py", line 550, in materialize_command store.materialize( File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/feast/usage.py", line 285, in wrapper raise exc.with_traceback(traceback) File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/feast/usage.py", line 274, in wrapper return func(*args, **kwargs) File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/feast/feature_store.py", line 1342, in materialize provider.materialize_single_feature_view( File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/feast/infra/passthrough_provider.py", line 246, in materialize_single_feature_view jobs = self.batch_engine.materialize(registry, [task]) File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/feast/infra/passthrough_provider.py", line 89, in batch_engine engine_class = importer.import_class(engine_module, engine_class_name) File "/Users/xx/.pyenv/versions/3.8.10/lib/python3.8/site-packages/feast/importer.py", line 41, in import_class raise FeastClassImportError(module_name, class_name) from None feast.errors.FeastClassImportError: Could not import class 'MyCustomEngine' from module 'feast_custom_engine'

newsbreak-tonglin avatar Sep 08 '22 07:09 newsbreak-tonglin

Hey @newsbreak-tonglin

It looks like you may need to rename init.py to __init__.py to make MyCustomEngine importable.

niklasvm avatar Sep 08 '22 16:09 niklasvm

@niklasvm It is init.py actually, but it still can't be imported image

newsbreak-tonglin avatar Sep 08 '22 16:09 newsbreak-tonglin

What does your feature_store.yaml look like? Based on your screenshot I would expect this to work:

batch_engine: feature_custom_engine.feast_custom_engine.MyCustomEngine

niklasvm avatar Sep 08 '22 16:09 niklasvm

@niklasvm feature_custom_engine.feast_custom_engine.MyCustomEngine doesn't work, below is my feature_store.yaml

project: my_project registry: data/registry.db batch_engine: feature_custom_engine.feast_custom_engine.MyCustomEngine provider: local online_store: path: data/online_store.db offline_store: type: file

newsbreak-tonglin avatar Sep 09 '22 02:09 newsbreak-tonglin

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 18 '23 05:03 stale[bot]