Package com.opengamma.engine.depgraph

Examples of com.opengamma.engine.depgraph.DependencyGraph


    calcConfig.addPortfolioRequirementName("My Sec", "OUTPUT");
    viewDefinition.addViewCalculationConfiguration(calcConfig);
    final CompiledViewDefinitionWithGraphsImpl compiledViewDefinition = ViewDefinitionCompiler.compile(viewDefinition, vcs, Instant.now(), VersionCorrection.LATEST);
    assertTrue(compiledViewDefinition.getMarketDataRequirements().isEmpty());
    assertEquals(1, compiledViewDefinition.getDependencyGraphExplorers().size());
    final DependencyGraph dg = compiledViewDefinition.getDependencyGraphExplorer("Fibble").getWholeGraph();
    assertNotNull(dg);
    assertTrue(dg.getAllRequiredMarketData().isEmpty());
    assertEquals(2, dg.getDependencyNodes().size());
    // Expect the node and the security, since we've turned off position-level outputs and not actually provided a
    // function that can produce them
    assertTargets(compiledViewDefinition, sec2.getUniqueId(), pn.getUniqueId());
  }
View Full Code Here


  @Test
  public void testCycleSimpleGraph() {
    final ViewProcessorTestEnvironment env = new ViewProcessorTestEnvironment();
    env.init();
    final CompiledViewDefinitionWithGraphsImpl compiledViewDefinition = env.compileViewDefinition(Instant.now(), VersionCorrection.LATEST);
    final DependencyGraph graph = compiledViewDefinition.getDependencyGraphExplorer(ViewProcessorTestEnvironment.TEST_CALC_CONFIG_NAME).getWholeGraph();
    final DependencyGraph cycledGraph = cycleObject(DependencyGraph.class, graph);

    assertEquals(graph.getCalculationConfigurationName(), cycledGraph.getCalculationConfigurationName());
    assertEquals(graph.getAllComputationTargets(), cycledGraph.getAllComputationTargets());
    assertEquals(graph.getOutputSpecifications(), cycledGraph.getOutputSpecifications());
    assertEquals(graph.getSize(), cycledGraph.getSize());
    assertEquals(graph.getTerminalOutputSpecifications(), cycledGraph.getTerminalOutputSpecifications());
    //assertEquals(graph.getAllRequiredMarketData(), cycledGraph.getAllRequiredMarketData()); [PLAT-3126]

    for (final DependencyNode node : graph.getDependencyNodes()) {
      final boolean isRoot = graph.getRootNodes().contains(node);
      for (final ValueSpecification spec : node.getOutputValues()) {
        final DependencyNode equivalentNode = cycledGraph.getNodeProducing(spec);
        assertEquals(isRoot, cycledGraph.getRootNodes().contains(equivalentNode));
        assertEquals(node.getInputValues(), equivalentNode.getInputValues());
        assertEquals(node.getOutputValues(), equivalentNode.getOutputValues());
        assertEquals(node.getTerminalOutputValues(), equivalentNode.getTerminalOutputValues());
      }
    }
View Full Code Here

    final ViewProcessContext vpc = new ViewProcessContext(UniqueId.of("Process", "Test"), configSource, viewPermissionProvider,
                                                          new DefaultViewPortfolioPermissionProvider(),
                                                          marketDataProviderResolver, compilationService, functionResolver,
        computationCacheSource, jobDispatcher, new SingleThreadViewProcessWorkerFactory(), new DependencyGraphBuilderFactory(), factory, graphExecutorStatisticsProvider,
        new DummyOverrideOperationCompiler(), new EngineResourceManagerImpl<SingleComputationCycle>(), new VersionedUniqueIdSupplier("Test", "1"), new InMemoryViewExecutionCache());
    final DependencyGraph graph = new DependencyGraph("Default");
    DependencyNode previous = null;
    for (int i = 0; i < JOB_SIZE; i++) {
      final DependencyNode node = new DependencyNode(ComputationTarget.NULL);
      node.setFunction(mockFunction);
      if (previous != null) {
        node.addInputNode(previous);
      }
      graph.addDependencyNode(node);
      previous = node;
    }
    final CompiledViewDefinitionWithGraphsImpl viewEvaluationModel = new CompiledViewDefinitionWithGraphsImpl(VersionCorrection.LATEST, "", viewDefinition, Collections.singleton(graph),
        Collections.<ComputationTargetReference, UniqueId>emptyMap(), new SimplePortfolio("Test Portfolio"), 0);
    final ViewCycleExecutionOptions cycleOptions = ViewCycleExecutionOptions.builder().setValuationTime(Instant.ofEpochMilli(1)).setMarketDataSpecification(new MarketDataSpecification()).create();
View Full Code Here

  private static final Logger s_logger = LoggerFactory.getLogger(ParallelRecompilationInfiniteLatestTest.class);

  private CompiledViewDefinitionWithGraphs compiledViewDefinition(final ViewDefinition viewDefinition, final Map<ComputationTargetReference, UniqueId> resolutions) {
    final VersionCorrection versionCorrection = VersionCorrection.of(Instant.now(), Instant.now());
    final DependencyGraph graph = new DependencyGraph("Default");
    final Portfolio portfolio = Mockito.mock(Portfolio.class);
    return new CompiledViewDefinitionWithGraphsImpl(versionCorrection, "view-id", viewDefinition, Collections.singleton(graph), new HashMap<ComputationTargetReference, UniqueId>(resolutions),
        portfolio, 0);
  }
View Full Code Here

  public void testOutputModes() {
    DepGraphTestHelper helper = new DepGraphTestHelper();
    helper.addFunctionProducing1and2();
    DependencyGraphBuilder builder = helper.createBuilder(null);
    builder.addTarget(Collections.singleton(helper.getRequirement1()));
    DependencyGraph graph = builder.getDependencyGraph();
    graph.removeUnnecessaryValues();
   
    assertEquals(1, graph.getDependencyNodes().size());
    DependencyNode functionNode = graph.getDependencyNodes().iterator().next();
   
    // Nothing should be included in the output
    assertFalse(ResultOutputMode.NONE.shouldOutputFromNode(functionNode));
    assertFalse(ResultOutputMode.NONE.shouldOutputResult(helper.getSpec1(), graph));
    assertFalse(ResultOutputMode.NONE.shouldOutputResult(helper.getSpec2(), graph));
View Full Code Here

    node.addTerminalOutputValue(new ValueSpecification("V", node.getComputationTarget(), ValueProperties.with(ValuePropertyNames.FUNCTION, "Test").get()));
    return node;
  }

  private DependencyGraph graph(final DependencyNode... nodes) {
    final DependencyGraph graph = new DependencyGraph("Default");
    for (DependencyNode node : nodes) {
      graph.addDependencyNode(node);
      if (node.hasTerminalOutputValues()) {
        graph.addTerminalOutput(new ValueRequirement("V", node.getComputationTarget()), node.getTerminalOutputValues().iterator().next());
      }
    }
    return graph;
  }
View Full Code Here

      @Override
      public boolean accept(final DependencyNode node) {
        return true;
      }
    });
    DependencyGraph graph = smallGraph();
    assertSame(filter.subGraph(graph, null), graph);
    graph = largeGraph();
    assertSame(filter.subGraph(graph, null), graph);
    graph = smallGraph();
    assertSame(filter.subGraph(graph, null), graph);
