Hi Thomas, For querying the savepoint status, a get request could be issued to /jobs/:jobid/savepoints/:savepointtriggerid [1] to get the status and position of the savepoint. But if the job is running with some kind of per-job mode and JobMaster is gone after the stop-with-savepoint, the request might not be available.
For the kafka source, have you ever found some exception or some messages in the TaskManager's log when it could not be stopped ? Best, Yun [1] https://ci.apache.org/projects/flink/flink-docs-release-1.13/docs/ops/rest_api/#jobs-jobid-savepoints-triggerid ------------------Original Mail ------------------ Sender:Thomas Wang <w...@datability.io> Send Date:Sat Jun 5 00:47:47 2021 Recipients:Yun Gao <yungao...@aliyun.com> CC:user <user@flink.apache.org> Subject:Re: Failed to cancel a job using the STOP rest API Hi Yun, Thanks for your reply. We are not using any legacy source. For this specific job, there is only one source that is using FlinkKafkaConsumer which I assume has the correct cancel() method implemented. Also could you suggest how I could use the "request-id" to get the savepoint location? Thanks. Thomas On Fri, Jun 4, 2021 at 2:31 AM Yun Gao <yungao...@aliyun.com> wrote: Hi Thomas, I think you are right that the CLI is also using the same rest API underlying, and since the response of the rest API is ok and the savepoint is triggered successfully, I reckon that it might not be due to rest API process, and we might still first focus on the stop-with-savepoint process. Currently stop-with-savepoint would first do a savepoint, then cancel all the sources to stop the job. Thus are the sources all legacy source (namely the one using SourceFunction) ? and does the source implement the cancel() method correctly ? Best, Yun ------------------------------------------------------------------ From:Thomas Wang <w...@datability.io> Send Time:2021 Jun. 4 (Fri.) 12:55 To:user <user@flink.apache.org> Subject:Failed to cancel a job using the STOP rest API Hi, Flink community, I'm trying to use the STOP rest API to cancel a job. So far, I'm seeing some inconsistent results. Sometimes, jobs could be cancelled successfully while other times, they couldn't. Either way, the POST request is accepted with a status code 202 and a "request-id". From the Flink UI, I can see the savepoint being completed successfully. However the job is still in running state afterwards. The CLI command `flink stop <JOB ID>` is working ok. I can use the CLI to stop the job and get the resulting savepoint location. If I understand this correctly, the CLI should be using the same REST API behind the scenes, isn't it? Here is my POST request URL: `http://<HIDDEN>.ec2.internal:33557/jobs/5dce58f02d1f5e739ab12f88b2f5f031/stop`. Here is the BODY of the request: `{"drain":false,"targetDirectory":"s3://<BUCKET-NAME>/flink-savepoint"}`. I'm using Flink 1.11.2 Commit ID: DeadD0d0. Any suggestions on how I can debug this? Another question is, given the response "request-id", which endpoint should I query to get the status of the request? Most importantly, where can I get the expected savepoint location? Thanks. Thomas