Search code examples
apache-flink

How do I get Flink savepoint ID?


In the 2 savepoint related REST APIs:

The first API takes a parameter target-directory, but it is unclear whether it is the exact dir or it is the parent dir within which Flink will generate a subdir whose name is the savepoint ID. Based on my experience with Flink CLI, I think it might be a parent dir, but if that is the case, how do I get the savepoint ID? It is not documented in the 2nd API.


Solution

  • I figured it out by printing out the response. Here are examples of success and failure.

    1) success:

    {
      "status":{"id":"COMPLETED"},
      "operation":{
        "location":"file:/savepoints-dir/savepoint-ad4025-dd46c1bd1c80"
      }
    }
    

    2) failure:

    {
      "status":{"id":"COMPLETED"},
      "operation":{
        "failure-cause":{
          "class": "java.util.concurrent.CompletionException",
          "stack-trace": "..."
        }
      }
    }