Package com.opengamma.engine.depgraph

Examples of com.opengamma.engine.depgraph.DependencyGraph


    builder.setResolutionFailureListener(resolutionFailureAccumulator);
    builder.setDisableFailureReporting(false);
    for (final ValueRequirement requirement : properties.getRequirements()) {
      builder.addTarget(requirement);
    }
    DependencyGraph dependencyGraph = builder.getDependencyGraph();
    List<ResolutionFailure> resolutionFailures = resolutionFailureAccumulator.getResolutionFailures();

    DependencyGraphBuildTrace graphBuildTrace = DependencyGraphBuildTrace.of(
        dependencyGraph,
        builder.getExceptions(),
View Full Code Here


  private static final Logger s_logger = LoggerFactory.getLogger(DependencyGraphBuildTraceFudgeBuilder.class);
 
  @Override
  public MutableFudgeMsg buildMessage(FudgeSerializer serializer, DependencyGraphBuildTrace object) {
    MutableFudgeMsg result = serializer.newMessage();
    final DependencyGraph graph = object.getDependencyGraph();
    serializer.addToMessage(result, "dependencyGraph", null, graph);
    final Map<Throwable, Integer> exceptions = object.getExceptionsWithCounts();
    for (final Map.Entry<Throwable, Integer> exception : exceptions.entrySet()) {
      final MutableFudgeMsg submessage = serializer.newMessage();
      submessage.add("class", exception.getKey().getClass().getName());
View Full Code Here

    return result;
  }

  @Override
  public DependencyGraphBuildTrace buildObject(FudgeDeserializer deserializer, FudgeMsg message) {
    DependencyGraph dependencyGraph = deserializer.fudgeMsgToObject(DependencyGraph.class, message.getMessage("dependencyGraph"));
    Map<Throwable, Integer> exceptionsWithCounts = new LinkedHashMap<>();
    List<FudgeField> exceptionSubMessages = message.getAllByName("exception");
    for (FudgeField field : exceptionSubMessages) {
      FudgeMsg subMessage = (FudgeMsg) field.getValue();
      String clazzName = subMessage.getString("class");
View Full Code Here

  private Map<String, DependencyGraph> getGraphs(final CompiledViewDefinitionWithGraphs defn) {
    final HashMap<String, DependencyGraph> ret = new HashMap<String, DependencyGraph>();
    for (final CompiledViewCalculationConfiguration config : defn.getCompiledCalculationConfigurations()) {
      final String configName = config.getName();
      final DependencyGraph graph = defn.getDependencyGraphExplorer(configName).getWholeGraph();
      ret.put(configName, graph);
    }
    return ret;
  }
View Full Code Here

  private ManageableUnstructuredMarketDataSnapshot getGlobalAndUnresolvedValues(final ExternalIdBundleResolver resolver, final ViewComputationResultModel results,
      final Map<String, DependencyGraph> graphs) {
    final ManageableUnstructuredMarketDataSnapshot snapshot = new ManageableUnstructuredMarketDataSnapshot();
    for (final Entry<String, DependencyGraph> graphEntry : graphs.entrySet()) {
      final DependencyGraph graph = graphEntry.getValue();
      Set<ValueSpecification> resolvedValues = Sets.newHashSet();
      for (ComputedValue computedValue : results.getAllMarketData()) {
        resolvedValues.add(computedValue.getSpecification());
        final DependencyNode nodeProducing = graph.getNodeProducing(computedValue.getSpecification());
        if ((nodeProducing != null) && isTerminalUnstructuredOutput(nodeProducing, graph)) {
          ExternalIdBundle identifiers = resolveExternalIdBundle(resolver, computedValue.getSpecification());
          if (identifiers != null) {
            snapshot.putValue(identifiers, computedValue.getSpecification().getValueName(), new ValueSnapshot(computedValue.getValue()));
          }
        }
      }
      //missing values go over the wire as nulls
      SetView<ValueSpecification> missingValues = Sets.difference(graph.getAllRequiredMarketData(), resolvedValues);
      for (ValueSpecification missingValue : missingValues) {
        ExternalIdBundle missingExternalIdBundle = resolveExternalIdBundle(resolver, missingValue);
        snapshot.putValue(missingExternalIdBundle, missingValue.getValueName(), null);
      }
    }
View Full Code Here

    final CompiledViewDefinitionWithGraphs defn = cycle.getCompiledViewDefinition();
    final Map<String, DependencyGraph> graphs = getGraphs(defn);

    final Map<YieldCurveKey, Map<String, ValueRequirement>> ret = new HashMap<YieldCurveKey, Map<String, ValueRequirement>>();
    for (final Entry<String, DependencyGraph> entry : graphs.entrySet()) {
      final DependencyGraph graph = entry.getValue();
      for (final DependencyNode node : graph.getDependencyNodes()) {
        for (final ValueSpecification outputValue : node.getOutputValues()) {
          if (outputValue.getValueName().equals(ValueRequirementNames.YIELD_CURVE)) {
            addAll(ret, outputValue);
          } else if (outputValue.getValueName().equals(ValueRequirementNames.YIELD_CURVE_SPEC)) {
            final YieldCurveKey key = _yieldCurveSnapper.getKey(outputValue);
View Full Code Here

      final String specName) {
    final Map<String, Collection<ValueSpecification>> ret = new HashMap<String, Collection<ValueSpecification>>();

    for (final Entry<String, DependencyGraph> kvp : graphs.entrySet()) {
      final String config = kvp.getKey();
      final DependencyGraph graph = kvp.getValue();

      final Set<DependencyNode> nodes = graph.getDependencyNodes();
      final Iterable<Iterable<ValueSpecification>> specs = Iterables.transform(nodes,
          new Function<DependencyNode, Iterable<ValueSpecification>>() {

            @Override
            public Iterable<ValueSpecification> apply(final DependencyNode input) {
View Full Code Here

   *            \ /
   *             4
   * </pre>
   */
  private DependencyGraph getTestGraph() {
    final DependencyGraph graph = new DependencyGraph("test");
    _node0 = createNode("Node0", Collections.<DependencyNode>emptySet());
    _node1 = createNode("Node1", Collections.<DependencyNode>emptySet());
    _node2 = createNode("Node2", Sets.newHashSet(_node0, _node1));
    _node3 = createNode("Node3", Sets.newHashSet(_node1));
    _node4 = createNode("Node4", Sets.newHashSet(_node2, _node3));
    graph.addDependencyNode(_node0);
    graph.addDependencyNode(_node1);
    graph.addDependencyNode(_node2);
    graph.addDependencyNode(_node3);
    graph.addDependencyNode(_node4);
    return graph;
  }
View Full Code Here

  private final ValueSpecification _testValuex2 = ValueSpecification.of("Test", ComputationTargetType.PRIMITIVE, UniqueId.of("test", "x2"), _properties);
  private final ValueSpecification _testValuex3 = ValueSpecification.of("Test", ComputationTargetType.PRIMITIVE, UniqueId.of("test", "x3"), _properties);

  @BeforeMethod
  public void createGraph() {
    _testGraph = new DependencyGraph("Default");
    _testNode = new DependencyNode[5];
    for (int i = 0; i < _testNode.length; i++) {
      final ComputationTarget target = new ComputationTarget(ComputationTargetType.PRIMITIVE, UniqueId.of("Test", Integer.toString(i)));
      _testNode[i] = new DependencyNode(target);
      _testNode[i].setFunction(MockFunction.getMockFunction(target, "foo"));
View Full Code Here

  }

  @Test
  public void testDependencyNodeFudgeCycle() {
   
    DependencyGraph cycledGraph = cycleObject(DependencyGraph.class, _testGraph);
   
    assertEquals(_testGraph.getCalculationConfigurationName(), cycledGraph.getCalculationConfigurationName());
    assertEquals(_testGraph.getAllComputationTargets(), cycledGraph.getAllComputationTargets());
    assertEquals(_testGraph.getOutputSpecifications(), cycledGraph.getOutputSpecifications());
    assertEquals(_testGraph.getSize(), cycledGraph.getSize());
    assertEquals(_testGraph.getTerminalOutputSpecifications(), cycledGraph.getTerminalOutputSpecifications());
   
    for (DependencyNode node : _testGraph.getDependencyNodes()) {
      boolean isRoot = _testGraph.getRootNodes().contains(node);
      for (ValueSpecification spec : node.getOutputValues()) {
        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());
        assertEquals(node.getFunction().getFunction().getFunctionDefinition().getShortName(), equivalentNode.getFunction().getFunction().getFunctionDefinition().getShortName());
        assertEquals(node.getFunction().getFunction().getFunctionDefinition().getUniqueId(), equivalentNode.getFunction().getFunction().getFunctionDefinition().getUniqueId());
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.