Package com.opengamma.engine.value

Examples of com.opengamma.engine.value.ComputedValueResult


  @Override
  public ViewCalculationResultModel buildObject(FudgeDeserializer deserializer, FudgeMsg message) {
    final Map<ComputationTargetSpecification, Map<Pair<String, ValueProperties>, ComputedValueResult>> mapNames =
      new HashMap<ComputationTargetSpecification, Map<Pair<String, ValueProperties>, ComputedValueResult>>();
    for (FudgeField field : message) {
      final ComputedValueResult value = deserializer.fieldValueToObject(ComputedValueResult.class, field);
      final ComputationTargetSpecification target = value.getSpecification().getTargetSpecification();
      if (!mapNames.containsKey(target)) {
        mapNames.put(target, new HashMap<Pair<String, ValueProperties>, ComputedValueResult>());
      }
      mapNames.get(target).put(Pair.of(value.getSpecification().getValueName(), value.getSpecification().getProperties()), value);
    }
    return new ViewCalculationResultModel() {
     
      @Override
      public Collection<ComputationTargetSpecification> getAllTargets() {
View Full Code Here


      final String calculationConfiguration = _graph.getCalculationConfigurationName();
      for (Pair<ValueSpecification, Object> value : _computationCache.getValues(_terminalOutputs, CacheSelectHint.allShared())) {
        final ValueSpecification valueSpec = value.getFirst();
        final Object calculatedValue = value.getSecond();
        if (calculatedValue != null) {
          final ComputedValueResult computedValueResult = SingleComputationCycle.createComputedValueResult(valueSpec, calculatedValue, _resultCache.get(valueSpec));
          fragmentResultModel.addValue(calculationConfiguration, computedValueResult);
          fullResultModel.addValue(calculationConfiguration, computedValueResult);
        }
      }
      _terminalOutputs.clear();
View Full Code Here

            deltaModel.addValue(calcConfigName, result);
          }
        } else {
          // Have to individual delta.
          for (Map.Entry<Pair<String, ValueProperties>, ComputedValueResult> resultEntry : resultValues.entrySet()) {
            ComputedValueResult resultValue = resultEntry.getValue();
            ComputedValueResult previousValue = previousValues.get(resultEntry.getKey());
            // REVIEW jonathan 2010-05-07 -- The previous value that we're comparing with is the value from the last
            // computation cycle, not the value that we last emitted as a delta. It is therefore important that the
            // DeltaComparers take this into account in their implementation of isDelta. E.g. they should compare the
            // values after truncation to the required decimal place, rather than testing whether the difference of the
            // full values is greater than some threshold; this way, there will always be a point beyond which a change
            // is detected, even in the event of gradual creep.
            if (deltaDefinition.isDelta(previousValue, resultValue) || !ObjectUtils.equals(previousValue.getAggregatedExecutionLog(), resultValue.getAggregatedExecutionLog())) {
              deltaModel.addValue(calcConfigName, resultEntry.getValue());
            }
          }
        }
      }
View Full Code Here

  }

  @Override
  public ViewResultEntry buildObject(FudgeDeserializer deserializer, FudgeMsg msg) {
    String calcConfig = msg.getString(CALC_CONFIG_FIELD);
    ComputedValueResult value = deserializer.fieldValueToObject(ComputedValueResult.class, msg.getByName(VALUE_FIELD));
    return new ViewResultEntry(calcConfig, value);
  }
