Package com.opengamma.engine.view

Examples of com.opengamma.engine.view.AggregatedExecutionLog


public class DependencyNodeJobExecutionResultTest {

  public void testGetters() {
    final String nodeId = "Node";
    final CalculationJobResultItem resultItem = new CalculationJobResultItem(Collections.<ValueSpecification>emptySet(), Collections.<ValueSpecification>emptySet(), ExecutionLog.EMPTY);
    final AggregatedExecutionLog logs = AggregatedExecutionLog.EMPTY;
    final DependencyNodeJobExecutionResult result = new DependencyNodeJobExecutionResult(nodeId, resultItem, logs);
    assertSame(result.getComputeNodeId(), nodeId);
    assertSame(result.getJobResultItem(), resultItem);
    assertSame(result.getAggregatedExecutionLog(), logs);
  }
View Full Code Here


    final String nodeId1 = "Node1";
    final String nodeId2 = "Node2";
    final CalculationJobResultItem resultItem1 = new CalculationJobResultItem(Collections.<ValueSpecification>emptySet(), Collections.<ValueSpecification>emptySet(), ExecutionLog.EMPTY);
    final CalculationJobResultItem resultItem2 = new CalculationJobResultItem(Collections.<ValueSpecification>emptySet(), Collections.<ValueSpecification>emptySet(), MutableExecutionLog.single(
        SimpleLogEvent.of(LogLevel.WARN, "Foo"), ExecutionLogMode.FULL));
    final AggregatedExecutionLog logs1 = AggregatedExecutionLog.EMPTY;
    final AggregatedExecutionLog logs2 = new DefaultAggregatedExecutionLog(EnumSet.of(LogLevel.WARN), null, true);
    return new DependencyNodeJobExecutionResult[] {
        new DependencyNodeJobExecutionResult(nodeId1, resultItem1, logs1),
        new DependencyNodeJobExecutionResult(nodeId1, resultItem1, logs2),
        new DependencyNodeJobExecutionResult(nodeId2, resultItem1, logs1),
        new DependencyNodeJobExecutionResult(nodeId2, resultItem1, logs2),
View Full Code Here

      Object formattedValue = _formatter.format(cellValue, cellValueSpec, cell.getFormat(), cell.getInlineKey());
      Collection<Object> history = cell.getHistory();
      Class<?> columnType = cell.getType();
      DataType columnFormat = _formatter.getDataType(columnType);
      Map<String, Object> valueMap = Maps.newHashMap();
      AggregatedExecutionLog executionLog = cell.getExecutionLog();
      LogLevel logLevel = maxLogLevel(executionLog);

      valueMap.put(VALUE, formattedValue);
      if (columnFormat == UNKNOWN) {
        // if the the column type isn't known then send the type with the value
View Full Code Here

          return ResultsCell.forStaticValue(valueSpec.getValueName(), columnType, format);
        case VALUE_COL:
          ResultsCache.Result cacheResult = cache.getResult(_calcConfigName, valueSpec, null);
          Collection<Object> history = cacheResult.getHistory();
          Object value = cacheResult.getValue();
          AggregatedExecutionLog executionLog = cacheResult.getAggregatedExecutionLog();
          return ResultsCell.forCalculatedValue(value, valueSpec, history, executionLog, cacheResult.isUpdated(), columnType, format);
        case FUNCTION_NAME_COL:
          String fnName = _fnNames.get(rowIndex);
          return ResultsCell.forStaticValue(fnName, columnType, format);
        case PROPERTIES_COL:
View Full Code Here

      } else {
        getCycle().markExecuted(node);
      }
      // Process the streamed result fragment
      final ExecutionLogMode executionLogMode = logModes.getLogMode(node);
      final AggregatedExecutionLog aggregatedExecutionLog;
      if (executionLogMode == ExecutionLogMode.FULL) {
        final ExecutionLog log = jobResultItem.getExecutionLog();
        MutableExecutionLog logCopy = null;
        final Set<AggregatedExecutionLog> inputLogs = new LinkedHashSet<AggregatedExecutionLog>();
        Set<ValueSpecification> missing = jobResultItem.getMissingInputs();
View Full Code Here

  @Override
  public ComputedValueResult buildObject(final FudgeDeserializer deserializer, final FudgeMsg msg) {
    final ValueSpecification valueSpec = ComputedValueFudgeBuilder.getValueSpecification(deserializer, msg);
    final Object valueObject = ComputedValueFudgeBuilder.getValueObject(deserializer, msg);
    final AggregatedExecutionLog aggregatedExecutionLog = deserializer.fieldValueToObject(DefaultAggregatedExecutionLog.class, msg.getByName(AGGREGATED_EXECUTION_LOG_FIELD));
    final String computeNodeId = msg.getString(COMPUTE_NODE_ID_FIELD);
    final FudgeMsg missingInputsMsg = msg.getMessage(MISSING_INPUTS_FIELD_NAME);
    final Set<ValueSpecification> missingInputs;
    if (missingInputsMsg != null) {
      missingInputs = Sets.newHashSetWithExpectedSize(missingInputsMsg.getNumFields());
View Full Code Here

    assertEquals(1, result1.getAllResults().size());
    final ComputedValueResult result1Value = Iterables.getOnlyElement(result1.getAllResults()).getComputedValue();
    assertEquals("result2", result1Value.getValue());

    final AggregatedExecutionLog log1 = result1Value.getAggregatedExecutionLog();
    assertNotNull(log1);
    assertTrue(log1.getLogLevels().contains(LogLevel.ERROR));
    assertTrue(log1.getLogLevels().contains(LogLevel.WARN));
    assertFalse(log1.getLogLevels().contains(LogLevel.INFO));
    assertNull(log1.getLogs());

    final Pair<String, ValueSpecification> resultSpec = Pair.of(calcConfig.getName(), Iterables.getOnlyElement(client.getLatestCompiledViewDefinition().getTerminalValuesRequirements().keySet()));
    client.setMinimumLogMode(ExecutionLogMode.FULL, ImmutableSet.of(resultSpec));

    final ViewProcessImpl viewProcess = env.getViewProcess(vp, client.getUniqueId());
    final ViewProcessWorker worker = env.getCurrentWorker(viewProcess);
    worker.triggerCycle();

    final ViewComputationResultModel result2 = resultListener.getCycleCompleted(TIMEOUT).getFullResult();
    assertEquals(0, resultListener.getQueueSize());

    assertEquals(1, result2.getAllResults().size());
    final ComputedValueResult result2Value = Iterables.getOnlyElement(result2.getAllResults()).getComputedValue();
    assertEquals("result2", result2Value.getValue());

    final AggregatedExecutionLog log2 = result2Value.getAggregatedExecutionLog();
    assertNotNull(log2);
    assertTrue(log2.getLogLevels().contains(LogLevel.ERROR));
    assertTrue(log2.getLogLevels().contains(LogLevel.WARN));
    assertFalse(log2.getLogLevels().contains(LogLevel.INFO));
    assertNotNull(log2.getLogs());
    assertEquals(2, log2.getLogs().size());

    final ExecutionLogWithContext result2LogContext = log2.getLogs().get(0);
    assertNotNull(result2LogContext);
    assertEquals(fn2.getFunctionDefinition().getShortName(), result2LogContext.getFunctionName());
    assertEquals(resultSpec.getSecond().getTargetSpecification(), result2LogContext.getTargetSpecification());
    final ExecutionLog result2Log = result2LogContext.getExecutionLog();
    assertEquals(1, result2Log.getEvents().size());
    final LogEvent result2Event1 = result2Log.getEvents().get(0);
    assertEquals(LogLevel.WARN, result2Event1.getLevel());
    assertEquals("Warning during execution", result2Event1.getMessage());
    assertNull(result2Log.getExceptionClass());
    assertNull(result2Log.getExceptionMessage());
    assertNull(result2Log.getExceptionStackTrace());

    final ExecutionLogWithContext result1LogContext = log2.getLogs().get(1);
    assertNotNull(result1LogContext);
    assertEquals(fn1.getFunctionDefinition().getShortName(), result1LogContext.getFunctionName());
    assertEquals(resultSpec.getSecond().getTargetSpecification(), result1LogContext.getTargetSpecification());
    final ExecutionLog result1Log = result1LogContext.getExecutionLog();
    assertEquals(2, result1Log.getEvents().size());
    final LogEvent result1Event1 = result1Log.getEvents().get(0);
    assertEquals(LogLevel.WARN, result1Event1.getLevel());
    assertEquals("Warning during execution", result1Event1.getMessage());
    final LogEvent result1Event2 = result1Log.getEvents().get(1);
    assertEquals(LogLevel.ERROR, result1Event2.getLevel());
    assertEquals("Error during execution", result1Event2.getMessage());
    assertNull(result1Log.getExceptionClass());
    assertNull(result1Log.getExceptionMessage());
    assertNull(result1Log.getExceptionStackTrace());

    client.setMinimumLogMode(ExecutionLogMode.INDICATORS, ImmutableSet.of(resultSpec));
    worker.triggerCycle();

    final ViewComputationResultModel result3 = resultListener.getCycleCompleted(TIMEOUT).getFullResult();
    assertEquals(0, resultListener.getQueueSize());

    assertEquals(1, result3.getAllResults().size());
    final ComputedValueResult result3Value = Iterables.getOnlyElement(result3.getAllResults()).getComputedValue();
    assertEquals("result2", result3Value.getValue());

    final AggregatedExecutionLog log3 = result3Value.getAggregatedExecutionLog();
    assertNotNull(log3);
    // Delta cycle - should reuse the previous result which *does* include logs.
    assertNotNull(log3.getLogs());

    // Force a full cycle - should *not* reuse any previous result, so back to indicators only
    // TODO: [PLAT-3215] This is bad; future optimizations will not necessarily mean a full cycle happens just because a new view definition got posted
    vd.setUniqueId(UniqueId.of(vd.getUniqueId().getScheme(), vd.getUniqueId().getValue(), "PLAT-3215"));
    worker.updateViewDefinition(vd);
    worker.triggerCycle();

    resultListener.assertViewDefinitionCompiled(TIMEOUT);
    final ViewComputationResultModel result4 = resultListener.getCycleCompleted(TIMEOUT).getFullResult();
    assertEquals(0, resultListener.getQueueSize());

    assertEquals(1, result4.getAllResults().size());
    final ComputedValueResult result4Value = Iterables.getOnlyElement(result4.getAllResults()).getComputedValue();
    assertEquals("result2", result4Value.getValue());

    final AggregatedExecutionLog log4 = result4Value.getAggregatedExecutionLog();
    assertNotNull(log4);
    assertNull(log4.getLogs());
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.view.AggregatedExecutionLog

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.