@Override public void afterPropertiesSet() throws Exception { flow = createFlow(); if (skipStrategy != null) { flow.setFlowSkipStrategy(skipStrategy); } if (stepStrategy != null) { flow.setFlowStepStrategy(stepStrategy); } if (listeners != null) { for (FlowListener listener : listeners) { flow.addListener(listener); } } if (StringUtils.hasText(writeDOT)) { flow.writeDOT(writeDOT); } if (StringUtils.hasText(writeStepsDOT)) { flow.writeStepsDOT(writeStepsDOT); } if (priority != null) { flow.setSubmitPriority(priority); } }
flow.writeDOT( flowPlanPath );
protected void performTest( String inputData, Fields predictedFields, Fields expectedFields, EnsembleSpec<TreeSpec> ensembleSpec ) throws IOException { Pipe pipe = new Pipe( "head" ); pipe = new Discard( pipe, predictedFields ); pipe = new ParallelEnsembleAssembly( pipe, ensembleSpec ); pipe = new Pipe( "tail", pipe ); Tap source = getPlatform().getDelimitedFile( expectedFields.append( predictedFields ), true, ",", "\"", DATA_PATH + inputData, SinkMode.KEEP ); Tap sink = getPlatform().getDelimitedFile( Fields.ALL, true, ",", "\"", getResultPath(), SinkMode.REPLACE ); FlowDef flowDef = FlowDef.flowDef() .addSource( "head", source ) .addSink( "tail", sink ) .addTail( pipe ); Flow flow = getPlatform().getFlowConnector().connect( flowDef ); flow.writeDOT( getFlowPlanPath() + "/plan.dot" ); flow.complete(); Fields sourceSelector = source.getSourceFields(); Fields sinkSelector = sink.getSinkFields(); LOG.debug( "source select = {}", sourceSelector.printVerbose() ); LOG.debug( "sink select = {}", sinkSelector.printVerbose() ); List<Tuple> sourceTuples = asList( flow, source, sourceSelector ); List<Tuple> sinkTuples = asList( flow, sink, sinkSelector ); assertEquals( sourceTuples, sinkTuples, 0.000001d ); } }
/** * sanity check to make sure writeDOT still works * * @throws Exception */ @Test public void testWriteDot() throws Exception { Tap source = getPlatform().getTextFile( "input" ); Tap sink = getPlatform().getTextFile( "unknown" ); Pipe pipe = new Pipe( "test" ); pipe = new Each( pipe, new Fields( "line" ), new RegexSplitter( Fields.UNKNOWN ) ); pipe = new Each( pipe, new Debug() ); pipe = new Each( pipe, new Fields( 2 ), new Identity( new Fields( "label" ) ) ); pipe = new Each( pipe, new Debug() ); pipe = new Each( pipe, new Fields( "label" ), new RegexFilter( "[A-Z]*" ) ); pipe = new Each( pipe, new Debug() ); pipe = new GroupBy( pipe, Fields.ALL ); pipe = new GroupBy( pipe, Fields.ALL ); Flow flow = getPlatform().getFlowConnector().connect( source, sink, pipe ); String outputPath = getOutputPath( "writedot.dot" ); flow.writeDOT( outputPath ); assertTrue( new File( outputPath ).exists() ); outputPath = getOutputPath( "writestepdot.dot" ); flow.writeStepsDOT( outputPath ); assertTrue( new File( outputPath ).exists() ); }
/** * sanity check to make sure writeDOT still works * * @throws Exception */ @Test public void testWriteDot() throws Exception { Tap source = getPlatform().getTextFile( "input" ); Tap sink = getPlatform().getTextFile( "unknown" ); Pipe pipe = new Pipe( "test" ); pipe = new Each( pipe, new Fields( "line" ), new RegexSplitter( Fields.UNKNOWN ) ); pipe = new Each( pipe, new Debug() ); pipe = new Each( pipe, new Fields( 2 ), new Identity( new Fields( "label" ) ) ); pipe = new Each( pipe, new Debug() ); pipe = new Each( pipe, new Fields( "label" ), new RegexFilter( "[A-Z]*" ) ); pipe = new Each( pipe, new Debug() ); pipe = new GroupBy( pipe, Fields.ALL ); pipe = new GroupBy( pipe, Fields.ALL ); Flow flow = getPlatform().getFlowConnector().connect( source, sink, pipe ); String outputPath = getOutputPath( "writedot.dot" ); flow.writeDOT( outputPath ); assertTrue( new File( outputPath ).exists() ); outputPath = getOutputPath( "writestepdot.dot" ); flow.writeStepsDOT( outputPath ); assertTrue( new File( outputPath ).exists() ); }
flow.writeDOT("data/newsclip.dot"); flow.complete();
flow.writeDOT( getName() + ".dot" ); // use display name
flow.writeDOT( getName() + ".dot" ); // use display name