Hi,
I want to cancel a running job from a Java program. However, I don't know how to do it. The Client class (org.apache.flink.client.program.Client) that is used to submit a job, does not provide a method for it (a "Client.cancel(JobId)" would be nice). There is also the Scala JobClient classm that seems to have the capability to forward a "cancelJob" message to the JobManager. However, there is no method to call, either. I guess, the simplest way would be to add a new method here to the JobClient-object defined there. However, I don't speak Scala... Any suggestions? -Matthias |
Hi Matthias,
I think there is no utility method right now to cancel a running job. I'll file a JIRA for this. Have a look at how the CLI frontend is cancelling a job: https://github.com/apache/flink/blob/6b0d40764da9dce2e2d21882e9a03a21c6783ff0/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java#L518 This is where the message is send: ActorRef jobManager = getJobManager(options); > Future<Object> response = Patterns.ask(jobManager, new CancelJob(jobId), > new Timeout(askTimeout)); Let me know if this approach is not working for you. On Thu, Apr 2, 2015 at 10:57 AM, Matthias J. Sax < [hidden email]> wrote: > Hi, > > I want to cancel a running job from a Java program. However, I don't > know how to do it. The Client class > (org.apache.flink.client.program.Client) that is used to submit a job, > does not provide a method for it (a "Client.cancel(JobId)" would be nice). > > There is also the Scala JobClient classm that seems to have the > capability to forward a "cancelJob" message to the JobManager. However, > there is no method to call, either. I guess, the simplest way would be > to add a new method here to the JobClient-object defined there. However, > I don't speak Scala... > > Any suggestions? > > > -Matthias > > |
Thanks for the answer. It works! :)
-Matthias On 04/02/2015 12:27 PM, Robert Metzger wrote: > Hi Matthias, > > I think there is no utility method right now to cancel a running job. I'll > file a JIRA for this. > > Have a look at how the CLI frontend is cancelling a job: > https://github.com/apache/flink/blob/6b0d40764da9dce2e2d21882e9a03a21c6783ff0/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java#L518 > > This is where the message is send: > > ActorRef jobManager = getJobManager(options); >> Future<Object> response = Patterns.ask(jobManager, new CancelJob(jobId), >> new Timeout(askTimeout)); > > > > Let me know if this approach is not working for you. > > On Thu, Apr 2, 2015 at 10:57 AM, Matthias J. Sax < > [hidden email]> wrote: > >> Hi, >> >> I want to cancel a running job from a Java program. However, I don't >> know how to do it. The Client class >> (org.apache.flink.client.program.Client) that is used to submit a job, >> does not provide a method for it (a "Client.cancel(JobId)" would be nice). >> >> There is also the Scala JobClient classm that seems to have the >> capability to forward a "cancelJob" message to the JobManager. However, >> there is no method to call, either. I guess, the simplest way would be >> to add a new method here to the JobClient-object defined there. However, >> I don't speak Scala... >> >> Any suggestions? >> >> >> -Matthias >> >> > |
Free forum by Nabble | Edit this page |