diff --git a/docs/ops/cli.md b/docs/ops/cli.md index 847a1bd20d7c7..5eeed312f4870 100644 --- a/docs/ops/cli.md +++ b/docs/ops/cli.md @@ -170,11 +170,11 @@ These examples about how to manage a job in CLI. ./bin/flink cancel -- Cancel a job with a savepoint: +- Cancel a job with a savepoint (deprecated; use "stop" instead): ./bin/flink cancel -s [targetDirectory] -- Stop a job with a savepoint (streaming jobs only): +- Gracefully stop a job with a savepoint (streaming jobs only): ./bin/flink stop -s [targetDirectory] -d @@ -221,7 +221,7 @@ This will trigger a savepoint for the job with ID `jobId` and YARN application I Everything else is the same as described in the above **Trigger a Savepoint** section. -#### Cancel with a savepoint +#### Cancel with a savepoint (deprecated) You can atomically trigger a savepoint and cancel a job. @@ -233,6 +233,10 @@ If no savepoint directory is configured, you need to configure a default savepoi The job will only be cancelled if the savepoint succeeds. +

+ Note: Cancelling a job with savepoint is deprecated. Use "stop" instead.

+{% endunless %} + #### Restore a savepoint {% highlight bash %} @@ -455,7 +459,10 @@ Action "cancel" cancels a running program. Syntax: cancel [OPTIONS] "cancel" action options: - -s,--withSavepoint Trigger savepoint and cancel job. + -s,--withSavepoint **DEPRECATION WARNING**: Cancelling + a job with savepoint is deprecated. + Use "stop" instead. + Trigger savepoint and cancel job. The target directory is optional. If no directory is specified, the configured default directory diff --git a/docs/ops/cli.zh.md b/docs/ops/cli.zh.md index b2fa48ce3d1cd..ce6049f6d1a78 100644 --- a/docs/ops/cli.zh.md +++ b/docs/ops/cli.zh.md @@ -169,11 +169,11 @@ available. ./bin/flink cancel -- Cancel a job with a savepoint: +- Cancel a job with a savepoint (deprecated; use "stop" instead): ./bin/flink cancel -s [targetDirectory] -- Stop a job with a savepoint (streaming jobs only): +- Gracefully stop a job with a savepoint (streaming jobs only): ./bin/flink stop -s [targetDirectory] -d @@ -220,7 +220,7 @@ This will trigger a savepoint for the job with ID `jobId` and YARN application I Everything else is the same as described in the above **Trigger a Savepoint** section. -#### Cancel with a savepoint +#### Cancel with a savepoint (deprecated) You can atomically trigger a savepoint and cancel a job. @@ -232,6 +232,10 @@ If no savepoint directory is configured, you need to configure a default savepoi The job will only be cancelled if the savepoint succeeds. +

+ Note: Cancelling a job with savepoint is deprecated. Use "stop" instead.

+{% endunless %} + #### Restore a savepoint {% highlight bash %} @@ -450,7 +454,10 @@ Action "cancel" cancels a running program. Syntax: cancel [OPTIONS] "cancel" action options: - -s,--withSavepoint Trigger savepoint and cancel job. + -s,--withSavepoint **DEPRECATION WARNING**: Cancelling + a job with savepoint is deprecated. + Use "stop" instead. + Trigger savepoint and cancel job. The target directory is optional. If no directory is specified, the configured default directory diff --git a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java index ec8e4a1ab094c..95d52d96fc48b 100644 --- a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java +++ b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java @@ -568,6 +568,9 @@ protected void cancel(String[] args) throws Exception { final String[] cleanedArgs = cancelOptions.getArgs(); if (cancelOptions.isWithSavepoint()) { + + logAndSysout("DEPRECATION WARNING: Cancelling a job with savepoint is deprecated. Use \"stop\" instead."); + final JobID jobId; final String targetDirectory; diff --git a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java index 5872a54bd0199..3219e40f02d0b 100644 --- a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java +++ b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java @@ -107,9 +107,11 @@ public class CliFrontendParser { "Namespace to create the Zookeeper sub-paths for high availability mode"); static final Option CANCEL_WITH_SAVEPOINT_OPTION = new Option( - "s", "withSavepoint", true, "Trigger savepoint and cancel job. The target " + - "directory is optional. If no directory is specified, the configured default " + - "directory (" + CheckpointingOptions.SAVEPOINT_DIRECTORY.key() + ") is used."); + "s", "withSavepoint", true, "**DEPRECATION WARNING**: " + + "Cancelling a job with savepoint is deprecated. Use \"stop\" instead. \n Trigger" + + " savepoint and cancel job. The target directory is optional. If no directory is " + + "specified, the configured default directory (" + + CheckpointingOptions.SAVEPOINT_DIRECTORY.key() + ") is used."); public static final Option STOP_WITH_SAVEPOINT = new Option("s", "withSavepoint", true, "Path to the savepoint (for example hdfs:///flink/savepoint-1537). " +