Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flink: How to cancel the correct job using the command line interface?

I have a Flink server which runs several streaming jobs. These jobs were started using the flink run command and basically run until you stop them. Now I want to cancel a specific job. When I do flink list, I'm getting something like this:

------------------ Running/Restarting Jobs -------------------
10.12.2015 08:30:37 : d6aeefaa2295ce122b65037805db0891 : Flink Streaming Job (RUNNING)
10.12.2015 08:44:18 : cfe10aca3435730d09691ff644475467 : Flink Streaming Job (RESTARTING)
10.12.2015 08:55:08 : 4ca359e286d4f5b4de62aee76f4c6389 : Flink Streaming Job (RESTARTING)
10.12.2015 08:57:42 : 1b75acb482f2610039ea2211e094b862 : Flink Streaming Job (RESTARTING)
10.12.2015 09:07:22 : 609993523b0214f52fabfdf09baf419d : Flink Streaming Job (RESTARTING)

Using this output it's impossible to cancel the correct job as there is no way to identify which job is which. All jobs just have Flink Streaming Job as their name, so I wouldn't know which one to pick.

Is there a way to change the job name that is appearing in flink list? If not, is there a way to get additional information about the running jobs over the command line (e.g. which JAR file it was started from, what is it's main class, etc.). If not, is there a way to get the Job-ID back from flink run, so I can store it in some kind of PID-file equivalent and use that ID later to cancel the Job?

like image 761
Jan Thomä Avatar asked Jan 08 '23 00:01

Jan Thomä


1 Answers

The StreamExecutionEnvironment.execute() method allows you to set the job's name:

// execute program
env.execute("Streaming data into " + topicName + " topic");
like image 143
Robert Metzger Avatar answered May 01 '23 10:05

Robert Metzger