def validate_arguments(pipeline, context, allow_empty_pipeline=False):
# type: (List[Component], Dict[Text, Any], bool) -> None
"""Validates a pipeline before it is run. Ensures, that all arguments are present to train the pipeline."""
# Ensure the pipeline is not empty
if not allow_empty_pipeline and len(pipeline) == 0:
raise ValueError("Can not train an empty pipeline. " +
"Make sure to specify a proper pipeline in the configuration using the `pipeline` key." +
"The `backend` configuration key is NOT supported anymore.")
provided_properties = set(context.keys())
for component in pipeline:
for r in component.requires:
if r not in provided_properties:
raise Exception("Failed to validate at component '{}'. Missing property: '{}'".format(
component.name, r))
provided_properties.update(component.provides)
评论列表
文章目录