Search in sources :

Example 1 with RuntimeExecutionMode

use of org.apache.flink.api.common.RuntimeExecutionMode in project flink by apache.

the class StreamGraphGenerator method shouldExecuteInBatchMode.

private boolean shouldExecuteInBatchMode() {
    final RuntimeExecutionMode configuredMode = configuration.get(ExecutionOptions.RUNTIME_MODE);
    final boolean existsUnboundedSource = existsUnboundedSource();
    checkState(configuredMode != RuntimeExecutionMode.BATCH || !existsUnboundedSource, "Detected an UNBOUNDED source with the '" + ExecutionOptions.RUNTIME_MODE.key() + "' set to 'BATCH'. " + "This combination is not allowed, please set the '" + ExecutionOptions.RUNTIME_MODE.key() + "' to STREAMING or AUTOMATIC");
    if (checkNotNull(configuredMode) != RuntimeExecutionMode.AUTOMATIC) {
        return configuredMode == RuntimeExecutionMode.BATCH;
    }
    return !existsUnboundedSource;
}
Also used : RuntimeExecutionMode(org.apache.flink.api.common.RuntimeExecutionMode)

Example 2 with RuntimeExecutionMode

use of org.apache.flink.api.common.RuntimeExecutionMode in project flink by apache.

the class DefaultExecutor method createPipeline.

@Override
public Pipeline createPipeline(List<Transformation<?>> transformations, ReadableConfig tableConfiguration, @Nullable String defaultJobName) {
    // reconfigure before a stream graph is generated
    executionEnvironment.configure(tableConfiguration);
    // create stream graph
    final RuntimeExecutionMode mode = getConfiguration().get(ExecutionOptions.RUNTIME_MODE);
    switch(mode) {
        case BATCH:
            configureBatchSpecificProperties();
            break;
        case STREAMING:
            break;
        case AUTOMATIC:
        default:
            throw new TableException(String.format("Unsupported runtime mode: %s", mode));
    }
    final StreamGraph streamGraph = executionEnvironment.generateStreamGraph(transformations);
    setJobName(streamGraph, defaultJobName);
    return streamGraph;
}
Also used : TableException(org.apache.flink.table.api.TableException) StreamGraph(org.apache.flink.streaming.api.graph.StreamGraph) RuntimeExecutionMode(org.apache.flink.api.common.RuntimeExecutionMode)

Example 3 with RuntimeExecutionMode

use of org.apache.flink.api.common.RuntimeExecutionMode in project flink by apache.

the class CLI method fromArgs.

public static CLI fromArgs(String[] args) throws Exception {
    MultipleParameterTool params = MultipleParameterTool.fromArgs(args);
    Path[] inputs = null;
    if (params.has(INPUT_KEY)) {
        inputs = params.getMultiParameterRequired(INPUT_KEY).stream().map(Path::new).toArray(Path[]::new);
    } else {
        System.out.println("Executing example with default input data.");
        System.out.println("Use --input to specify file input.");
    }
    Path output = null;
    if (params.has(OUTPUT_KEY)) {
        output = new Path(params.get(OUTPUT_KEY));
    } else {
        System.out.println("Printing result to stdout. Use --output to specify output path.");
    }
    Duration watchInterval = null;
    if (params.has(DISCOVERY_INTERVAL)) {
        watchInterval = TimeUtils.parseDuration(params.get(DISCOVERY_INTERVAL));
    }
    RuntimeExecutionMode executionMode = ExecutionOptions.RUNTIME_MODE.defaultValue();
    if (params.has(EXECUTION_MODE)) {
        executionMode = RuntimeExecutionMode.valueOf(params.get(EXECUTION_MODE).toUpperCase());
    }
    return new CLI(inputs, output, watchInterval, executionMode, params);
}
Also used : Path(org.apache.flink.core.fs.Path) MultipleParameterTool(org.apache.flink.api.java.utils.MultipleParameterTool) Duration(java.time.Duration) RuntimeExecutionMode(org.apache.flink.api.common.RuntimeExecutionMode)

Aggregations

RuntimeExecutionMode (org.apache.flink.api.common.RuntimeExecutionMode)3 Duration (java.time.Duration)1 MultipleParameterTool (org.apache.flink.api.java.utils.MultipleParameterTool)1 Path (org.apache.flink.core.fs.Path)1 StreamGraph (org.apache.flink.streaming.api.graph.StreamGraph)1 TableException (org.apache.flink.table.api.TableException)1