Re: Checkpoint and restore states

2016-04-21 Thread Jack Huang
@Stefano, Aljoscha: Thank you for pointing that out. With the following steps I verified that the state of the job gets restored 1. Use HDFS as state backend with env.setStateBackend(new FsStateBackend("hdfs:///home/user/flink/KafkaWordCount")) 2. Start the job. In my case the job ID is

Re: Checkpoint and restore states

2016-04-21 Thread Aljoscha Krettek
Hi, yes Stefano is spot on! The state is only restored if a job is restarted because of abnormal failure. For state that survives stopping/canceling a job you can look at savepoints: https://ci.apache.org/projects/flink/flink-docs-master/apis/streaming/savepoints.html This essentially uses the same

Re: Checkpoint and restore states

2016-04-20 Thread Stefano Baghino
Hello again, thanks for giving a shot at my advice anyway but Aljoscha is far more knowledgeable then me regarding Flink. :) I hope I'm not getting mixed up again but I think gracefully canceling your job means you lose your job state. Am I right in saying that the state is preserved in case of a

Re: Checkpoint and restore states

2016-04-20 Thread Jack Huang
@Aljoscha: For this word count example I am using a kafka topic as the input stream. The problem is that when I cancel the task and restart it, the task loses the accumulated word counts so far and start counting from 1 again. Am I missing something basic here? @Stefano: I also tried to implements

Re: Checkpoint and restore states

2016-04-20 Thread Stefano Baghino
My bad, thanks for pointing that out. On Wed, Apr 20, 2016 at 1:49 PM, Aljoscha Krettek wrote: > Hi, > the *withState() family of functions use the Key/Value state interface > internally, so that should work. > > On Wed, 20 Apr 2016 at 12:33 Stefano Baghino < > stefano.bagh...@radicalbit.io> wro

Re: Checkpoint and restore states

2016-04-20 Thread Aljoscha Krettek
Hi, the *withState() family of functions use the Key/Value state interface internally, so that should work. On Wed, 20 Apr 2016 at 12:33 Stefano Baghino wrote: > Hi Jack, > > it seems you correctly enabled the checkpointing by calling > `env.enableCheckpointing`. However, your UDFs have to eithe

Re: Checkpoint and restore states

2016-04-20 Thread Stefano Baghino
Hi Jack, it seems you correctly enabled the checkpointing by calling `env.enableCheckpointing`. However, your UDFs have to either implement the Checkpointed interface or use the Key/Value State interface to make sure the state of the computation is snapshotted. The documentation explains how to d

Re: Checkpoint and restore states

2016-04-20 Thread Aljoscha Krettek
Hi, what seems to be the problem? Cheers, Aljoscha On Wed, 20 Apr 2016 at 03:52 Jack Huang wrote: > Hi all, > > I am doing a simple word count example and want to checkpoint the > accumulated word counts. I am not having any luck getting the counts saved > and restored. Can someone help? > > en

Checkpoint and restore states

2016-04-19 Thread Jack Huang
Hi all, I am doing a simple word count example and want to checkpoint the accumulated word counts. I am not having any luck getting the counts saved and restored. Can someone help? env.enableCheckpointing(1000) env.setStateBackend(new MemoryStateBackend()) > ... inStream > .keyBy({s =>