/** * Returns the outbound edges connected to the vertex with the given name. */ @Nonnull public List<Edge> getOutboundEdges(@Nonnull String vertexName) { if (!nameToVertex.containsKey(vertexName)) { throw new IllegalArgumentException("No vertex with name '" + vertexName + "' found in this DAG"); } List<Edge> outboundEdges = new ArrayList<>(); for (Edge edge : edges) { if (edge.getSourceName().equals(vertexName)) { outboundEdges.add(edge); } } return outboundEdges; }
labels.add(e.getRoutingPolicy().toString().toLowerCase()); boolean inSubgraph = e.getSourceName().equals(e.getDestName() + FIRST_STAGE_VERTEX_NAME_SUFFIX); if (inSubgraph) { builder.append("\tsubgraph cluster_").append(clusterCount++).append(" {\n") .append("\"").append(escapeGraphviz(e.getSourceName())).append("\"") .append(" -> ") .append("\"").append(escapeGraphviz(e.getDestName())).append("\"");
throw new IllegalArgumentException("This DAG already has an edge between '" + edge.getSourceName() + "' and '" + edge.getDestName() + '\''); throw new IllegalArgumentException( containsVertexName(edge.getSource()) ? "This DAG has a vertex called '" + edge.getSourceName() + "', but the supplied edge's source is a different vertex with the same name" : "Source vertex '" + edge.getSourceName() + "' is not in this DAG" ); ? ", use Edge.from().to() to specify another ordinal" : "")); if (getOutboundEdges(edge.getSourceName()) .stream().anyMatch(e -> e.getSourceOrdinal() == edge.getSourceOrdinal())) { throw new IllegalArgumentException("Vertex '" + edge.getSourceName() + "' already has an outbound edge at ordinal " + edge.getSourceOrdinal() + (edge.getSourceOrdinal() == 0 && edge.getDestOrdinal() == 0 throw new IllegalArgumentException("Attempted to add an edge from " + edge.getSourceName() + " to itself");
final int totalParallelism = localParallelism * clusterSize; final List<EdgeDef> inbound = toEdgeDefs(dag.getInboundEdges(vertex.getName()), defaultEdgeConfig, e -> vertexIdMap.get(e.getSourceName()), isJobDistributed); final List<EdgeDef> outbound = toEdgeDefs(dag.getOutboundEdges(vertex.getName()), defaultEdgeConfig, e -> vertexIdMap.get(e.getDestName()), isJobDistributed);
@Override public void writeData(@Nonnull ObjectDataOutput out) throws IOException { out.writeUTF(getSourceName()); out.writeInt(getSourceOrdinal()); out.writeUTF(getDestName()); out.writeInt(getDestOrdinal()); out.writeInt(getPriority()); out.writeBoolean(isDistributed()); out.writeObject(getRoutingPolicy()); CustomClassLoadedObject.write(out, getPartitioner()); out.writeObject(getConfig()); }
for (Edge e : this.edges) { JsonObject edge = new JsonObject(); edge.add("from", e.getSourceName()); edge.add("fromOrdinal", e.getSourceOrdinal()); edge.add("to", e.getDestName());