View Full Code Here

   
    System.out.println(object.getDependencyGraph());
    System.out.println();
    System.out.println(cycleObject.getDependencyGraph());

    DependencyGraph objectDepGraph = object.getDependencyGraph();
    DependencyGraph cycleObjectDepGraph = cycleObject.getDependencyGraph();
   
    assertDepGraphsEqual(objectDepGraph, cycleObjectDepGraph);
    assertEquals(object.getExceptionsWithCounts(), cycleObject.getExceptionsWithCounts());
    assertEquals(object.getFailures(), cycleObject.getFailures());
    assertEquals(object.getMappings(), cycleObject.getMappings());
View Full Code Here

  /**
   * @return a basic dep graph build trace object
   */
  private DependencyGraphBuildTrace createDependencyGraphBuildTrace() {
   
    DependencyGraph dependencyGraph = createGraph();
   
    Map<Throwable, Integer> exceptions = new HashMap<>();
   
    //somewhat contrived...
    exceptions.put(new ThrowableWithClass("a null pointer", ThrowableWithClass.class), 1);
View Full Code Here

   * A very simple graph. Testing of (de)serializing more complicated graphs done in
   * {@link DependencyGraphTraceBuilderTest}.
   * @return
   */
  private DependencyGraph createGraph() {
    DependencyGraph graph = new DependencyGraph("testGraph");
    ComputationTargetSpecification targetSpecification = new ComputationTargetSpecification(ComputationTargetType.CURRENCY,
                                                                                            Currency.GBP.getUniqueId());
    DependencyNode yieldCurveNode = new DependencyNode(targetSpecification);
    ComputationTarget target = new ComputationTarget(targetSpecification, Currency.GBP);
    yieldCurveNode.setFunction(new MockFunction(target));
    yieldCurveNode.addOutputValue(new ValueSpecification("YieldCurveMarketData",
                                                         targetSpecification,
                                                         ValueProperties.builder().with("Curve", "Forward3M").with("Function", "someFunction").get()));
    graph.addDependencyNode(yieldCurveNode);
    return graph;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.depgraph.DependencyGraph

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.