/** * Estimate the {@link TimeEstimate} for all {@link AtomicExecution}s in this instance. * * @return the {@link TimeEstimate} */ public TimeEstimate estimateExecutionTime() { return this.estimateExecutionTime(this.estimationContext); }
/** * Estimate the {@link LoadProfile} for all {@link AtomicExecution}s in this instance. * * @return the {@link LoadProfile} */ public LoadProfile estimateLoad() { return this.estimateLoad(this.estimationContext); }
/** * 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; }
if (this.logger.isDebugEnabled()) { for (AtomicExecutionGroup atomicExecutionGroup : partialExecution.getAtomicExecutionGroups()) { if (!(atomicExecutionGroup.getEstimationContext() instanceof OptimizationContext.OperatorContext)) { continue; (OptimizationContext.OperatorContext) atomicExecutionGroup.getEstimationContext();
@Override public AtomicExecutionGroup deserialize(JSONObject json, Class<? extends AtomicExecutionGroup> cls) { return new AtomicExecutionGroup( JsonSerializables.deserialize( json.getJSONObject("ctx"), SimpleEstimationContext.jsonSerializer, SimpleEstimationContext.class ), JsonSerializables.deserialize( json.getJSONObject("platform"), Platform.jsonSerializer ), this.configuration, JsonSerializables.deserializeAllAsList( json.getJSONArray("executions"), new AtomicExecution.KeyOrLoadSerializer(this.configuration, null), AtomicExecution.class ) ); } }
/** * Estimate the {@link TimeEstimate} for all {@link AtomicExecution}s in this instance in the light of the * given {@link EstimationContext}. * * @param estimationContext that provides estimation parameters * @return the {@link TimeEstimate} */ public TimeEstimate estimateExecutionTime(EstimationContext estimationContext) { if (this.loadProfileToTimeConverterCache == null) { this.loadProfileToTimeConverterCache = this.configuration .getLoadProfileToTimeConverterProvider() .provideFor(this.platform); } return this.loadProfileToTimeConverterCache.convert(this.estimateLoad(estimationContext)); }
/** * Calculates the overall {@link TimeEstimate} of this instance. * * @return the overall {@link TimeEstimate} */ public TimeEstimate getOverallTimeEstimate(Configuration configuration) { final long platformInitializationTime = this.initializedPlatforms.stream() .mapToLong(platform -> platform.getInitializeMillis(configuration)) .sum(); final TimeEstimate executionTime = this.atomicExecutionGroups.stream() .map(group -> group.estimateExecutionTime()) .reduce(TimeEstimate.ZERO, TimeEstimate::plus); return executionTime.plus(platformInitializationTime); }