use of org.apache.flink.client.program.PreviewPlanEnvironment in project flink by apache.
the class StreamPlanEnvironment method execute.
@Override
public JobExecutionResult execute(String jobName) throws Exception {
StreamGraph streamGraph = getStreamGraph();
streamGraph.setJobName(jobName);
transformations.clear();
if (env instanceof OptimizerPlanEnvironment) {
((OptimizerPlanEnvironment) env).setPlan(streamGraph);
} else if (env instanceof PreviewPlanEnvironment) {
((PreviewPlanEnvironment) env).setPreview(streamGraph.getStreamingPlanAsJSON());
}
throw new OptimizerPlanEnvironment.ProgramAbortException();
}
use of org.apache.flink.client.program.PreviewPlanEnvironment in project flink by apache.
the class DumpCompiledPlanTest method dumpIterativeKMeans.
@Test
public void dumpIterativeKMeans() {
// prepare the test environment
PreviewPlanEnvironment env = new PreviewPlanEnvironment();
env.setAsContext();
try {
KMeans.main(new String[] { "--points ", IN_FILE, "--centroids ", IN_FILE, "--output ", OUT_FILE, "--iterations", "123" });
} catch (OptimizerPlanEnvironment.ProgramAbortException pae) {
// all good.
} catch (Exception e) {
e.printStackTrace();
Assert.fail("KMeans failed with an exception");
}
dump(env.getPlan());
}
use of org.apache.flink.client.program.PreviewPlanEnvironment in project flink by apache.
the class PreviewPlanDumpTest method dumpBulkIterationKMeans.
@Test
public void dumpBulkIterationKMeans() {
// prepare the test environment
PreviewPlanEnvironment env = new PreviewPlanEnvironment();
env.setAsContext();
try {
ConnectedComponents.main(new String[] { "--vertices", IN_FILE, "--edges", IN_FILE, "--output", OUT_FILE, "--iterations", "123" });
} catch (OptimizerPlanEnvironment.ProgramAbortException pae) {
// all good.
} catch (Exception e) {
e.printStackTrace();
Assert.fail("ConnectedComponents failed with an exception");
}
dump(env.getPlan());
}
use of org.apache.flink.client.program.PreviewPlanEnvironment in project flink by apache.
the class PreviewPlanDumpTest method dumpIterativeKMeans.
@Test
public void dumpIterativeKMeans() {
// prepare the test environment
PreviewPlanEnvironment env = new PreviewPlanEnvironment();
env.setAsContext();
try {
KMeans.main(new String[] { "--points ", IN_FILE, "--centroids ", IN_FILE, "--output ", OUT_FILE, "--iterations", "123" });
} catch (OptimizerPlanEnvironment.ProgramAbortException pae) {
// all good.
} catch (Exception e) {
e.printStackTrace();
Assert.fail("KMeans failed with an exception");
}
dump(env.getPlan());
}
use of org.apache.flink.client.program.PreviewPlanEnvironment in project flink by apache.
the class PreviewPlanDumpTest method dumpWordCount.
@Test
public void dumpWordCount() {
// prepare the test environment
PreviewPlanEnvironment env = new PreviewPlanEnvironment();
env.setAsContext();
try {
WordCount.main(new String[] { "--input", IN_FILE, "--output", OUT_FILE });
} catch (OptimizerPlanEnvironment.ProgramAbortException pae) {
// all good.
} catch (Exception e) {
e.printStackTrace();
Assert.fail("WordCount failed with an exception");
}
dump(env.getPlan());
}
Aggregations