aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [1/5] git commit: Added getRoleSummary call to thrift api.
Date Fri, 13 Dec 2013 00:40:53 GMT
Updated Branches:
  refs/heads/skarumuri/MESOS-4679_api_jobs_by_role [created] 8badb0f2d


Added getRoleSummary call to thrift api.


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

Branch: refs/heads/skarumuri/MESOS-4679_api_jobs_by_role
Commit: dd21cb61412b8c0f6818f0eaf48f4150dda8abf1
Parents: b283dc3
Author: Suman Karumuri <skarumuri@twitter.com>
Authored: Mon Nov 25 16:04:15 2013 -0800
Committer: Suman Karumuri <skarumuri@twitter.com>
Committed: Mon Nov 25 16:04:15 2013 -0800

----------------------------------------------------------------------
 .../thrift/SchedulerThriftInterface.java        | 23 ++++++++++++++++++++
 .../thrift/com/twitter/aurora/gen/api.thrift    | 23 +++++++++++++++++++-
 .../scheduler/thrift/aop/ForwardingThrift.java  |  5 +++++
 3 files changed, 50 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/dd21cb61/src/main/java/com/twitter/aurora/scheduler/thrift/SchedulerThriftInterface.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/thrift/SchedulerThriftInterface.java
b/src/main/java/com/twitter/aurora/scheduler/thrift/SchedulerThriftInterface.java
index 5237a6e..ca90e74 100644
--- a/src/main/java/com/twitter/aurora/scheduler/thrift/SchedulerThriftInterface.java
+++ b/src/main/java/com/twitter/aurora/scheduler/thrift/SchedulerThriftInterface.java
@@ -369,6 +369,29 @@ class SchedulerThriftInterface implements AuroraAdmin.Iface {
     return response;
   }
 
+
+  public Response getRoleSummary() {
+//    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()));
+    return null;
+  }
+
   @Override
   public Response getJobs(@Nullable String maybeNullRole) {
     Optional<String> ownerRole = Optional.fromNullable(maybeNullRole);

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/dd21cb61/src/main/thrift/com/twitter/aurora/gen/api.thrift
----------------------------------------------------------------------
diff --git a/src/main/thrift/com/twitter/aurora/gen/api.thrift b/src/main/thrift/com/twitter/aurora/gen/api.thrift
index 3f8d61d..c7012f8 100644
--- a/src/main/thrift/com/twitter/aurora/gen/api.thrift
+++ b/src/main/thrift/com/twitter/aurora/gen/api.thrift
@@ -356,6 +356,12 @@ struct HostStatus {
   2: MaintenanceMode mode
 }
 
+struct RoleSummary {
+  1: string role
+  2: i32 jobCount
+  3: i32 cronJobCount
+}
+
 struct Hosts {
   1: set<string> hostNames
 }
@@ -384,6 +390,10 @@ struct EndMaintenanceResult {
   1: set<HostStatus> statuses
 }
 
+struct RoleSummaryResult {
+  1: set<RoleSummary> summaries
+}
+
 // Specifies validation level for the populateJobConfig.
 enum JobConfigValidation {
   NONE              = 0   // No additional job config validation would be performed (only
parsing).
@@ -403,6 +413,7 @@ union Result {
   11: EndMaintenanceResult endMaintenanceResult
   15: APIVersion getVersionResult
   16: AcquireLockResult acquireLockResult
+  17: RoleSummaryResult roleSummaryResult
 }
 
 struct Response {
@@ -412,10 +423,16 @@ struct Response {
   3: optional Result result
 }
 
+// A service that provides all the read only calls to the Aurora scheduler.
+service ReadOnlyScheduler {
+  // Returns a summary of the jobs grouped by role.
+  Response getRoleSummary()
+}
+
 // Due to assumptions in the client all authenticated RPCs must have a SessionKey as their
 // last argument. Note that the order in this file is what matters, and message numbers should
still
 // never be reused.
-service AuroraSchedulerManager {
+service AuroraSchedulerManager extends ReadOnlyScheduler {
   // Creates a new job.  The request will be denied if a job with the provided
   // name already exists in the cluster.
   Response createJob(1: JobConfiguration description, 3: Lock lock, 2: SessionKey session)
@@ -431,9 +448,11 @@ service AuroraSchedulerManager {
   // Restarts a batch of shards.
   Response restartShards(5: JobKey job, 3: set<i32> shardIds, 6: Lock lock 4: SessionKey
session)
 
+  // TODO(Suman Karumuri): Move this call into read only api
   // Fetches the status of tasks.
   Response getTasksStatus(1: TaskQuery query)
 
+  // TODO(Suman Karumuri): Move this call into the read only api
   // Fetches the status of jobs.
   // ownerRole is optional, in which case all jobs are returned.
   Response getJobs(1: string ownerRole)
@@ -441,9 +460,11 @@ service AuroraSchedulerManager {
   // Initiates a kill on tasks.
   Response killTasks(1: TaskQuery query, 3: Lock lock, 2: SessionKey session)
 
+  // TODO(Suman Karumuri): Move this call into the read only api
   // Fetches the quota allocated for a user.
   Response getQuota(1: string ownerRole)
 
+  // TODO(Suman Karumuri): Move this call into the read only api
   // Returns the current version of the API implementation
   Response getVersion()
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/dd21cb61/src/test/java/com/twitter/aurora/scheduler/thrift/aop/ForwardingThrift.java
----------------------------------------------------------------------
diff --git a/src/test/java/com/twitter/aurora/scheduler/thrift/aop/ForwardingThrift.java b/src/test/java/com/twitter/aurora/scheduler/thrift/aop/ForwardingThrift.java
index 7c5100b..b76c92b 100644
--- a/src/test/java/com/twitter/aurora/scheduler/thrift/aop/ForwardingThrift.java
+++ b/src/test/java/com/twitter/aurora/scheduler/thrift/aop/ForwardingThrift.java
@@ -107,6 +107,11 @@ abstract class ForwardingThrift implements AuroraAdmin.Iface {
   }
 
   @Override
+  public Response getRoleSummary() throws TException {
+    return delegate.getRoleSummary();
+  }
+
+  @Override
   public Response createJob(JobConfiguration description, Lock lock, SessionKey session)
       throws TException {
 


Mime
View raw message