Tabnine Logo
StreamExecutionEnvironment.getCheckpointConfig
Code IndexAdd Tabnine to your IDE (free)

How to use
getCheckpointConfig
method
in
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment

Best Java code snippets using org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.getCheckpointConfig (Showing top 17 results out of 315)

origin: apache/flink

public StreamGraph(StreamExecutionEnvironment environment) {
  this.environment = environment;
  this.executionConfig = environment.getConfig();
  this.checkpointConfig = environment.getCheckpointConfig();
  // create an empty new stream graph.
  clear();
}
origin: apache/flink

@Test
public void testCheckpointConfigDefault() throws Exception {
  StreamExecutionEnvironment streamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment();
  Assert.assertTrue(streamExecutionEnvironment.getCheckpointConfig().isFailOnCheckpointingErrors());
}
origin: apache/flink

env.getCheckpointConfig().setMaxConcurrentCheckpoints(1);
env.getCheckpointConfig().setMinPauseBetweenCheckpoints(0);
origin: apache/flink

  public void doTestPropagationFromCheckpointConfig(boolean failTaskOnCheckpointErrors) throws Exception {
    StreamExecutionEnvironment streamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment();
    streamExecutionEnvironment.setParallelism(1);
    streamExecutionEnvironment.getCheckpointConfig().setCheckpointInterval(1000);
    streamExecutionEnvironment.getCheckpointConfig().setFailOnCheckpointingErrors(failTaskOnCheckpointErrors);
    streamExecutionEnvironment.addSource(new SourceFunction<Integer>() {

      @Override
      public void run(SourceContext<Integer> ctx) throws Exception {
      }

      @Override
      public void cancel() {
      }

    }).addSink(new DiscardingSink<>());

    StreamGraph streamGraph = streamExecutionEnvironment.getStreamGraph();
    JobGraph jobGraph = StreamingJobGraphGenerator.createJobGraph(streamGraph);
    SerializedValue<ExecutionConfig> serializedExecutionConfig = jobGraph.getSerializedExecutionConfig();
    ExecutionConfig executionConfig =
      serializedExecutionConfig.deserializeValue(Thread.currentThread().getContextClassLoader());

    Assert.assertEquals(failTaskOnCheckpointErrors, executionConfig.isFailTaskOnCheckpointError());
  }
}
origin: apache/flink

