use of org.apache.flink.client.program.OptimizerPlanEnvironment 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.OptimizerPlanEnvironment in project beam by apache.
the class FlinkRunnerTest method testEnsureStdoutStdErrIsRestored.
@Test
public void testEnsureStdoutStdErrIsRestored() throws Exception {
PackagedProgram packagedProgram = getPackagedProgram();
OptimizerPlanEnvironment env = getOptimizerPlanEnvironment();
try {
// Flink will throw an error because no job graph will be generated by the main method
getPipeline(env, packagedProgram);
Assert.fail("This should have failed to create the Flink Plan.");
} catch (ProgramInvocationException e) {
// Test that Flink wasn't able to intercept the stdout/stderr and we printed to the regular
// output instead
MatcherAssert.assertThat(e.getMessage(), allOf(StringContains.containsString("System.out: (none)"), StringContains.containsString("System.err: (none)")));
}
}
Aggregations