You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by ma...@apache.org on 2014/01/15 22:38:09 UTC
[46/50] [abbrv] git commit: Removing code for old home page.
Removing code for old home page.
Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/a306c0d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/a306c0d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/a306c0d4
Branch: refs/heads/mansu/AURORA-4187_scheduler_home_page-no-seed
Commit: a306c0d412e3aaf7bb425e866a9677bca5798a18
Parents: 6b62de3
Author: Suman Karumuri <sk...@twitter.com>
Authored: Tue Jan 7 00:00:33 2014 -0800
Committer: Suman Karumuri <sk...@twitter.com>
Committed: Mon Jan 13 15:24:40 2014 -0800
----------------------------------------------------------------------
.../aurora/scheduler/http/DisplayUtils.java | 13 +-
.../aurora/scheduler/http/SchedulerzHome.java | 146 -------------------
.../aurora/scheduler/http/schedulerzhome.st | 53 -------
3 files changed, 3 insertions(+), 209 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a306c0d4/src/main/java/org/apache/aurora/scheduler/http/DisplayUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/DisplayUtils.java b/src/main/java/org/apache/aurora/scheduler/http/DisplayUtils.java
index d775ede..e156c72 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/DisplayUtils.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/DisplayUtils.java
@@ -17,14 +17,14 @@ package org.apache.aurora.scheduler.http;
import com.google.common.base.Function;
import com.google.common.collect.Ordering;
-import com.twitter.common.args.Arg;
-import com.twitter.common.args.CmdLine;
import org.apache.aurora.scheduler.MesosTaskFactory.MesosTaskFactoryImpl;
-import org.apache.aurora.scheduler.http.SchedulerzHome.Role;
import org.apache.aurora.scheduler.http.SchedulerzRole.Job;
import org.apache.aurora.scheduler.storage.entities.IJobKey;
+import com.twitter.common.args.Arg;
+import com.twitter.common.args.CmdLine;
+
/**
* Utility class to hold common display helper functions.
*/
@@ -37,13 +37,6 @@ public final class DisplayUtils {
// Utility class.
}
- static final Ordering<Role> ROLE_ORDERING = Ordering.natural().onResultOf(
- new Function<Role, String>() {
- @Override public String apply(Role role) {
- return role.getRole();
- }
- });
-
static final Ordering<Job> JOB_ORDERING = Ordering.natural().onResultOf(
new Function<Job, String>() {
@Override public String apply(Job job) {
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a306c0d4/src/main/java/org/apache/aurora/scheduler/http/SchedulerzHome.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/SchedulerzHome.java b/src/main/java/org/apache/aurora/scheduler/http/SchedulerzHome.java
deleted file mode 100644
index 263591a..0000000
--- a/src/main/java/org/apache/aurora/scheduler/http/SchedulerzHome.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
- * Copyright 2013 Apache Software Foundation
- *
- * 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 org.apache.aurora.scheduler.http;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import com.google.common.base.Function;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-import com.twitter.common.base.Closure;
-
-import org.antlr.stringtemplate.StringTemplate;
-import org.apache.aurora.scheduler.base.Query;
-import org.apache.aurora.scheduler.base.Tasks;
-import org.apache.aurora.scheduler.state.CronJobManager;
-import org.apache.aurora.scheduler.storage.Storage;
-import org.apache.aurora.scheduler.storage.entities.IJobConfiguration;
-import org.apache.aurora.scheduler.storage.entities.IScheduledTask;
-import org.apache.aurora.scheduler.storage.entities.ITaskConfig;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.twitter.common.base.MorePreconditions.checkNotBlank;
-
-/**
- * HTTP interface to serve as a HUD for the aurora scheduler.
- */
-@Path("/scheduler")
-public class SchedulerzHome extends JerseyTemplateServlet {
-
- private static final Function<String, Role> CREATE_ROLE = new Function<String, Role>() {
- @Override public Role apply(String ownerRole) {
- Role role = new Role();
- role.role = ownerRole;
- return role;
- }
- };
-
- private final Storage storage;
- private final CronJobManager cronScheduler;
- private final String clusterName;
-
- /**
- * Creates a new scheduler home servlet.
- *
- * @param storage Backing store to fetch tasks from.
- * @param cronScheduler Cron scheduler.
- * @param clusterName Name of the serving cluster.
- */
- @Inject
- public SchedulerzHome(
- Storage storage,
- CronJobManager cronScheduler,
- @ClusterName String clusterName) {
-
- super("schedulerzhome");
- this.storage = checkNotNull(storage);
- this.cronScheduler = checkNotNull(cronScheduler);
- this.clusterName = checkNotBlank(clusterName);
- }
-
- /**
- * Fetches the scheduler landing page.
- *
- * @return HTTP response.
- */
- @GET
- @Produces(MediaType.TEXT_HTML)
- public Response get() {
- return fillTemplate(new Closure<StringTemplate>() {
- @Override public void execute(StringTemplate template) {
- template.setAttribute("cluster_name", clusterName);
-
- LoadingCache<String, Role> owners =
- CacheBuilder.newBuilder().build(CacheLoader.from(CREATE_ROLE));
-
- // TODO(William Farner): Render this page without an expensive query.
- Set<IScheduledTask> tasks =
- Storage.Util.weaklyConsistentFetchTasks(storage, Query.unscoped());
- for (ITaskConfig task : Iterables.transform(tasks, Tasks.SCHEDULED_TO_INFO)) {
- owners.getUnchecked(task.getOwner().getRole()).accumulate(task);
- }
-
- // Add cron job counts for each role.
- for (IJobConfiguration job : cronScheduler.getJobs()) {
- owners.getUnchecked(job.getOwner().getRole()).accumulate(job);
- }
-
- template.setAttribute(
- "owners",
- DisplayUtils.ROLE_ORDERING.sortedCopy(owners.asMap().values()));
- }
- });
- }
-
- /**
- * Template object to represent a role.
- */
- static class Role {
- private String role;
- private Set<String> jobs = Sets.newHashSet();
- private Set<String> cronJobs = Sets.newHashSet();
-
- private void accumulate(ITaskConfig task) {
- jobs.add(task.getJobName());
- }
-
- private void accumulate(IJobConfiguration job) {
- cronJobs.add(job.getKey().getName());
- }
-
- public String getRole() {
- return role;
- }
-
- public int getJobCount() {
- return jobs.size();
- }
-
- public int getCronJobCount() {
- return cronJobs.size();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a306c0d4/src/main/resources/org/apache/aurora/scheduler/http/schedulerzhome.st
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/schedulerzhome.st b/src/main/resources/org/apache/aurora/scheduler/http/schedulerzhome.st
deleted file mode 100644
index 5e540f3..0000000
--- a/src/main/resources/org/apache/aurora/scheduler/http/schedulerzhome.st
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="UTF-8">
- <meta name="google" value="notranslate">
- <link rel="icon" href="/images/aurora.png" type="image/png" />
- <title>Aurora $cluster_name$ scheduler</title>
- <link href="/css/bootstrap.min.css" rel="stylesheet" />
- <link href="/css/jquery.dataTables.css" rel="stylesheet" />
- <script type="text/javascript" src="/js/jquery.min.js"></script>
- <script type="text/javascript" src="/js/bootstrap.min.js"></script>
- <script type="text/javascript" src="/js/jquery.dataTables.min.js"></script>
- <script type="text/javascript" src="/js/dataTables.bootstrap.js"></script>
- <script type="text/javascript" src="/js/dataTables.localstorage.js"></script>
- </head>
- <body>
- <div class="container-fluid">
- <div class="row-fluid">
- <center>
- <h2>Scheduled Jobs</h2>
- </center>
- </div>
-
- <table id="jobs-table" class="table table-bordered table-striped table-condensed table-hover">
- <thead>
- <th>Role
- <th>Jobs
- <th>Cron Jobs
- </thead>
- <tbody>
- $owners:{ owner |
- <tr>
- <td><a href="/scheduler/$owner.role$">$owner.role$</a>
- <td>$owner.jobCount$
- <td>$owner.cronJobCount$
- </tr>
- }$
- </tbody>
- </table>
- $if(exception)$
- <font color='red'>Exception: $exception$</font>
- $endif$
- </div>
-
- <script type="text/javascript">
- jQuery(function(){
- jQuery('#jobs-table').dataTable({
- 'bStateSave': true
- });
- });
- </script>
- </body>
-</html>