env.setRestartStrategy(RestartStrategies.fixedDelayRestart(Integer.MAX_VALUE, pt.getInt("restartDelay", 0)));
if (pt.getBoolean("externalizedCheckpoints", false)) {
  env.getCheckpointConfig().enableExternalizedCheckpoints(CheckpointConfig.ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION);
origin: apache/flink

env.getCheckpointConfig().enableExternalizedCheckpoints(cleanupMode);
origin: apache/flink

env.setParallelism(Parallelism);
env.enableCheckpointing(checkpointingInterval);
env.getCheckpointConfig()
  .enableExternalizedCheckpoints(CheckpointConfig.ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION);
origin: org.apache.flink/flink-streaming-java

public StreamGraph(StreamExecutionEnvironment environment) {
  this.environment = environment;
  this.executionConfig = environment.getConfig();
  this.checkpointConfig = environment.getCheckpointConfig();
  // create an empty new stream graph.
  clear();
}
origin: org.apache.flink/flink-streaming-java_2.11

public StreamGraph(StreamExecutionEnvironment environment) {
  this.environment = environment;
  this.executionConfig = environment.getConfig();
  this.checkpointConfig = environment.getCheckpointConfig();
  // create an empty new stream graph.
  clear();
}
origin: org.apache.flink/flink-streaming-java_2.10

public StreamGraph(StreamExecutionEnvironment environment) {
  this.environment = environment;
  this.executionConfig = environment.getConfig();
  this.checkpointConfig = environment.getCheckpointConfig();
  // create an empty new stream graph.
  clear();
}
origin: DTStack/flinkStreamSQL

if(checkMode != null){
  if(checkMode.equalsIgnoreCase("EXACTLY_ONCE")){
    env.getCheckpointConfig().setCheckpointingMode(CheckpointingMode.EXACTLY_ONCE);
  }else if(checkMode.equalsIgnoreCase("AT_LEAST_ONCE")){
    env.getCheckpointConfig().setCheckpointingMode(CheckpointingMode.AT_LEAST_ONCE);
  }else{
    throw new RuntimeException("not support of FLINK_CHECKPOINT_MODE_KEY :" + checkMode);
  Long checkpointTimeout = Long.valueOf(checkpointTimeoutStr);
  env.getCheckpointConfig().setCheckpointTimeout(checkpointTimeout);
  Integer maxConcurrCheckpoints = Integer.valueOf(maxConcurrCheckpointsStr);
  env.getCheckpointConfig().setMaxConcurrentCheckpoints(maxConcurrCheckpoints);
if(cleanupModeStr != null){//设置在cancel job情况下checkpoint是否被保存
  if("true".equalsIgnoreCase(cleanupModeStr)){
    env.getCheckpointConfig().enableExternalizedCheckpoints(
        CheckpointConfig.ExternalizedCheckpointCleanup.DELETE_ON_CANCELLATION);
  }else if("false".equalsIgnoreCase(cleanupModeStr)){
    env.getCheckpointConfig().enableExternalizedCheckpoints(
        CheckpointConfig.ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION);
  }else{
origin: org.apache.beam/beam-runners-flink_2.10

flinkStreamEnv.getCheckpointConfig().setCheckpointTimeout(
  options.getCheckpointTimeoutMillis());
boolean externalizedCheckpoint = options.isExternalizedCheckpointsEnabled();
boolean retainOnCancellation = options.getRetainExternalizedCheckpointsOnCancellation();
if (externalizedCheckpoint) {
 flinkStreamEnv.getCheckpointConfig().enableExternalizedCheckpoints(
   retainOnCancellation ? ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION
     : ExternalizedCheckpointCleanup.DELETE_ON_CANCELLATION);
origin: org.apache.beam/beam-runners-flink

if (options.getCheckpointTimeoutMillis() != -1) {
 flinkStreamEnv
   .getCheckpointConfig()
   .setCheckpointTimeout(options.getCheckpointTimeoutMillis());
if (externalizedCheckpoint) {
 flinkStreamEnv
   .getCheckpointConfig()
   .enableExternalizedCheckpoints(
     retainOnCancellation
if (minPauseBetweenCheckpoints != -1) {
 flinkStreamEnv
   .getCheckpointConfig()
   .setMinPauseBetweenCheckpoints(minPauseBetweenCheckpoints);
origin: streaming-olap/training

public static void main(String argsp[]) throws Exception {
  StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
  env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
  // 设置checkpoint
  env.enableCheckpointing(60000);
  CheckpointConfig checkpointConf = env.getCheckpointConfig();
  checkpointConf.setMinPauseBetweenCheckpoints(30000L);
  checkpointConf.setCheckpointTimeout(10000L);
  checkpointConf.enableExternalizedCheckpoints(CheckpointConfig.ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION);
  env.fromElements(1L,2L,3L,4L,5L,1L,3L,4L,5L,6L,7L,1L,4L,5L,3L,9L,9L,2L,1L)
      .flatMap(new CountWithOperatorState())
      .addSink(new SinkFunction<String>() {
        @Override
        public void invoke(String s) throws Exception {
        }
      });
}
origin: org.apache.beam/beam-runners-flink_2.11

if (options.getCheckpointTimeoutMillis() != -1) {
 flinkStreamEnv
   .getCheckpointConfig()
   .setCheckpointTimeout(options.getCheckpointTimeoutMillis());
if (externalizedCheckpoint) {
 flinkStreamEnv
   .getCheckpointConfig()
   .enableExternalizedCheckpoints(
     retainOnCancellation
if (minPauseBetweenCheckpoints != -1) {
 flinkStreamEnv
   .getCheckpointConfig()
   .setMinPauseBetweenCheckpoints(minPauseBetweenCheckpoints);
flinkStreamEnv.getCheckpointConfig().setFailOnCheckpointingErrors(failOnCheckpointingErrors);
origin: streaming-olap/training

  public static void main(String argsp[]) throws Exception {

    StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
    env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);

    // 设置checkpoint
    env.enableCheckpointing(60000);
    CheckpointConfig checkpointConf = env.getCheckpointConfig();
    checkpointConf.setMinPauseBetweenCheckpoints(30000L);
    checkpointConf.setCheckpointTimeout(10000L);
    checkpointConf.enableExternalizedCheckpoints(CheckpointConfig.ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION);


    env.fromElements(Tuple2.of(1L, 3L), Tuple2.of(1L, 5L), Tuple2.of(1L, 7L), Tuple2.of(1L, 4L), Tuple2.of(1L, 2L))
        .keyBy(0)
        .flatMap(new CountWithKeyedState())
        .addSink(new SinkFunction<Tuple2<Long, Long>>() {
          @Override
          public void invoke(Tuple2<Long, Long> longLongTuple2) throws Exception {

          }
        });

    env.execute("CountOnlyState");
  }
}
origin: king/bravo

private StreamExecutionEnvironment createJobGraph(int parallelism,
    Function<DataStream<String>, DataStream<String>> pipelinerBuilder) throws Exception {
  final Path checkpointDir = getCheckpointDir();
  final Path savepointRootDir = getSavepointDir();
  checkpointDir.getFileSystem().mkdirs(checkpointDir);
  savepointRootDir.getFileSystem().mkdirs(savepointRootDir);
  StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
  env.getConfig().disableSysoutLogging();
  env.getCheckpointConfig().enableExternalizedCheckpoints(ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION);
  env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
  env.setBufferTimeout(0);
  env.setParallelism(parallelism);
  env.enableCheckpointing(500, CheckpointingMode.EXACTLY_ONCE);
  env.setStateBackend((StateBackend) new RocksDBStateBackend(checkpointDir.toString(), true));
  DataStream<String> sourceData = env
      .addSource(new TestPipelineSource())
      .uid("TestSource")
      .name("TestSource")
      .setParallelism(1);
  pipelinerBuilder.apply(sourceData)
      .addSink(new CollectingSink()).name("Output").uid("Output")
      .setParallelism(1);
  return env;
}
org.apache.flink.streaming.api.environmentStreamExecutionEnvironmentgetCheckpointConfig

Javadoc

Gets the checkpoint config, which defines values like checkpoint interval, delay between checkpoints, etc.

Popular methods of StreamExecutionEnvironment

  • execute
  • getExecutionEnvironment
    Creates an execution environment that represents the context in which the program is currently execu
  • addSource
    Ads a data source with a custom type information thus opening a DataStream. Only in very special cas
  • getConfig
    Gets the config object.
  • enableCheckpointing
    Enables checkpointing for the streaming job. The distributed state of the streaming dataflow will be
  • setStreamTimeCharacteristic
    Sets the time characteristic for all streams create from this environment, e.g., processing time, ev
  • setParallelism
    Sets the parallelism for operations executed through this environment. Setting a parallelism of x he
  • fromElements
    Creates a new data stream that contains the given elements. The elements must all be of the same typ
  • setStateBackend
    Sets the state backend that describes how to store and checkpoint operator state. It defines both wh
  • createLocalEnvironment
    Creates a LocalStreamEnvironment. The local execution environment will run the program in a multi-th
  • fromCollection
    Creates a data stream from the given iterator.Because the iterator will remain unmodified until the
  • getParallelism
    Gets the parallelism with which operation are executed by default. Operations can individually overr
  • fromCollection,
  • getParallelism,
  • getStreamGraph,
  • setRestartStrategy,
  • socketTextStream,
  • readTextFile,
  • generateSequence,
  • clean,
  • getStreamTimeCharacteristic

Popular in Java

  • Reading from database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • startActivity (Activity)
  • putExtra (Intent)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now