Search in sources :

Example 1 with ValidateResult

use of ml.shifu.shifu.container.meta.ValidateResult in project shifu by ShifuML.

the class Step method validateModelConfig.

/**
     * Validate the modelconfig if it's well written.
     */
/**
     * Validate the modelconfig if it's well written.
     * 
     * @param modelConfig
     *            the model config
     * @param step
     *            step in Shifu
     * @throws Exception
     *             any exception in validation
     */
protected void validateModelConfig(ModelConfig modelConfig, ModelStep step) throws Exception {
    ValidateResult result = new ValidateResult(false);
    if (modelConfig == null) {
        result.getCauses().add("The ModelConfig is not loaded!");
    } else {
        result = ModelInspector.getInspector().probe(modelConfig, step);
    }
    if (!result.getStatus()) {
        LOG.error("ModelConfig Validation - Fail! See below:");
        for (String cause : result.getCauses()) {
            LOG.error("\t!!! " + cause);
        }
        throw new ShifuException(ShifuErrorCode.ERROR_MODELCONFIG_NOT_VALIDATION);
    } else {
        LOG.info("ModelConfig Validation - OK");
    }
    checkAlgParameter(modelConfig);
}
Also used : ValidateResult(ml.shifu.shifu.container.meta.ValidateResult) ShifuException(ml.shifu.shifu.exception.ShifuException)

Aggregations

ValidateResult (ml.shifu.shifu.container.meta.ValidateResult)1 ShifuException (ml.shifu.shifu.exception.ShifuException)1