aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject git commit: Adding a getTasksStatusLight RPC to return null ExecutorConfig.
Date Fri, 20 Jun 2014 21:43:41 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 5eb110b34 -> 76dec33ad


Adding a getTasksStatusLight RPC to return null ExecutorConfig.

Bugs closed: AURORA-539

Reviewed at https://reviews.apache.org/r/22790/


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

Branch: refs/heads/master
Commit: 76dec33ad61c08bc2dd4213e42a5b09d5a87d12b
Parents: 5eb110b
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Fri Jun 20 14:43:21 2014 -0700
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Fri Jun 20 14:43:21 2014 -0700

----------------------------------------------------------------------
 .../thrift/SchedulerThriftInterface.java        | 24 ++++++++++++++++++--
 .../thrift/org/apache/aurora/gen/api.thrift     |  4 ++++
 .../thrift/SchedulerThriftInterfaceTest.java    | 21 +++++++++++++----
 .../scheduler/thrift/aop/ForwardingThrift.java  |  5 ++++
 .../org/apache/aurora/gen/api.thrift.md5        |  2 +-
 5 files changed, 49 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/76dec33a/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
b/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
index f9c03b4..7cc435f 100644
--- a/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
+++ b/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
@@ -79,6 +79,7 @@ import org.apache.aurora.gen.RoleSummary;
 import org.apache.aurora.gen.RoleSummaryResult;
 import org.apache.aurora.gen.ScheduleStatus;
 import org.apache.aurora.gen.ScheduleStatusResult;
+import org.apache.aurora.gen.ScheduledTask;
 import org.apache.aurora.gen.SessionKey;
 import org.apache.aurora.gen.StartMaintenanceResult;
 import org.apache.aurora.gen.TaskConfig;
@@ -409,6 +410,26 @@ class SchedulerThriftInterface implements AuroraAdmin.Iface {
   // TODO(William Farner): Provide status information about cron jobs here.
   @Override
   public Response getTasksStatus(TaskQuery query) {
+    return okResponse(Result.scheduleStatusResult(
+        new ScheduleStatusResult().setTasks(getTasks(query))));
+  }
+
+  @Override
+  public Response getTasksWithoutConfigs(TaskQuery query) {
+    List<ScheduledTask> tasks = Lists.transform(
+        getTasks(query),
+        new Function<ScheduledTask, ScheduledTask>() {
+          @Override
+          public ScheduledTask apply(ScheduledTask task) {
+            task.assignedTask.task.executorConfig = null;
+            return task;
+          }
+        });
+
+    return okResponse(Result.scheduleStatusResult(new ScheduleStatusResult().setTasks(tasks)));
+  }
+
+  private List<ScheduledTask> getTasks(TaskQuery query) {
     checkNotNull(query);
 
     Iterable<IScheduledTask> tasks =
@@ -421,8 +442,7 @@ class SchedulerThriftInterface implements AuroraAdmin.Iface {
       tasks = Iterables.limit(tasks, query.getLimit());
     }
 
-    return okResponse(Result.scheduleStatusResult(
-            new ScheduleStatusResult().setTasks(IScheduledTask.toBuildersList(tasks))));
+    return IScheduledTask.toBuildersList(tasks);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/76dec33a/src/main/thrift/org/apache/aurora/gen/api.thrift
----------------------------------------------------------------------
diff --git a/src/main/thrift/org/apache/aurora/gen/api.thrift b/src/main/thrift/org/apache/aurora/gen/api.thrift
index d115c74..4a468d7 100644
--- a/src/main/thrift/org/apache/aurora/gen/api.thrift
+++ b/src/main/thrift/org/apache/aurora/gen/api.thrift
@@ -487,6 +487,10 @@ service ReadOnlyScheduler {
   // Fetches the status of tasks.
   Response getTasksStatus(1: TaskQuery query)
 
+  // Same as getTaskStatus but without the TaskConfig.ExecutorConfig data set.
+  // This is an interim solution until we have a better way to query TaskConfigs (AURORA-541).
+  Response getTasksWithoutConfigs(1: TaskQuery query)
+
   // Fetches the status of jobs.
   // ownerRole is optional, in which case all jobs are returned.
   Response getJobs(1: string ownerRole)

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/76dec33a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
b/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
index c93daeb..3807c12 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
@@ -1288,17 +1288,28 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
   @Test
   public void testGetTasksStatus() throws Exception {
     Builder query = Query.unscoped();
-
     Iterable<IScheduledTask> tasks = makeDefaultScheduledTasks(10);
-
     storageUtil.expectTaskFetch(query, ImmutableSet.copyOf(tasks));
 
     control.replay();
 
     ImmutableList<ScheduledTask> expected = IScheduledTask.toBuildersList(tasks);
-
     Response response = assertOkResponse(thrift.getTasksStatus(new TaskQuery()));
+    assertEquals(expected, response.getResult().getScheduleStatusResult().getTasks());
+  }
+
+  @Test
+  public void testGetTasksWithoutConfigs() throws Exception {
+    Builder query = Query.unscoped();
+    storageUtil.expectTaskFetch(query, ImmutableSet.copyOf(makeDefaultScheduledTasks(10)));
+
+    control.replay();
+
+    ImmutableList<ScheduledTask> expected = IScheduledTask.toBuildersList(makeDefaultScheduledTasks(
+        10,
+        defaultTask(true).setExecutorConfig(null)));
 
+    Response response = assertOkResponse(thrift.getTasksWithoutConfigs(new TaskQuery()));
     assertEquals(expected, response.getResult().getScheduleStatusResult().getTasks());
   }
 
@@ -1619,8 +1630,10 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
   }
 
   private static Iterable<IScheduledTask> makeDefaultScheduledTasks(int n) {
-    TaskConfig config = defaultTask(true);
+    return makeDefaultScheduledTasks(n, defaultTask(true));
+  }
 
+  private static Iterable<IScheduledTask> makeDefaultScheduledTasks(int n, TaskConfig
config) {
     List<IScheduledTask> tasks = Lists.newArrayList();
     for (int i = 0; i < n; i++) {
       tasks.add(IScheduledTask.build(new ScheduledTask()

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/76dec33a/src/test/java/org/apache/aurora/scheduler/thrift/aop/ForwardingThrift.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/aop/ForwardingThrift.java b/src/test/java/org/apache/aurora/scheduler/thrift/aop/ForwardingThrift.java
index 1f1f05e..9991e3c 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/aop/ForwardingThrift.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/aop/ForwardingThrift.java
@@ -167,6 +167,11 @@ abstract class ForwardingThrift implements AuroraAdmin.Iface {
   }
 
   @Override
+  public Response getTasksWithoutConfigs(TaskQuery query) throws TException {
+    return delegate.getTasksStatus(query);
+  }
+
+  @Override
   public Response getJobs(String ownerRole) throws TException {
     return delegate.getJobs(ownerRole);
   }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/76dec33a/src/test/resources/org/apache/aurora/gen/api.thrift.md5
----------------------------------------------------------------------
diff --git a/src/test/resources/org/apache/aurora/gen/api.thrift.md5 b/src/test/resources/org/apache/aurora/gen/api.thrift.md5
index 255b3d9..a201d3c 100644
--- a/src/test/resources/org/apache/aurora/gen/api.thrift.md5
+++ b/src/test/resources/org/apache/aurora/gen/api.thrift.md5
@@ -1 +1 @@
-34d9e4cafe845ccff03ef21ced50f7f9
+8f819cbaa88a131143aa3884d449ed7a


Mime
View raw message