public static NestableLoadProfileEstimator createFromMathExSpecification()

in wayang-commons/wayang-core/src/main/java/org/apache/wayang/core/optimizer/costs/LoadProfileEstimators.java [237:289]


    public static NestableLoadProfileEstimator createFromMathExSpecification(String configKey, WayangJsonObj spec) {
        int numInputs = spec.getInt("in");
        int numOutputs = spec.getInt("out");
        double correctnessProb = spec.getDouble("p");
        List<String> operatorProperties = spec.has("import") ?
                StreamSupport.stream(spec.optionalWayangJsonArray("import").spliterator(), false).map(Objects::toString).collect(Collectors.toList()) :
                Collections.emptyList();


        LoadEstimator cpuEstimator = new DefaultLoadEstimator(
                numInputs,
                numOutputs,
                correctnessProb,
                CardinalityEstimate.EMPTY_ESTIMATE,
                compile(spec.getString("cpu"))
        );
        LoadEstimator ramEstimator = new DefaultLoadEstimator(
                numInputs,
                numOutputs,
                correctnessProb,
                CardinalityEstimate.EMPTY_ESTIMATE,
                compile(spec.getString("ram"))
        );
        LoadEstimator diskEstimator = !spec.has("disk") ? null : new DefaultLoadEstimator(
                numInputs,
                numOutputs,
                correctnessProb,
                CardinalityEstimate.EMPTY_ESTIMATE,
                compile(spec.getString("disk"))
        );
        LoadEstimator networkEstimator = !spec.has("network") ? null : new DefaultLoadEstimator(
                numInputs,
                numOutputs,
                correctnessProb,
                CardinalityEstimate.EMPTY_ESTIMATE,
                compile(spec.getString("network"))
        );

        long overhead = spec.has("overhead") ? spec.getLong("overhead") : 0L;
        FunctionDescriptor.SerializableToDoubleBiFunction<long[], long[]> resourceUtilizationEstimator = spec.has("ru") ?
                compileResourceUsage(spec.getString("ru")) :
                DEFAULT_RESOURCE_UTILIZATION_ESTIMATOR;
        return new NestableLoadProfileEstimator(
                cpuEstimator,
                ramEstimator,
                diskEstimator,
                networkEstimator,
                resourceUtilizationEstimator,
                overhead,
                configKey
        );

    }