/** * Creates a new instance. * * @param measuredExecutionTime the time measured for the partial execution * @param lowerCost the lower possible costs for the new instance (excluding fix costs) * @param upperCost the upper possible costs for the new instance (excluding fix costs) * @param executionLineageNodes for all executed {@link ExecutionOperator}s * @param configuration the {@link Configuration} to re-estimate execution statistics */ public PartialExecution(long measuredExecutionTime, double lowerCost, double upperCost, Collection<ExecutionLineageNode> executionLineageNodes, Configuration configuration) { this.measuredExecutionTime = measuredExecutionTime; this.atomicExecutionGroups = executionLineageNodes.stream() .map(node -> new AtomicExecutionGroup( node.getOperatorContext(), ((ExecutionOperator) node.getOperatorContext().getOperator()).getPlatform(), configuration, node.getAtomicExecutions() )) .collect(Collectors.toList()); this.lowerCost = lowerCost; this.upperCost = upperCost; }
/** * Creates a new instance according to the measurement data. * * @param measuredExecutionTime the measured execution time * @param executionLineageNodes the {@link ExecutionLineageNode}s reflecting what has been executed * @param configuration the execution {@link Configuration} * @return the new instance */ public static PartialExecution createFromMeasurement( long measuredExecutionTime, Collection<ExecutionLineageNode> executionLineageNodes, Configuration configuration) { // Calculate possible costs. double lowerCost = Double.POSITIVE_INFINITY, upperCost = Double.NEGATIVE_INFINITY; final Set<Platform> platforms = executionLineageNodes.stream() .map(node -> ((ExecutionOperator) node.getOperatorContext().getOperator()).getPlatform()) .collect(Collectors.toSet()); for (Platform platform : platforms) { final TimeToCostConverter timeToCostConverter = configuration.getTimeToCostConverterProvider().provideFor(platform); final ProbabilisticDoubleInterval costs = timeToCostConverter.convertWithoutFixCosts(TimeEstimate.ZERO.plus(measuredExecutionTime)); lowerCost = Math.min(lowerCost, costs.getLowerEstimate()); upperCost = Math.max(upperCost, costs.getUpperEstimate()); } return new PartialExecution(measuredExecutionTime, lowerCost, upperCost, executionLineageNodes, configuration); }