View Full Code Here

    return response;
  }

  protected static ComputedValueResult createComputedValueResult(final ValueSpecification valueSpec, final Object calculatedValue, final DependencyNodeJobExecutionResult jobExecutionResult) {
    if (jobExecutionResult == null) {
      return new ComputedValueResult(valueSpec, calculatedValue, AggregatedExecutionLog.EMPTY, null, null, null);
    } else {
      final CalculationJobResultItem jobResultItem = jobExecutionResult.getJobResultItem();
      return new ComputedValueResult(valueSpec,
          calculatedValue,
          jobExecutionResult.getAggregatedExecutionLog(),
          jobExecutionResult.getComputeNodeId(),
          jobResultItem.getMissingInputs(),
          jobResultItem.getResult());
View Full Code Here

    final InMemoryViewComputationResultModel fragmentResultModel = constructTemplateResultModel();
    for (CompiledViewCalculationConfiguration compiledCalcConfig : getCompiledViewDefinition().getCompiledCalculationConfigurations()) {
      String calcConfigName = compiledCalcConfig.getName();
      for (ValueSpecification valueSpec : compiledCalcConfig.getTerminalOutputSpecifications().keySet()) {
        ComputedValue value = new ComputedValue(valueSpec, MissingOutput.SUPPRESSED);
        ComputedValueResult valueResult = new ComputedValueResult(value, AggregatedExecutionLog.EMPTY);
        fragmentResultModel.addValue(calcConfigName, valueResult);
        fullResultModel.addValue(calcConfigName, valueResult);
      }
    }
    notifyFragmentCompleted(fragmentResultModel);
View Full Code Here

      final Collection<ValueSpecification> marketDataRequirements = calcConfig.getMarketDataRequirements();
      final Set<ValueSpecification> terminalOutputs = calcConfig.getTerminalOutputSpecifications().keySet();
      final Collection<ComputedValueResult> valuesToLoad = new ArrayList<>(marketDataRequirements.size());
      for (ValueSpecification marketDataSpec : marketDataRequirements) {
        Object marketDataValue = marketDataValues.get(marketDataSpec);
        ComputedValueResult computedValueResult;
        if (operation != null) {
          if (marketDataValue != null) {
            marketDataValue = operation.apply(marketDataSpec.toRequirementSpecification(), marketDataValue);
            if (marketDataValue == null) {
              s_logger.debug("Market data {} discarded by override operation", marketDataSpec);
            }
          }
        }
        if (marketDataValue == null) {
          s_logger.debug("Unable to load market data value for {} from snapshot {}", marketDataSpec, getValuationTime());
          missingMarketData++;
          // TODO provide elevated logs if requested from market data providers
          computedValueResult = new ComputedValueResult(marketDataSpec, MissingInput.MISSING_MARKET_DATA, MARKET_DATA_LOG);
        } else {
          computedValueResult = new ComputedValueResult(marketDataSpec, marketDataValue, AggregatedExecutionLog.EMPTY);
          fragmentResultModel.addMarketData(computedValueResult);
          fullResultModel.addMarketData(computedValueResult);
        }
        if (terminalOutputs.contains(marketDataSpec) && (resultModel.getOutputMode(marketDataSpec.getTargetSpecification().getType()) != ResultOutputMode.NONE)) {
          fragmentResultModel.addValue(calcConfig.getName(), computedValueResult);
View Full Code Here

    } else {
      missingInputs = null;
    }
    final String invocationResultName = msg.getString(INVOCATION_RESULT_FIELD_NAME);
    final InvocationResult invocationResult = invocationResultName != null ? InvocationResult.valueOf(invocationResultName) : null;
    return new ComputedValueResult(valueSpec, valueObject, aggregatedExecutionLog, computeNodeId, missingInputs, invocationResult);
  }
View Full Code Here

                  incCount(_failureCountBySec, keyBySec);
                  incCount(_failureCount, key);
                  _failures.increment();                 
                } else {
                  ObjectsPair<String, ValueProperties> valueKey = Pair.of(valueSpec.getValueName(), valueSpec.getProperties());
                  ComputedValueResult computedValueResult = values != null ? values.get(valueKey) : null;
                  if (computedValueResult != null) {
                    if (computedValueResult.getValue() instanceof MissingValue) {
                      incCount(_errorCountBySec, keyBySec);
                      incCount(_errorCount, key);
                      _errors.increment();
                    } else {
                      incCount(_successCountBySec, keyBySec);
View Full Code Here

    return deltaResult;
  }

  private ComputedValueResult getComputedValueResult(final String valueName, final Object value) {
    final ComputationTargetSpecification target = ComputationTargetSpecification.of(UniqueId.of("Scheme", valueName));
    return new ComputedValueResult(new ValueSpecification(valueName, target, ValueProperties.with(ValuePropertyNames.FUNCTION, "FunctionId").get()), value, AggregatedExecutionLog.EMPTY);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.value.ComputedValueResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.