You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by rm...@apache.org on 2014/07/03 12:08:00 UTC
git commit: Finished Flink-928
Repository: incubator-flink
Updated Branches:
refs/heads/master cebb1f635 -> 7a4c209a8
Finished Flink-928
Taskmanagers are now displayed in the web interface @rmetzger
Author: Jonathan <Jo...@Hasenburg.de>
Closes #43 from JonathanH5/webclient and squashes the following commits:
5cc5f72 [Jonathan] Finished Flink-928 and simplified how new pages to the WebInterface are added
Project: http://git-wip-us.apache.org/repos/asf/incubator-flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-flink/commit/7a4c209a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-flink/tree/7a4c209a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-flink/diff/7a4c209a
Branch: refs/heads/master
Commit: 7a4c209a80d7b1389f2e843d5aacd98dee997496
Parents: cebb1f6
Author: Jonathan <Jo...@Hasenburg.de>
Authored: Thu Jul 3 12:07:25 2014 +0200
Committer: Robert Metzger <rm...@apache.org>
Committed: Thu Jul 3 12:07:25 2014 +0200
----------------------------------------------------------------------
.../resources/web-docs-infoserver/analyze.html | 24 ++--
.../web-docs-infoserver/blank-page.html | 25 ++--
.../web-docs-infoserver/configuration.html | 30 ++--
.../resources/web-docs-infoserver/history.html | 26 ++--
.../resources/web-docs-infoserver/index.html | 26 ++--
.../web-docs-infoserver/js/configuration.js | 15 +-
.../web-docs-infoserver/js/taskmanager.js | 32 +++++
.../web-docs-infoserver/taskmanagers.html | 98 +++++++++++++
.../instance/DefaultInstanceManager.java | 7 +
.../stratosphere/nephele/instance/Instance.java | 4 +
.../instance/InstanceConnectionInfo.java | 4 +
.../nephele/instance/InstanceManager.java | 4 +
.../nephele/jobmanager/JobManager.java | 5 +
.../jobmanager/web/ConfigurationServlet.java | 77 ----------
.../nephele/jobmanager/web/MenuServlet.java | 114 +++++++++++++++
.../jobmanager/web/SetupInfoServlet.java | 142 +++++++++++++++++++
.../nephele/jobmanager/web/WebInfoServer.java | 3 +-
.../scheduler/queue/TestInstanceManager.java | 8 +-
18 files changed, 505 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/resources/web-docs-infoserver/analyze.html
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/resources/web-docs-infoserver/analyze.html b/stratosphere-runtime/resources/web-docs-infoserver/analyze.html
index 3fc07b3..13d88d9 100755
--- a/stratosphere-runtime/resources/web-docs-infoserver/analyze.html
+++ b/stratosphere-runtime/resources/web-docs-infoserver/analyze.html
@@ -31,14 +31,25 @@
<script type="text/javascript" src="js/timeline.js"></script>
<script type="text/javascript" src="js/helpers.js"></script>
<script type="text/javascript" src="js/analyzer.js"></script>
+
+ <!-- Load Menu -->
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $.ajax({ url : "menu?get=analyze", type : "GET", cache: false, success : function(html) {
+ $("#side-menu").empty();
+ $("#side-menu").append(html);
+ }, dataType : "html",
+ });
+ });
+ </script>
</head>
<body>
<div id="wrapper">
-
+
<!-- Sidebar -->
- <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
+ <nav class='navbar navbar-inverse navbar-fixed-top' role='navigation'>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
@@ -49,15 +60,12 @@
</button>
<a class="navbar-brand" href="index.html">Stratosphere</a>
</div>
-
+
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
- <ul class="nav navbar-nav side-nav">
- <li><a href="index.html"><i class="fa fa-dashboard"></i> Dashboard</a></li>
- <li><a href="history.html"><i class="fa fa-bar-chart-o"></i> History</a></li>
- <li><a href="configuration.html"><i class="fa fa-keyboard-o"></i> Configuration</a></li>
+ <ul id="side-menu" class="nav navbar-nav side-nav">
+ <!-- Filled via script -->
</ul>
-
<ul class="nav navbar-nav navbar-right navbar-user">
<li class="dropdown user-dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-archive"></i> Log Files<b class="caret"></b></a>
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/resources/web-docs-infoserver/blank-page.html
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/resources/web-docs-infoserver/blank-page.html b/stratosphere-runtime/resources/web-docs-infoserver/blank-page.html
index d250e3a..96e1d81 100755
--- a/stratosphere-runtime/resources/web-docs-infoserver/blank-page.html
+++ b/stratosphere-runtime/resources/web-docs-infoserver/blank-page.html
@@ -25,16 +25,26 @@
<!-- Scripts from Stratosphere -->
<script type="text/javascript" src="js/jquery.flot.min.js"></script>
<script type="text/javascript" src="js/helpers.js"></script>
- <script type="text/javascript" src="js/jobmanagerFrontend.js"></script>
<script type="text/javascript" src="js/jcanvas.min.js"></script>
+
+ <!-- Load Menu -->
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $.ajax({ url : "menu?get=...", type : "GET", cache: false, success : function(html) {
+ $("#side-menu").empty();
+ $("#side-menu").append(html);
+ }, dataType : "html",
+ });
+ });
+ </script>
</head>
<body>
<div id="wrapper">
-
+
<!-- Sidebar -->
- <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
+ <nav class='navbar navbar-inverse navbar-fixed-top' role='navigation'>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
@@ -45,15 +55,12 @@
</button>
<a class="navbar-brand" href="index.html">Stratosphere</a>
</div>
-
+
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
- <ul class="nav navbar-nav side-nav">
- <li class="active"><a href="index.html"><i class="fa fa-dashboard"></i> Dashboard</a></li>
- <li><a href="history.html"><i class="fa fa-bar-chart-o"></i> History</a></li>
- <li><a href="configuration.html"><i class="fa fa-keyboard-o"></i> Configuration</a></li>
+ <ul id="side-menu" class="nav navbar-nav side-nav">
+ <!-- Filled via script -->
</ul>
-
<ul class="nav navbar-nav navbar-right navbar-user">
<li class="dropdown user-dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-archive"></i> Log Files<b class="caret"></b></a>
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/resources/web-docs-infoserver/configuration.html
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/resources/web-docs-infoserver/configuration.html b/stratosphere-runtime/resources/web-docs-infoserver/configuration.html
index b43f442..e735310 100755
--- a/stratosphere-runtime/resources/web-docs-infoserver/configuration.html
+++ b/stratosphere-runtime/resources/web-docs-infoserver/configuration.html
@@ -27,14 +27,25 @@
<script type="text/javascript" src="js/helpers.js"></script>
<script type="text/javascript" src="js/configuration.js"></script>
<script type="text/javascript" src="js/jcanvas.min.js"></script>
+
+ <!-- Load Menu -->
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $.ajax({ url : "menu?get=configuration", type : "GET", cache: false, success : function(html) {
+ $("#side-menu").empty();
+ $("#side-menu").append(html);
+ }, dataType : "html",
+ });
+ });
+ </script>
</head>
<body>
<div id="wrapper">
-
+
<!-- Sidebar -->
- <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
+ <nav class='navbar navbar-inverse navbar-fixed-top' role='navigation'>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
@@ -45,15 +56,12 @@
</button>
<a class="navbar-brand" href="index.html">Stratosphere</a>
</div>
-
+
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
- <ul class="nav navbar-nav side-nav">
- <li><a href="index.html"><i class="fa fa-dashboard"></i> Dashboard</a></li>
- <li><a href="history.html"><i class="fa fa-bar-chart-o"></i> History</a></li>
- <li class="active"><a href="configuration.html"><i class="fa fa-keyboard-o"></i> Configuration</a></li>
+ <ul id="side-menu" class="nav navbar-nav side-nav">
+ <!-- Filled via script -->
</ul>
-
<ul class="nav navbar-nav navbar-right navbar-user">
<li class="dropdown user-dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-archive"></i> Log Files<b class="caret"></b></a>
@@ -79,12 +87,8 @@
<div class="col-lg-12"><h3>Global Configuration</h2></div>
<div class="col-lg-12">
<div class="table-responsive" id="confTable">
-
-
-
-
</div>
- </div>
+ </div>
</div><!-- /.row -->
</div><!-- /#page-wrapper -->
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/resources/web-docs-infoserver/history.html
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/resources/web-docs-infoserver/history.html b/stratosphere-runtime/resources/web-docs-infoserver/history.html
index ac20a8f..5be2dfe 100755
--- a/stratosphere-runtime/resources/web-docs-infoserver/history.html
+++ b/stratosphere-runtime/resources/web-docs-infoserver/history.html
@@ -27,14 +27,25 @@
<script type="text/javascript" src="js/helpers.js"></script>
<script type="text/javascript" src="js/jobmanagerFrontend.js"></script>
<script type="text/javascript" src="js/jcanvas.min.js"></script>
+
+ <!-- Load Menu -->
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $.ajax({ url : "menu?get=history", type : "GET", cache: false, success : function(html) {
+ $("#side-menu").empty();
+ $("#side-menu").append(html);
+ }, dataType : "html",
+ });
+ });
+ </script>
</head>
<body>
<div id="wrapper">
-
+
<!-- Sidebar -->
- <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
+ <nav class='navbar navbar-inverse navbar-fixed-top' role='navigation'>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
@@ -45,21 +56,18 @@
</button>
<a class="navbar-brand" href="index.html">Stratosphere</a>
</div>
-
+
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
- <ul class="nav navbar-nav side-nav">
- <li><a href="index.html"><i class="fa fa-dashboard"></i> Dashboard</a></li>
- <li class="active"><a href="history.html"><i class="fa fa-bar-chart-o"></i> History</a></li>
- <li><a href="configuration.html"><i class="fa fa-keyboard-o"></i> Configuration</a></li>
+ <ul id="side-menu" class="nav navbar-nav side-nav">
+ <!-- Filled via script -->
</ul>
-
<ul class="nav navbar-nav navbar-right navbar-user">
<li class="dropdown user-dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-archive"></i> Log Files<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="logInfo"><i class="fa fa-keyboard-o"></i> Log Info</a></li>
- <li><a href="logInfo?get=stdout"><i class="fa fa-keyboard-o"></i> Stdout</a></li>
+ <li><a href="logInfo?get=stdout"><i class="fa fa-keyboard-o"></i> Stdout</a></li>
</ul>
</li>
</ul>
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/resources/web-docs-infoserver/index.html
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/resources/web-docs-infoserver/index.html b/stratosphere-runtime/resources/web-docs-infoserver/index.html
index a90f241..5819e4f 100755
--- a/stratosphere-runtime/resources/web-docs-infoserver/index.html
+++ b/stratosphere-runtime/resources/web-docs-infoserver/index.html
@@ -40,14 +40,25 @@
});
});
</script>
+
+ <!-- Load Menu -->
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $.ajax({ url : "menu?get=index", type : "GET", cache: false, success : function(html) {
+ $("#side-menu").empty();
+ $("#side-menu").append(html);
+ }, dataType : "html",
+ });
+ });
+ </script>
</head>
<body>
<div id="wrapper">
-
+
<!-- Sidebar -->
- <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
+ <nav class='navbar navbar-inverse navbar-fixed-top' role='navigation'>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
@@ -58,21 +69,18 @@
</button>
<a class="navbar-brand" href="index.html">Stratosphere</a>
</div>
-
+
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
- <ul class="nav navbar-nav side-nav">
- <li class="active"><a href="index.html"><i class="fa fa-dashboard"></i> Dashboard</a></li>
- <li><a href="history.html"><i class="fa fa-bar-chart-o"></i> History</a></li>
- <li><a href="configuration.html"><i class="fa fa-keyboard-o"></i> Configuration</a></li>
+ <ul id="side-menu" class="nav navbar-nav side-nav">
+ <!-- Filled via script -->
</ul>
-
<ul class="nav navbar-nav navbar-right navbar-user">
<li class="dropdown user-dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-archive"></i> Log Files<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="logInfo"><i class="fa fa-keyboard-o"></i> Log Info</a></li>
- <li><a href="logInfo?get=stdout"><i class="fa fa-keyboard-o"></i> Stdout</a></li>
+ <li><a href="logInfo?get=stdout"><i class="fa fa-keyboard-o"></i> Stdout</a></li>
</ul>
</li>
</ul>
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/resources/web-docs-infoserver/js/configuration.js
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/resources/web-docs-infoserver/js/configuration.js b/stratosphere-runtime/resources/web-docs-infoserver/js/configuration.js
index 2761408..31a0d3c 100644
--- a/stratosphere-runtime/resources/web-docs-infoserver/js/configuration.js
+++ b/stratosphere-runtime/resources/web-docs-infoserver/js/configuration.js
@@ -1,24 +1,15 @@
$(document).ready(function() {
- loadData();
-
-});
-
-/*
- * Load all necessary data
- */
-function loadData() {
- $.ajax({ url : "configuration", type : "GET", cache: false, success : function(json) {
+ $.ajax({ url : "setupInfo?get=globalC", type : "GET", cache: false, success : function(json) {
loadConfigTable(json);
}, dataType : "json",
});
-}
+});
/*
* Initializes global config table
*/
function loadConfigTable(json) {
- console.log(json);
$("#confTable").empty();
var table = "<table class=\"table table-bordered table-hover table-striped\">";
table += "<tr><th>Property</th><th>Value</th></tr>";
@@ -29,4 +20,4 @@ function loadConfigTable(json) {
}
table += "</table>";
$("#confTable").append(table);
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/resources/web-docs-infoserver/js/taskmanager.js
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/resources/web-docs-infoserver/js/taskmanager.js b/stratosphere-runtime/resources/web-docs-infoserver/js/taskmanager.js
new file mode 100644
index 0000000..14f870f
--- /dev/null
+++ b/stratosphere-runtime/resources/web-docs-infoserver/js/taskmanager.js
@@ -0,0 +1,32 @@
+
+$(document).ready(function() {
+ pollTaskmanagers();
+
+});
+
+/*
+ * Initializes taskmanagers table
+ */
+function loadTaskmanagers(json) {
+ $("#taskmanagerTable").empty();
+ var table = "<table class=\"table table-bordered table-hover table-striped\">";
+ table += "<tr><th>Node</th><th>Ipc Port</th><th>Data Port</th><th>Seconds since last Heartbeat</th>" +
+ "<th>Number of Slots</th><th>Available Slots</th><th>CPU Cores</th><th>Physical Memory (mb)</th><th>TaskManager Heapsize (mb)</th></tr>";
+ for (var i = 0; i < json.taskmanagers.length; i++) {
+ var tm = json.taskmanagers[i]
+ table += "<tr><td>"+tm.inetAdress+"</td><td>"+tm.ipcPort+"</td><td>"+tm.dataPort+"</td><td>"+tm.timeSinceLastHeartbeat+"</td>" +
+ "<td>"+tm.slotsNumber+"</td><td>"+tm.freeSlots+"</td><td>"+tm.cpuCores+"</td><td>"+tm.physicalMemory+"</td><td>"+tm.freeMemory+"</td></tr>";
+ }
+ table += "</table>";
+ $("#taskmanagerTable").append(table);
+}
+
+function pollTaskmanagers() {
+ $.ajax({ url : "setupInfo?get=taskmanagers", type : "GET", cache: false, success : function(json) {
+ loadTaskmanagers(json);
+ }, dataType : "json",
+ });
+ setTimeout(function() {
+ pollTaskmanagers();
+ }, 10000);
+}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/resources/web-docs-infoserver/taskmanagers.html
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/resources/web-docs-infoserver/taskmanagers.html b/stratosphere-runtime/resources/web-docs-infoserver/taskmanagers.html
new file mode 100755
index 0000000..7c91c28
--- /dev/null
+++ b/stratosphere-runtime/resources/web-docs-infoserver/taskmanagers.html
@@ -0,0 +1,98 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="">
+ <meta name="author" content="">
+
+ <title>Dashboard - Stratosphere</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="css/bootstrap.css" rel="stylesheet">
+
+ <!-- Add custom CSS here -->
+ <link href="css/sb-admin.css" rel="stylesheet">
+ <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
+
+ <!-- Page Specific CSS -->
+ <link rel="stylesheet" type="text/css" href="css/nephelefrontend.css" />
+
+ <!-- Scripts from Bootstrap -->
+ <script src="js/jquery-1.10.2.js"></script>
+ <script src="js/bootstrap.js"></script>
+
+ <!-- Scripts from Stratosphere -->
+ <script type="text/javascript" src="js/jquery.flot.min.js"></script>
+ <script type="text/javascript" src="js/helpers.js"></script>
+ <script type="text/javascript" src="js/taskmanager.js"></script>
+ <script type="text/javascript" src="js/jcanvas.min.js"></script>
+
+ <!-- Load Menu -->
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $.ajax({ url : "menu?get=taskmanagers", type : "GET", cache: false, success : function(html) {
+ $("#side-menu").empty();
+ $("#side-menu").append(html);
+ }, dataType : "html",
+ });
+ });
+ </script>
+ </head>
+
+ <body>
+
+ <div id="wrapper">
+
+ <!-- Sidebar -->
+ <nav class='navbar navbar-inverse navbar-fixed-top' role='navigation'>
+ <!-- Brand and toggle get grouped for better mobile display -->
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="index.html">Stratosphere</a>
+ </div>
+
+ <!-- Collect the nav links, forms, and other content for toggling -->
+ <div class="collapse navbar-collapse navbar-ex1-collapse">
+ <ul id="side-menu" class="nav navbar-nav side-nav">
+ <!-- Filled via script -->
+ </ul>
+ <ul class="nav navbar-nav navbar-right navbar-user">
+ <li class="dropdown user-dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-archive"></i> Log Files<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="logInfo"><i class="fa fa-keyboard-o"></i> Log Info</a></li>
+ <li><a href="logInfo?get=stdout"><i class="fa fa-keyboard-o"></i> Stdout</a></li>
+ </ul>
+ </li>
+ </ul>
+ </div><!-- /.navbar-collapse -->
+ </nav>
+
+ <div id="page-wrapper">
+
+ <div class="row">
+ <div class="col-lg-12">
+ <h1>Task Managers <small>Overview about connected Task Managers</small></h1>
+ <ol class="breadcrumb">
+ <li><a href="index.html"><i class="icon-dashboard"></i> Dashboard</a></li>
+ <li class="active"><i class="icon-file-alt"></i> Task Managers</li>
+ </ol>
+ </div>
+ <div class="col-lg-12">
+ <div class="table-responsive" id="taskmanagerTable">
+ </div>
+ </div>
+ </div><!-- /.row -->
+
+ </div><!-- /#page-wrapper -->
+
+ </div><!-- /#wrapper -->
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/DefaultInstanceManager.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/DefaultInstanceManager.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/DefaultInstanceManager.java
index 7d5f31b..097d0ec 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/DefaultInstanceManager.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/DefaultInstanceManager.java
@@ -18,6 +18,7 @@ import eu.stratosphere.configuration.GlobalConfiguration;
import eu.stratosphere.nephele.jobgraph.JobID;
import eu.stratosphere.nephele.topology.NetworkNode;
import eu.stratosphere.nephele.topology.NetworkTopology;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -390,4 +391,10 @@ public class DefaultInstanceManager implements InstanceManager {
return slots;
}
+
+ @Override
+ public Map<InstanceConnectionInfo, Instance> getInstances() {
+ return this.registeredHosts;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/Instance.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/Instance.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/Instance.java
index fa17745..114dd8d 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/Instance.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/Instance.java
@@ -359,4 +359,8 @@ public class Instance extends NetworkNode {
return slots;
}
+
+ public long getLastHeartBeat() {
+ return this.lastReceivedHeartBeat;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceConnectionInfo.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceConnectionInfo.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceConnectionInfo.java
index 257421b..98c3810 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceConnectionInfo.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceConnectionInfo.java
@@ -199,6 +199,10 @@ public class InstanceConnectionInfo implements IOReadableWritable, Comparable<In
return this.domainName;
}
+
+ public String getInetAdress() {
+ return this.inetAddress.toString();
+ }
@Override
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceManager.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceManager.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceManager.java
index 00795f4..2f41ebe 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceManager.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceManager.java
@@ -14,6 +14,8 @@
package eu.stratosphere.nephele.instance;
+import java.util.Map;
+
import eu.stratosphere.configuration.Configuration;
import eu.stratosphere.nephele.jobgraph.JobID;
import eu.stratosphere.nephele.topology.NetworkTopology;
@@ -41,4 +43,6 @@ public interface InstanceManager {
int getNumberOfTaskTrackers();
int getNumberOfSlots();
+
+ Map<InstanceConnectionInfo, Instance> getInstances();
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/JobManager.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/JobManager.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/JobManager.java
index 877288c..22c59fc 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/JobManager.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/JobManager.java
@@ -22,6 +22,7 @@ import java.net.UnknownHostException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -1177,6 +1178,10 @@ public class JobManager implements DeploymentManager, ExtendedManagementProtocol
public int getNumberOfTaskTrackers() {
return this.instanceManager.getNumberOfTaskTrackers();
}
+
+ public Map<InstanceConnectionInfo, Instance> getInstances() {
+ return this.instanceManager.getInstances();
+ }
@Override
public void reportAccumulatorResult(AccumulatorEvent accumulatorEvent) throws IOException {
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/ConfigurationServlet.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/ConfigurationServlet.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/ConfigurationServlet.java
deleted file mode 100644
index d00b9f0..0000000
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/ConfigurationServlet.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/***********************************************************************************************************************
- * Copyright (C) 2010-2013 by the Stratosphere project (http://stratosphere.eu)
- *
- * Licensed 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 eu.stratosphere.nephele.jobmanager.web;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.codehaus.jettison.json.JSONException;
-import org.codehaus.jettison.json.JSONObject;
-
-import eu.stratosphere.configuration.Configuration;
-import eu.stratosphere.configuration.GlobalConfiguration;
-
-/**
- * A Servlet that displays the Configruation in the webinterface.
- *
- */
-public class ConfigurationServlet extends HttpServlet {
-
- /**
- * Serial UID for serialization interoperability.
- */
- private static final long serialVersionUID = 3704963598772630435L;
-
- private Configuration globalC;
-
-
- public ConfigurationServlet() {
- globalC = GlobalConfiguration.getConfiguration();
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
-
- resp.setStatus(HttpServletResponse.SC_OK);
- resp.setContentType("application/json");
-
- Set<String> keys = globalC.keySet();
- List<String> list = new ArrayList<String>(keys);
- Collections.sort(list);
-
- JSONObject obj = new JSONObject();
- for (String k : list) {
- try {
- obj.put(k, globalC.getString(k, ""));
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
-
- PrintWriter w = resp.getWriter();
- w.write(obj.toString());
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/MenuServlet.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/MenuServlet.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/MenuServlet.java
new file mode 100644
index 0000000..34ff6a5
--- /dev/null
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/MenuServlet.java
@@ -0,0 +1,114 @@
+/***********************************************************************************************************************
+ * Copyright (C) 2010-2013 by the Stratosphere project (http://stratosphere.eu)
+ *
+ * Licensed 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 eu.stratosphere.nephele.jobmanager.web;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A Servlet that displays the Configruation in the webinterface.
+ *
+ */
+public class MenuServlet extends HttpServlet {
+
+ /**
+ * Serial UID for serialization interoperability.
+ */
+ private static final long serialVersionUID = 117543213991787547L;
+
+ /**
+ * The log for this class.
+ */
+ private static final Log LOG = LogFactory.getLog(MenuServlet.class);
+
+ /**
+ * Array of possible menu entries on the left
+ */
+ private static final String[] entries = {
+ "index", "history", "configuration", "taskmanagers"
+ };
+
+ /**
+ * The names of the menu entries shown in the browser
+ */
+ private static final String[] names = {
+ "Dashboard", "History", "Configuration", "Task Managers"
+ };
+
+ /**
+ * The classes of the icons shown next to the names in the browser
+ */
+ private static final String[] classes = {
+ "fa fa-dashboard", "fa fa-bar-chart-o", "fa fa-keyboard-o", "fa fa-building-o"
+ };
+
+ public MenuServlet() {
+ if (names.length != entries.length || names.length != classes.length) {
+ LOG.fatal("The Arrays 'entries', 'classes' and 'names' differ in thier length. This is not allowed!");
+ }
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+
+ resp.setStatus(HttpServletResponse.SC_OK);
+ resp.setContentType("application/json");
+
+ if ("index".equals(req.getParameter("get"))) {
+ writeMenu("index", resp);
+ } else if ("analyze".equals(req.getParameter("get"))) {
+ writeMenu("analyze", resp);
+ } else if ("history".equals(req.getParameter("get"))) {
+ writeMenu("history", resp);
+ } else if ("configuration".equals(req.getParameter("get"))) {
+ writeMenu("configuration", resp);
+ } else if ("taskmanagers".equals(req.getParameter("get"))) {
+ writeMenu("taskmanagers", resp);
+ }
+
+ }
+
+ private void writeMenu(String me, HttpServletResponse resp) throws IOException {
+
+ String r = "";
+
+ for (int i = 0; i < entries.length; i++) {
+ if (entries[i].equals(me)) {
+ r += writeLine(3, "<li class='active'><a href='"+ entries[i] +".html'><i class='"+ classes[i] +"'></i> "+ names[i] +"</a></li>");
+ } else {
+ r += writeLine(3, "<li><a href='"+ entries[i] +".html'><i class='"+ classes[i] +"'></i> "+ names[i] +"</a></li>");
+ }
+ }
+
+ resp.getWriter().write(r);
+ }
+
+ private String writeLine(int tab, String line) {
+ String s = "";
+ for (int i = 0; i < tab; i++) {
+ s += "\t";
+ }
+ s+= " " + line + " \n";
+ return s;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/SetupInfoServlet.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/SetupInfoServlet.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/SetupInfoServlet.java
new file mode 100644
index 0000000..b73e9fa
--- /dev/null
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/SetupInfoServlet.java
@@ -0,0 +1,142 @@
+/***********************************************************************************************************************
+ * Copyright (C) 2010-2013 by the Stratosphere project (http://stratosphere.eu)
+ *
+ * Licensed 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 eu.stratosphere.nephele.jobmanager.web;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+
+import eu.stratosphere.configuration.Configuration;
+import eu.stratosphere.configuration.GlobalConfiguration;
+import eu.stratosphere.nephele.instance.Instance;
+import eu.stratosphere.nephele.instance.InstanceConnectionInfo;
+import eu.stratosphere.nephele.jobmanager.JobManager;
+
+/**
+ * A Servlet that displays the Configruation in the webinterface.
+ *
+ */
+public class SetupInfoServlet extends HttpServlet {
+
+ /**
+ * Serial UID for serialization interoperability.
+ */
+ private static final long serialVersionUID = 3704963598772630435L;
+
+ /**
+ * The log for this class.
+ */
+ private static final Log LOG = LogFactory.getLog(SetupInfoServlet.class);
+
+ private Configuration globalC;
+ private JobManager jobmanager;
+
+ public SetupInfoServlet(JobManager jm) {
+ globalC = GlobalConfiguration.getConfiguration();
+ this.jobmanager = jm;
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+
+ resp.setStatus(HttpServletResponse.SC_OK);
+ resp.setContentType("application/json");
+
+ if ("globalC".equals(req.getParameter("get"))) {
+ writeGlobalConfiguration(resp);
+ } else if ("taskmanagers".equals(req.getParameter("get"))) {
+ writeTaskmanagers(resp);
+ }
+
+
+
+ }
+
+ private void writeGlobalConfiguration(HttpServletResponse resp) throws IOException {
+
+ Set<String> keys = globalC.keySet();
+ List<String> list = new ArrayList<String>(keys);
+ Collections.sort(list);
+
+ JSONObject obj = new JSONObject();
+ for (String k : list) {
+ try {
+ obj.put(k, globalC.getString(k, ""));
+ } catch (JSONException e) {
+ LOG.warn("Json object creation failed", e);
+ }
+ }
+
+ PrintWriter w = resp.getWriter();
+ w.write(obj.toString());
+
+ }
+
+ private void writeTaskmanagers(HttpServletResponse resp) throws IOException {
+
+ Set<InstanceConnectionInfo> keys = jobmanager.getInstances().keySet();
+ List<InstanceConnectionInfo> list = new ArrayList<InstanceConnectionInfo>(keys);
+ Collections.sort(list);
+
+ JSONObject obj = new JSONObject();
+ JSONArray array = new JSONArray();
+ for (InstanceConnectionInfo k : list) {
+ JSONObject objInner = new JSONObject();
+
+ Instance instance = jobmanager.getInstances().get(k);
+ long time = new Date().getTime() - instance.getLastHeartBeat();
+
+ try {
+ objInner.put("inetAdress", k.getInetAdress());
+ objInner.put("ipcPort", k.ipcPort());
+ objInner.put("dataPort", k.dataPort());
+ objInner.put("timeSinceLastHeartbeat", time / 1000);
+ objInner.put("slotsNumber", instance.getNumberOfSlots());
+ objInner.put("freeSlots", instance.getNumberOfAvailableSlots());
+ objInner.put("cpuCores", instance.getHardwareDescription().getNumberOfCPUCores());
+ objInner.put("physicalMemory", instance.getHardwareDescription().getSizeOfPhysicalMemory() / 1048576);
+ objInner.put("freeMemory", instance.getHardwareDescription().getSizeOfFreeMemory() / 1048576);
+ array.put(objInner);
+ } catch (JSONException e) {
+ LOG.warn("Json object creation failed", e);
+ }
+
+ }
+ try {
+ obj.put("taskmanagers", array);
+ } catch (JSONException e) {
+ LOG.warn("Json object creation failed", e);
+ }
+
+ PrintWriter w = resp.getWriter();
+ w.write(obj.toString());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/WebInfoServer.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/WebInfoServer.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/WebInfoServer.java
index 851d525..436d55e 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/WebInfoServer.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/WebInfoServer.java
@@ -114,7 +114,8 @@ public class WebInfoServer {
servletContext.setContextPath("/");
servletContext.addServlet(new ServletHolder(new JobmanagerInfoServlet(jobmanager)), "/jobsInfo");
servletContext.addServlet(new ServletHolder(new LogfileInfoServlet(new File(logDirPath))), "/logInfo");
- servletContext.addServlet(new ServletHolder(new ConfigurationServlet()), "/configuration");
+ servletContext.addServlet(new ServletHolder(new SetupInfoServlet(jobmanager)), "/setupInfo");
+ servletContext.addServlet(new ServletHolder(new MenuServlet()), "/menu");
// ----- the handler serving all the static files -----
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7a4c209a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/jobmanager/scheduler/queue/TestInstanceManager.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/jobmanager/scheduler/queue/TestInstanceManager.java b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/jobmanager/scheduler/queue/TestInstanceManager.java
index 5a3977a..688636b 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/jobmanager/scheduler/queue/TestInstanceManager.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/jobmanager/scheduler/queue/TestInstanceManager.java
@@ -17,10 +17,10 @@ import java.net.Inet4Address;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import eu.stratosphere.configuration.Configuration;
import eu.stratosphere.nephele.instance.*;
-import eu.stratosphere.nephele.instance.Instance;
import eu.stratosphere.nephele.jobgraph.JobID;
import eu.stratosphere.nephele.topology.NetworkNode;
import eu.stratosphere.nephele.topology.NetworkTopology;
@@ -184,4 +184,10 @@ public final class TestInstanceManager implements InstanceManager {
public int getNumberOfSlots() {
return this.testInstance.getNumberOfSlots();
}
+
+
+ @Override
+ public Map<InstanceConnectionInfo, Instance> getInstances() {
+ throw new IllegalStateException("getInstances called on TestInstanceManager");
+ }
}