Flink-如何解决错误这项工作不可停止 [英] Flink - how to solve error This job is not stoppable
问题描述
我试图通过flink stop停止工作
I tried to stop a job through flink stop
flink stop [jobid]
但是CLI会引发错误,并且不允许我停止作业.我可以取消它. 这可能是什么原因?
However the CLI throws error and does not allow me to stop the job. I could cancel it. What could be the reason here?
停止作业c7196bb1d21d679efed73770a4e4f9ed.
Stopping job c7196bb1d21d679efed73770a4e4f9ed.
--------------------------------------------------- -------------程序完成,但有以下异常:
------------------------------------------------------------ The program finished with the following exception:
org.apache.flink.util.FlinkException:无法停止作业 c7196bb1d21d679efed73770a4e4f9ed. 在org.apache.flink.client.cli.CliFrontend.lambda $ stop $ 5(CliFrontend.java:557) 在org.apache.flink.client.cli.CliFrontend.runClusterAction(CliFrontend.java:988) 在org.apache.flink.client.cli.CliFrontend.stop(CliFrontend.java:550) 在org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:1065) 在org.apache.flink.client.cli.CliFrontend.lambda $ main $ 11(CliFrontend.java:1129) 在org.apache.flink.runtime.security.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30) 在org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1129) 引起原因:java.util.concurrent.ExecutionException: org.apache.flink.runtime.rest.util.RestClientException:[作业 终止(STOP)失败:此作业不可停止.] 在java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) 在java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915) 在org.apache.flink.client.program.rest.RestClusterClient.stop(RestClusterClient.java:392) 在org.apache.flink.client.cli.CliFrontend.lambda $ stop $ 5(CliFrontend.java:555) ... 6更多原因:org.apache.flink.runtime.rest.util.RestClientException:[作业 终止(STOP)失败:此作业不可停止.] 在org.apache.flink.runtime.rest.RestClient.parseResponse(RestClient.java:351) 在org.apache.flink.runtime.rest.RestClient.lambda $ submitRequest $ 3(RestClient.java:335) 在java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:952) 在java.util.concurrent.CompletableFuture $ UniCompose.tryFire(CompletableFuture.java:926) 在java.util.concurrent.CompletableFuture $ Completion.run(CompletableFuture.java:442) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624) 在java.lang.Thread.run(Thread.java:748)
org.apache.flink.util.FlinkException: Could not stop the job c7196bb1d21d679efed73770a4e4f9ed. at org.apache.flink.client.cli.CliFrontend.lambda$stop$5(CliFrontend.java:557) at org.apache.flink.client.cli.CliFrontend.runClusterAction(CliFrontend.java:988) at org.apache.flink.client.cli.CliFrontend.stop(CliFrontend.java:550) at org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:1065) at org.apache.flink.client.cli.CliFrontend.lambda$main$11(CliFrontend.java:1129) at org.apache.flink.runtime.security.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30) at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1129) Caused by: java.util.concurrent.ExecutionException: org.apache.flink.runtime.rest.util.RestClientException: [Job termination (STOP) failed: This job is not stoppable.] at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915) at org.apache.flink.client.program.rest.RestClusterClient.stop(RestClusterClient.java:392) at org.apache.flink.client.cli.CliFrontend.lambda$stop$5(CliFrontend.java:555) ... 6 more Caused by: org.apache.flink.runtime.rest.util.RestClientException: [Job termination (STOP) failed: This job is not stoppable.] at org.apache.flink.runtime.rest.RestClient.parseResponse(RestClient.java:351) at org.apache.flink.runtime.rest.RestClient.lambda$submitRequest$3(RestClient.java:335) at java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:952) at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:926) at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
推荐答案
要使Flink作业可停止,其所有源都必须实现Stoppable接口,在这种情况下,仍然很少有这样做.在与Flink捆绑在一起的源连接器中,只有Storm SpoutWrapper,TwitterSource和NifiSource支持停止.
For a Flink job to be stoppable, all of its sources have to implement the Stoppable interface, and at this point it is still the case that very few do. Among the source connectors bundled with Flink, only the Storm SpoutWrapper, the TwitterSource, and the NifiSource support stop.
您似乎应该使用Stop,但对于大多数目的,cancel命令更为合适.相对于取消而言,停止的唯一可想到的好处是,您可以避免结果丢失或重复.但是,如果您使用的是实现检查点接口的连接器(例如Kafka连接器),则关闭作业的方式都没关系-无论如何,您都可以实现精确的一次语义.
It may appear that you are meant to use stop, but for most purposes, the cancel command is more appropriate. The only conceivable benefit to stopping, as opposed to canceling, is that you might avoid lost or duplicated results. But if you are using connectors that implement the checkpointing interface, such as the Kafka connector, then it doesn't matter how you shutdown a job -- you can achieve exactly-once semantics regardless.
更新:在Flink 1.9中删除了Stoppable
接口,并重新实现了stop
命令,现在在大多数情况下,它比cancel
命令更受青睐.有关更多详细信息,请参见文档
Update: the Stoppable
interface was removed in Flink 1.9, and the stop
command was reimplemented, and is now preferred in most cases over the cancel
command. See the documentation for more details.
这篇关于Flink-如何解决错误这项工作不可停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!