故障排除
过时的构建缓存
默认情况下,Morpheus 构建系统将所有构建工件和缓存输出存储在 ${MORPHEUS_ROOT}/.cache
目录中。此缓存目录旨在加速后续构建,但有时可能会过时并导致意外的构建错误。在这种情况下,最好完全删除构建和缓存目录并重新启动构建。
# Delete the build and cache folders
rm -rf ${MORPHEUS_ROOT}/.cache
rm -rf ${MORPHEUS_ROOT}/build
# Clean out documentation builds:
rm -rf docs/source/_modules docs/source/_lib
# Clean out shared-libs if compiled with `MORPHEUS_PYTHON_INPLACE_BUILD=ON`:
find ./morpheus -name "*.so" -delete
# Clean out shared libs if examples have been built:
find ./examples -name "*.so" -delete
# Restart the build
./scripts/compile.sh
不兼容的 MLflow 模型
使用先前版本的 Morpheus 训练并存储到 MLflow 中的模型可能与当前版本不兼容。此错误可以通过在基于 MLflow 的管道(例如 DFP)中出现的以下错误消息来识别。
Error trying to get model
Traceback (most recent call last):
File "/workspace/python/morpheus_dfp/morpheus_dfp/stages/dfp_inference_stage.py", line 101, in on_data
loaded_model = model_cache.load_model(self._client)
ModuleNotFoundError: No module named 'dfencoder'
针对此问题的可用解决方法是
恢复到先前版本的 Morpheus,直到可以重新训练模型为止。
使用当前版本的 Morpheus 重新训练模型
对于 DFP 示例训练的模型,可以通过运行以下命令删除现有模型
docker volume ls # list current docker volumes
docker volume rm production_db_data production_mlflow_data
# Re-build the MLflow container for DFP
cd ${MORPHEUS_ROOT}/examples/digital_fingerprinting/production/
docker compose build
docker compose up mlflow
调试 Python 代码
要调试 python 代码中的问题,仓库中包含了几种 Visual Studio Code 启动配置。这些启动配置可以在 ${MORPHEUS_ROOT}/morpheus.code-workspace
中找到。要启动调试环境,请确保 Visual Studio Code 已打开 Morpheus 工作区文件(文件->从文件打开工作区...)。加载工作区后,启动配置应在调试选项卡中可用。
调试 C++ 代码
与 Python 启动配置类似,可以在 Visual Studio Code 工作区文件中找到几种 C++ 启动配置。但是,与 Python 配置不同,必须确保 Morpheus 在调试模式下编译,断点才能正常工作。要在调试模式下构建 Morpheus,请使用以下命令
CMAKE_CONFIGURE_EXTRA_ARGS="-DCMAKE_BUILD_TYPE=Debug" ./scripts/compile.sh