azkaban-aplcache

Details

diff --git a/src/java/azkaban/webapp/plugin/PluginRegistry.java b/src/java/azkaban/webapp/plugin/PluginRegistry.java
index 0d98f32..d49db54 100644
--- a/src/java/azkaban/webapp/plugin/PluginRegistry.java
+++ b/src/java/azkaban/webapp/plugin/PluginRegistry.java
@@ -59,7 +59,11 @@ public class PluginRegistry {
 	}
 
 	public List<ViewerPlugin> getViewerPluginsForJobType(String jobType) {
-		return new ArrayList<ViewerPlugin>(jobTypeViewerPlugins.get(jobType));
+		TreeSet<ViewerPlugin> plugins = jobTypeViewerPlugins.get(jobType);
+		if (plugins == null) {
+			return null;
+		}
+		return new ArrayList<ViewerPlugin>(plugins);
 	}
 
   public static PluginRegistry getRegistry() {
diff --git a/src/java/azkaban/webapp/servlet/ExecutorServlet.java b/src/java/azkaban/webapp/servlet/ExecutorServlet.java
index 309ffc8..e154480 100644
--- a/src/java/azkaban/webapp/servlet/ExecutorServlet.java
+++ b/src/java/azkaban/webapp/servlet/ExecutorServlet.java
@@ -50,6 +50,8 @@ import azkaban.utils.FileIOUtils.LogData;
 import azkaban.utils.JSONUtils;
 import azkaban.webapp.AzkabanWebServer;
 import azkaban.webapp.session.Session;
+import azkaban.webapp.plugin.PluginRegistry;
+import azkaban.webapp.plugin.ViewerPlugin;
 
 public class ExecutorServlet extends LoginAbstractAzkabanServlet {
 	private static final long serialVersionUID = 1L;
@@ -197,7 +199,18 @@ public class ExecutorServlet extends LoginAbstractAzkabanServlet {
 				page.render();
 				return;
 			}
-		} catch (ExecutorManagerException e) {
+
+			ExecutableNode node = flow.getExecutableNode(jobId);
+			if (node == null) {
+				page.add("errorMsg", "Job " + jobId + " doesn't exist in " + flow.getExecutionId());
+				return;
+			}
+		
+			List<ViewerPlugin> jobViewerPlugins = PluginRegistry.getRegistry()
+					.getViewerPluginsForJobType(node.getType());
+			page.add("jobViewerPlugins", jobViewerPlugins);
+		}
+		catch (ExecutorManagerException e) {
 			page.add("errorMsg", "Error loading executing flow: " + e.getMessage());
 			page.render();
 			return;
@@ -209,7 +222,7 @@ public class ExecutorServlet extends LoginAbstractAzkabanServlet {
 			page.render();
 			return;
 		}
-		
+
 		page.add("projectName", project.getName());
 		page.add("flowid", flow.getFlowId());
 		
diff --git a/src/java/azkaban/webapp/servlet/velocity/jobdetailsheader.vm b/src/java/azkaban/webapp/servlet/velocity/jobdetailsheader.vm
new file mode 100644
index 0000000..4bf06c3
--- /dev/null
+++ b/src/java/azkaban/webapp/servlet/velocity/jobdetailsheader.vm
@@ -0,0 +1,61 @@
+#*
+ * Copyright 2014 LinkedIn Corp.
+ * 
+ * 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.
+*#
+
+	## Page header.
+
+		<div class="az-page-header">
+			<div class="container-full">
+				<div class="row">
+					<div class="col-xs-6">
+						<h1><a href="${context}/executor?execid=${execid}&job=${jobid}">Job Execution <small>$jobid</small></a></h1>
+					</div>
+					<div class="col-xs-6">
+						<div class="pull-right az-page-header-form">
+							<a href="${context}/manager?project=${projectName}&flow=${flowid}&job=$jobid" class="btn btn-info">Job Properties</a>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	
+    <div class="container-full">
+
+  #parse ("azkaban/webapp/servlet/velocity/alerts.vm")
+
+  ## Breadcrumb
+
+			<ol class="breadcrumb">
+				<li><a href="${context}/manager?project=${projectName}"><strong>Project</strong> $projectName</a></li>
+				<li><a href="${context}/manager?project=${projectName}&flow=${flowid}"><strong>Flow</strong> $flowid</a></li>
+				<li><a href="${context}/executor?execid=${execid}#jobslist"><strong>Execution</strong> $execid</a></li>
+        <li class="active"><strong>Job</strong> $jobid</li>
+			</ol>
+
+  ## Tabs
+
+			<ul class="nav nav-tabs" id="headertabs">
+	#if ($current_page == "executing")
+				<li id="jobLogViewLink"><a href="#logs">Job Logs</a></li>
+				<li id="jobSummaryViewLink"><a href="#summary">Summary</a></li>
+	#else
+				<li id="jobLogViewLink"><a href="${context}/executor?execid=${execid}&job=${jobid}#logs">Job Logs</a></li>
+				<li id="jobSummaryViewLink"><a href="${context}/executor?execid=${execid}&job=${jobid}#summary">Summary</a></li>
+	#end
+	#foreach ($jobViewerPlugin in $jobViewerPlugins)
+				<li#if($current_page == $jobViewerPlugin.pluginName) class="active"#end><a href="$!context/${jobViewerPlugin.pluginPath}?execid=${execid}&jobid=${jobid}">$jobViewerPlugin.pluginName</a></li>
+	#end
+			</ul>
+    </div>
diff --git a/src/java/azkaban/webapp/servlet/velocity/jobdetailspage.vm b/src/java/azkaban/webapp/servlet/velocity/jobdetailspage.vm
index 50858db..335f24c 100644
--- a/src/java/azkaban/webapp/servlet/velocity/jobdetailspage.vm
+++ b/src/java/azkaban/webapp/servlet/velocity/jobdetailspage.vm
@@ -47,44 +47,8 @@
   #parse ("azkaban/webapp/servlet/velocity/errormsg.vm")
 #else
 
-	## Page header.
 
-		<div class="az-page-header">
-			<div class="container-full">
-				<div class="row">
-					<div class="col-xs-6">
-						<h1><a href="${context}/executor?execid=${execid}&job=${jobid}">Job Execution <small>$jobid</small></a></h1>
-					</div>
-					<div class="col-xs-6">
-						<div class="pull-right az-page-header-form">
-							<a href="${context}/manager?project=${projectName}&flow=${flowid}&job=$jobid" class="btn btn-info">Job Properties</a>
-						</div>
-					</div>
-				</div>
-			</div>
-		</div>
-	
-    <div class="container-full">
-
-  #parse ("azkaban/webapp/servlet/velocity/alerts.vm")
-
-  ## Breadcrumb
-
-			<ol class="breadcrumb">
-				<li><a href="${context}/manager?project=${projectName}"><strong>Project</strong> $projectName</a></li>
-				<li><a href="${context}/manager?project=${projectName}&flow=${flowid}"><strong>Flow</strong> $flowid</a></li>
-				<li><a href="${context}/executor?execid=${execid}#jobslist"><strong>Execution</strong> $execid</a></li>
-        <li class="active"><strong>Job</strong> $jobid</li>
-			</ol>
-
-  ## Tabs
-
-			<ul class="nav nav-tabs" id="headertabs">
-				<li id="jobLogViewLink"><a href="#logs">Job Logs</a></li>
-				<li id="jobSummaryViewLink"><a href="#summary">Summary</a></li>
-				<li><a href="${context}/pigvisualizer?execid=${execid}&jobid=${jobid}">Visualization</a></li>
-			</ul>
-    </div>
+  #parse ("azkaban/webapp/servlet/velocity/jobdetailsheader.vm")
 
 	## Log content.