You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by mx...@apache.org on 2015/11/18 18:44:41 UTC

[2/2] flink git commit: [FLINK-2989] job cancel button doesn't work on YARN

[FLINK-2989] job cancel button doesn't work on YARN

In addition to the REST-compliant "DELETE /jobs/<jobid>", allows
cancellation also via a special GET request of the form
"GET /jobs/<jobid>/yarn-cancel".

That enables us to cancel jobs from the web frontend on YARN while
keeping a REST-compliant DELETE alternative.

This closes #1344.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/08318e1a
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/08318e1a
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/08318e1a

Branch: refs/heads/master
Commit: 08318e1a7649b6f78b2c2d4fba7004c547d05961
Parents: 2ea4588
Author: Maximilian Michels <mx...@apache.org>
Authored: Tue Nov 10 13:35:58 2015 +0100
Committer: Maximilian Michels <mx...@apache.org>
Committed: Wed Nov 18 18:42:31 2015 +0100

----------------------------------------------------------------------
 .../apache/flink/runtime/webmonitor/WebRuntimeMonitor.java  | 9 ++++++---
 .../web-dashboard/app/scripts/modules/jobs/jobs.svc.coffee  | 4 +++-
 flink-runtime-web/web-dashboard/web/js/index.js             | 4 ++--
 3 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/08318e1a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java
----------------------------------------------------------------------
diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java
index eed781e..03a25a2 100644
--- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java
+++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java
@@ -186,11 +186,14 @@ public class WebRuntimeMonitor implements WebMonitor {
 			.GET("/jobmanager/log", new StaticFileServerHandler(retriever, jobManagerAddressPromise.future(), timeout, logFiles.logFile))
 			.GET("/jobmanager/stdout", new StaticFileServerHandler(retriever, jobManagerAddressPromise.future(), timeout, logFiles.stdOutFile))
 
+			// Cancel a job via GET (for proper integration with YARN this has to be performed via GET)
+			.GET("/jobs/:jobid/yarn-cancel", handler(new JobCancellationHandler()))
+			// DELETE is the preferred way of cancelling a job (Rest-conform)
+			.DELETE("/jobs/:jobid", handler(new JobCancellationHandler()))
+
 			// this handler serves all the static contents
-			.GET("/:*", new StaticFileServerHandler(retriever, jobManagerAddressPromise.future(), timeout, webRootDir))
+			.GET("/:*", new StaticFileServerHandler(retriever, jobManagerAddressPromise.future(), timeout, webRootDir));
 
-			// cancel a job
-			.DELETE("/jobs/:jobid", handler(new JobCancellationHandler()));
 
 		synchronized (startupShutdownLock) {
 

http://git-wip-us.apache.org/repos/asf/flink/blob/08318e1a/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.svc.coffee
----------------------------------------------------------------------
diff --git a/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.svc.coffee b/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.svc.coffee
index 698437f..703950e 100644
--- a/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.svc.coffee
+++ b/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.svc.coffee
@@ -212,6 +212,8 @@ angular.module('flinkApp')
     deferred.promise
 
   @cancelJob = (jobid) ->
-    $http.delete "jobs/" + jobid
+    # uses the non REST-compliant GET yarn-cancel handler which is available in addition to the
+    # proper "DELETE jobs/<jobid>/"
+    $http.get "jobs/" + jobid + "/yarn-cancel"
 
   @