private void testIfEdgeSuccessfullyAdded(String node1, String node2, String edgeName, String value) throws ExecutionException, InterruptedException { Set<FlowEdge> edgeSet = this.flowGraph.getEdges(node1); Assert.assertEquals(edgeSet.size(), 1); FlowEdge flowEdge = edgeSet.iterator().next(); Assert.assertEquals(flowEdge.getId(), Joiner.on(":").join(node1, node2, edgeName)); Assert.assertEquals(flowEdge.getSrc(), node1); Assert.assertEquals(flowEdge.getDest(), node2); Assert.assertEquals(flowEdge.getExecutors().get(0).getConfig().get().getString("specStore.fs.dir"), "/tmp1"); Assert.assertEquals(flowEdge.getExecutors().get(0).getConfig().get().getString("specExecInstance.capabilities"), "s1:d1"); Assert.assertEquals(flowEdge.getExecutors().get(0).getClass().getSimpleName(), "InMemorySpecExecutor"); Assert.assertEquals(flowEdge.getExecutors().get(1).getConfig().get().getString("specStore.fs.dir"), "/tmp2"); Assert.assertEquals(flowEdge.getExecutors().get(1).getConfig().get().getString("specExecInstance.capabilities"), "s2:d2"); Assert.assertEquals(flowEdge.getExecutors().get(1).getClass().getSimpleName(), "InMemorySpecExecutor"); Assert.assertEquals(flowEdge.getConfig().getString("key1"), value); }
Config specExecutorConfig; try { specExecutorConfig = jobExecutionPlan.getSpecExecutor().getConfig().get(); } catch (InterruptedException | ExecutionException e) { log.error("Error serializing JobExecutionPlan {}", jobExecutionPlan.toString());
Assert.assertEquals(flowEdge.getSrc(), "node1"); Assert.assertEquals(flowEdge.getDest(), "node2"); Assert.assertEquals(flowEdge.getExecutors().get(0).getConfig().get().getString("specStore.fs.dir"),"/tmp1"); Assert.assertEquals(flowEdge.getExecutors().get(0).getConfig().get().getString("specExecInstance.capabilities"),"s1:d1"); Assert.assertEquals(flowEdge.getExecutors().get(1).getConfig().get().getString("specStore.fs.dir"),"/tmp2"); Assert.assertEquals(flowEdge.getExecutors().get(1).getConfig().get().getString("specExecInstance.capabilities"),"s2:d2"); Assert.assertEquals(flowEdge.getExecutors().get(0).getClass().getSimpleName(),"InMemorySpecExecutor"); Assert.assertEquals(flowEdge.getExecutors().get(1).getClass().getSimpleName(),"InMemorySpecExecutor");
/** * Build the merged config for each {@link FlowEdge}, which is a combination of (in the precedence described below): * <ul> * <p> the user provided flow config </p> * <p> edge specific properties/overrides </p> * <p> spec executor config/overrides </p> * <p> source node config </p> * <p> destination node config </p> * </ul> * Each {@link JobTemplate}'s config will eventually be resolved against this merged config. * @param flowEdge An instance of {@link FlowEdge}. * @param specExecutor A {@link SpecExecutor}. * @return the merged config derived as described above. */ private Config getMergedConfig(FlowEdge flowEdge, SpecExecutor specExecutor) throws ExecutionException, InterruptedException { Config srcNodeConfig = this.flowGraph.getNode(flowEdge.getSrc()).getRawConfig().atPath(SOURCE_PREFIX); Config destNodeConfig = this.flowGraph.getNode(flowEdge.getDest()).getRawConfig().atPath(DESTINATION_PREFIX); Config mergedConfig = flowConfig.withFallback(specExecutor.getConfig().get()).withFallback(flowEdge.getConfig()) .withFallback(srcNodeConfig).withFallback(destNodeConfig); return mergedConfig; }
Config specExecutorConfig; try { specExecutorConfig = jobExecutionPlan.getSpecExecutor().getConfig().get(); } catch (InterruptedException | ExecutionException e) { log.error("Error serializing JobExecutionPlan {}", jobExecutionPlan.toString());