From 6304a0b6c0f946971ace4b576a5f01e4670bb16a Mon Sep 17 00:00:00 2001 From: Adeel Hassan Date: Fri, 8 Sep 2023 14:26:19 -0400 Subject: [PATCH] don't require every plugin recorded in bundle (#1916) The model bundles record every rastervision plugin that was installed when they were created and it was required to have all those plugins installed when using those bundles even if not actually needed. This change removes that requirement. Co-authored-by: Adeel Hassan --- rastervision_pipeline/rastervision/pipeline/config.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rastervision_pipeline/rastervision/pipeline/config.py b/rastervision_pipeline/rastervision/pipeline/config.py index bf9b374e5..f6822c443 100644 --- a/rastervision_pipeline/rastervision/pipeline/config.py +++ b/rastervision_pipeline/rastervision/pipeline/config.py @@ -1,5 +1,6 @@ from typing import List, Type, Union, Optional, Callable, Dict, TYPE_CHECKING import inspect +import logging from pydantic import ( # noqa BaseModel, create_model, Field, root_validator, validate_model, @@ -14,6 +15,8 @@ if TYPE_CHECKING: from rastervision.pipeline.pipeline_config import PipelineConfig +log = logging.getLogger(__name__) + class ConfigError(ValueError): """Exception raised for invalid configuration.""" @@ -212,14 +215,16 @@ def upgrade_plugin_versions(plugin_versions: Dict[str, int]) -> Dict[str, int]: """ new_plugin_versions = {} + missing_plugins = [] for alias, version in plugin_versions.items(): plugin = registry.get_plugin_from_alias(alias) if plugin: new_plugin_versions[plugin] = version else: - raise ConfigError( - 'The plugin_versions field contains an unrecognized ' - f'plugin name: {alias}.') + missing_plugins.append(alias) + if len(missing_plugins) > 0: + log.warning('There are plugins listed in the pipeline config that are ' + f'not currently installed: {missing_plugins}') return new_plugin_versions