Skip to content

Commit

Permalink
don't require every plugin recorded in bundle (azavea#1916)
Browse files Browse the repository at this point in the history
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 <ahassan@element84.com>
  • Loading branch information
AdeelH and AdeelH committed Sep 22, 2023
1 parent 403ac05 commit 6304a0b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions 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,
Expand All @@ -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."""
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 6304a0b

Please sign in to comment.