Search in sources :

Example 1 with DetachedEnvironment

use of org.apache.flink.client.program.DetachedEnvironment in project flink by apache.

the class StreamContextEnvironment method execute.

@Override
public JobExecutionResult execute(String jobName) throws Exception {
    Preconditions.checkNotNull("Streaming Job name should not be null.");
    StreamGraph streamGraph = this.getStreamGraph();
    streamGraph.setJobName(jobName);
    transformations.clear();
    // execute the programs
    if (ctx instanceof DetachedEnvironment) {
        LOG.warn("Job was executed in detached mode, the results will be available on completion.");
        ((DetachedEnvironment) ctx).setDetachedPlan(streamGraph);
        return DetachedEnvironment.DetachedJobExecutionResult.INSTANCE;
    } else {
        return ctx.getClient().run(streamGraph, ctx.getJars(), ctx.getClasspaths(), ctx.getUserCodeClassLoader(), ctx.getSavepointRestoreSettings()).getJobExecutionResult();
    }
}
Also used : DetachedEnvironment(org.apache.flink.client.program.DetachedEnvironment) StreamGraph(org.apache.flink.streaming.api.graph.StreamGraph)

Aggregations

DetachedEnvironment (org.apache.flink.client.program.DetachedEnvironment)1 StreamGraph (org.apache.flink.streaming.api.graph.StreamGraph)1