1313from hermes .error import HermesPluginRunError , MisconfigurationError
1414from hermes .model .api import SoftwareMetadata
1515from hermes .model .context_manager import HermesContext
16- from hermes .model .error import HermesValidationError
1716from hermes .model .merge .action import MergeAction
1817from hermes .model .merge .container import ld_merge_dict
1918
@@ -28,6 +27,7 @@ def __call__(self, command: HermesCommand) -> dict[Union[str, None], dict[Union[
2827class ProcessSettings (BaseModel ):
2928 """Generic deposition settings."""
3029
30+ sources : list = []
3131 plugins : list = []
3232
3333
@@ -72,19 +72,32 @@ def __call__(self, args: argparse.Namespace) -> None:
7272
7373 self .log .info ("## Merge the metadata of the harvesters" )
7474 # Get all harvesters
75- harvester_names = self .root_settings .harvest .sources
75+ harvester_names = self .settings .sources if self .settings .sources else self .root_settings .harvest .sources
76+ merged_any = False
7677 for harvester in harvester_names :
7778 self .log .info (f"## Load data from { harvester } plugin" )
7879 # load data from harvester
7980 try :
8081 metadata = SoftwareMetadata .load_from_cache (ctx , harvester )
81- except Exception as e :
82- self .log .error (f"The data from the harvester { harvester } could not be loaded or is invalid." )
83- raise HermesValidationError (f"The results of the harvest plugin { harvester } is invalid." ) from e
82+ except Exception :
83+ # skip this harvester when the data is invalid
84+ self .log .warning (f"The data from the harvester { harvester } could not be loaded or is invalid." )
85+ self .log .info (f"## Aborting merge for { harvester } " )
86+ continue
8487
8588 self .log .info (f"## Merge data from { harvester } plugin" )
8689 # merge data into the merge dict
8790 merged_doc .update (metadata )
91+ merged_any = True
92+
93+ # error if nothing was merged
94+ if not merged_any :
95+ self .log .error (
96+ f"""No metadata has been merged. {
97+ "No harvesters to merge from were supplied" if not harvester_names else
98+ "The merging failed for all harvesters."
99+ } """
100+ )
88101
89102 self .log .info ("## Store processed metadata" )
90103 # store processed data
0 commit comments