flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [4/5] flink git commit: [FLINK-2463] [web dashboard] Shows job configuration in new dashboard
Date Sun, 02 Aug 2015 18:38:38 GMT
[FLINK-2463] [web dashboard] Shows job configuration in new dashboard

This closes #953


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

Branch: refs/heads/master
Commit: b3dc3f050c125978f4fb14ccef230938e60a9198
Parents: 81f9b21
Author: Enrique Bautista <ebautistabar@gmail.com>
Authored: Wed Jul 29 22:49:13 2015 +0200
Committer: Stephan Ewen <sewen@apache.org>
Committed: Sun Aug 2 18:04:01 2015 +0200

----------------------------------------------------------------------
 .../runtime/webmonitor/WebRuntimeMonitor.java   |  2 +
 .../webmonitor/handlers/JobConfigHandler.java   | 81 ++++++++++++++++++++
 .../app/partials/jobs/job.config.jade           | 50 ++++++++++++
 .../web-dashboard/app/partials/jobs/job.jade    |  3 +
 .../web-dashboard/app/scripts/index.coffee      |  6 ++
 .../app/scripts/modules/jobs/jobs.svc.coffee    |  8 +-
 flink-runtime-web/web-dashboard/web/js/index.js | 16 +++-
 .../web/partials/jobs/job.config.html           | 57 ++++++++++++++
 .../web-dashboard/web/partials/jobs/job.html    |  1 +
 9 files changed, 219 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/b3dc3f05/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 0aa6b07..a2095d4 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
@@ -37,6 +37,7 @@ import org.apache.flink.configuration.Configuration;
 import org.apache.flink.configuration.IllegalConfigurationException;
 import org.apache.flink.runtime.webmonitor.files.StaticFileServerHandler;
 import org.apache.flink.runtime.webmonitor.handlers.ExecutionPlanHandler;
+import org.apache.flink.runtime.webmonitor.handlers.JobConfigHandler;
 import org.apache.flink.runtime.webmonitor.handlers.JobSummaryHandler;
 import org.apache.flink.runtime.webmonitor.handlers.JobVerticesOverviewHandler;
 import org.apache.flink.runtime.webmonitor.handlers.RequestConfigHandler;
@@ -132,6 +133,7 @@ public class WebRuntimeMonitor implements WebMonitor {
 			.GET("/jobs/:jobid", handler(new JobSummaryHandler(currentGraphs)))
 			.GET("/jobs/:jobid/vertices", handler(new JobVerticesOverviewHandler(currentGraphs)))
 			.GET("/jobs/:jobid/plan", handler(new ExecutionPlanHandler(currentGraphs)))
+			.GET("/jobs/:jobid/config", handler(new JobConfigHandler(currentGraphs)))
 
 //			.GET("/running/:jobid/:jobvertex", handler(new ExecutionPlanHandler(currentGraphs)))
 

http://git-wip-us.apache.org/repos/asf/flink/blob/b3dc3f05/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JobConfigHandler.java
----------------------------------------------------------------------
diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JobConfigHandler.java
b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JobConfigHandler.java
new file mode 100644
index 0000000..50cfd96
--- /dev/null
+++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JobConfigHandler.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.webmonitor.handlers;
+
+import java.util.Map;
+
+import org.apache.flink.api.common.ExecutionConfig;
+import org.apache.flink.runtime.executiongraph.ExecutionGraph;
+import org.apache.flink.runtime.webmonitor.ExecutionGraphHolder;
+import org.codehaus.jettison.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Request handler that returns the configuration of a job.
+ */
+public class JobConfigHandler extends AbstractExecutionGraphRequestHandler implements RequestHandler.JsonResponse
{
+
+	private static final Logger LOG = LoggerFactory.getLogger(JobConfigHandler.class);
+
+	public JobConfigHandler(ExecutionGraphHolder executionGraphHolder) {
+		super(executionGraphHolder);
+	}
+
+	@Override
+	public String handleRequest(ExecutionGraph graph, Map<String, String> params) throws
Exception {
+
+		JSONObject obj = new JSONObject();
+
+		obj.put("jid", graph.getJobID().toString());
+		obj.put("name", graph.getJobName());
+
+		JSONObject execConfig = new JSONObject();
+
+		ExecutionConfig ec = graph.getExecutionConfig();
+		if (ec != null) {
+			execConfig.put("execution-mode", ec.getExecutionMode());
+			execConfig.put("max-execution-retries", ec.getNumberOfExecutionRetries());
+			execConfig.put("job-parallelism", ec.getParallelism());
+			execConfig.put("object-reuse-mode", ec.isObjectReuseEnabled());
+
+			ExecutionConfig.GlobalJobParameters uc = ec.getGlobalJobParameters();
+			if (uc != null) {
+				Map<String, String> ucVals = uc.toMap();
+				if (ucVals != null) {
+					JSONObject userConfig = new JSONObject();
+					for (Map.Entry<String, String> ucVal : ucVals.entrySet()) {
+						userConfig.put(ucVal.getKey(), ucVal.getValue());
+					}
+					execConfig.put("user-config", userConfig);
+				} else {
+					LOG.debug("GlobalJobParameters.toMap() did not return anything");
+				}
+			} else {
+				LOG.debug("No GlobalJobParameters were set in the execution config");
+			}
+		} else {
+			LOG.warn("Unable to retrieve execution config from execution graph");
+		}
+
+		obj.put("execution-config", execConfig);
+
+		return obj.toString();
+	}
+}

http://git-wip-us.apache.org/repos/asf/flink/blob/b3dc3f05/flink-runtime-web/web-dashboard/app/partials/jobs/job.config.jade
----------------------------------------------------------------------
diff --git a/flink-runtime-web/web-dashboard/app/partials/jobs/job.config.jade b/flink-runtime-web/web-dashboard/app/partials/jobs/job.config.jade
new file mode 100644
index 0000000..83b7880
--- /dev/null
+++ b/flink-runtime-web/web-dashboard/app/partials/jobs/job.config.jade
@@ -0,0 +1,50 @@
+//
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+table.table.table-properties(ng-if="job['execution-config']")
+  thead
+    tr
+      th(colspan="2")
+        | Execution configuration
+
+  tbody
+    tr
+      td Execution mode
+      td {{ job['execution-config']['execution-mode'] }}
+
+    tr
+      td Max. number of execution retries
+      td {{ job['execution-config']['max-execution-retries'] === -1 ? 'deactivated' : job['execution-config']['max-execution-retries']
}}
+
+    tr
+      td Job parallelism
+      td {{ job['execution-config']['job-parallelism'] === -1 ? 'auto' : job['execution-config']['job-parallelism']
}}
+
+    tr
+      td Object reuse mode
+      td {{ job['execution-config']['object-reuse-mode'] }}
+
+table.table.table-properties(ng-if="job['execution-config']['user-config']")
+  thead
+    tr
+      th(colspan="2")
+        | User configuration
+
+  tbody
+    tr(ng-repeat="property in job['execution-config']['user-config']")
+      td {{property.name}}
+      td(table-property value="property.value")

http://git-wip-us.apache.org/repos/asf/flink/blob/b3dc3f05/flink-runtime-web/web-dashboard/app/partials/jobs/job.jade
----------------------------------------------------------------------
diff --git a/flink-runtime-web/web-dashboard/app/partials/jobs/job.jade b/flink-runtime-web/web-dashboard/app/partials/jobs/job.jade
index 2068529..2591aff 100644
--- a/flink-runtime-web/web-dashboard/app/partials/jobs/job.jade
+++ b/flink-runtime-web/web-dashboard/app/partials/jobs/job.jade
@@ -52,5 +52,8 @@ nav.navbar.navbar-default.navbar-fixed-top.navbar-main-additional(ng-if="job")
     li(ui-sref-active='active')
       a(ui-sref=".exceptions") Exceptions
 
+    li(ui-sref-active='active')
+      a(ui-sref=".config") Configuration
+
 #content-inner.has-navbar-main-additional
   div(ui-view="details")

http://git-wip-us.apache.org/repos/asf/flink/blob/b3dc3f05/flink-runtime-web/web-dashboard/app/scripts/index.coffee
----------------------------------------------------------------------
diff --git a/flink-runtime-web/web-dashboard/app/scripts/index.coffee b/flink-runtime-web/web-dashboard/app/scripts/index.coffee
index 385b3d6..4ff0502 100644
--- a/flink-runtime-web/web-dashboard/app/scripts/index.coffee
+++ b/flink-runtime-web/web-dashboard/app/scripts/index.coffee
@@ -117,4 +117,10 @@ angular.module('flinkApp', ['ui.router', 'angularMoment'])
       details:
         templateUrl: "partials/jobs/job.exceptions.html"
 
+  .state "single-job.config",
+    url: "/config"
+    views:
+      details:
+        templateUrl: "partials/jobs/job.config.html"
+
   $urlRouterProvider.otherwise "/overview"

http://git-wip-us.apache.org/repos/asf/flink/blob/b3dc3f05/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 11a08ef..3c5c385 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
@@ -112,8 +112,12 @@ angular.module('flinkApp')
         .success (oldVertices) ->
           data.oldV = oldVertices[0]
 
-          currentJob = data
-          deferreds.job.resolve(data)
+          $http.get flinkConfig.jobServer + "/jobs/" + jobid + "/config"
+          .success (jobConfig) ->
+            data = angular.extend(data, jobConfig)
+
+            currentJob = data
+            deferreds.job.resolve(data)
 
     deferreds.job.promise
 


Mime
View raw message