aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject aurora git commit: set TaskStatus.slave_id field in TaskReconsiler
Date Tue, 08 Dec 2015 22:04:17 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 2e2371481 -> 11577c703


set TaskStatus.slave_id field in TaskReconsiler

Bugs closed: AURORA-1547

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


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

Branch: refs/heads/master
Commit: 11577c70374f75ba176b005e3173d0996257b7d8
Parents: 2e23714
Author: Tengfei Mu <tengfeimu3@gmail.com>
Authored: Tue Dec 8 14:04:02 2015 -0800
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Tue Dec 8 14:04:02 2015 -0800

----------------------------------------------------------------------
 .../reconciliation/TaskReconciler.java          |  2 ++
 .../reconciliation/TaskReconcilerTest.java      | 29 +++++++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/11577c70/src/main/java/org/apache/aurora/scheduler/reconciliation/TaskReconciler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/reconciliation/TaskReconciler.java
b/src/main/java/org/apache/aurora/scheduler/reconciliation/TaskReconciler.java
index cb5c93e..57d2061 100644
--- a/src/main/java/org/apache/aurora/scheduler/reconciliation/TaskReconciler.java
+++ b/src/main/java/org/apache/aurora/scheduler/reconciliation/TaskReconciler.java
@@ -146,6 +146,8 @@ public class TaskReconciler extends AbstractIdleService {
           // accepting task IDs instead. AURORA-1326 tracks solution on the scheduler side.
           // Setting TASK_RUNNING as a safe dummy value here.
           .setState(Protos.TaskState.TASK_RUNNING)
+          .setSlaveId(
+              Protos.SlaveID.newBuilder().setValue(t.getAssignedTask().getSlaveId()).build())
           .setTaskId(Protos.TaskID.newBuilder().setValue(t.getAssignedTask().getTaskId()).build())
           .build();
 }

http://git-wip-us.apache.org/repos/asf/aurora/blob/11577c70/src/test/java/org/apache/aurora/scheduler/reconciliation/TaskReconcilerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/reconciliation/TaskReconcilerTest.java
b/src/test/java/org/apache/aurora/scheduler/reconciliation/TaskReconcilerTest.java
index 1308a1c..e6a39ac 100644
--- a/src/test/java/org/apache/aurora/scheduler/reconciliation/TaskReconcilerTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/reconciliation/TaskReconcilerTest.java
@@ -16,17 +16,24 @@ package org.apache.aurora.scheduler.reconciliation;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.atomic.AtomicLong;
 
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 
 import org.apache.aurora.common.quantity.Amount;
 import org.apache.aurora.common.quantity.Time;
 import org.apache.aurora.common.stats.StatsProvider;
 import org.apache.aurora.common.testing.easymock.EasyMockTest;
+import org.apache.aurora.gen.AssignedTask;
+import org.apache.aurora.gen.ScheduleStatus;
+import org.apache.aurora.gen.ScheduledTask;
+import org.apache.aurora.gen.TaskEvent;
 import org.apache.aurora.scheduler.base.Query;
 import org.apache.aurora.scheduler.base.TaskTestUtil;
 import org.apache.aurora.scheduler.base.Tasks;
 import org.apache.aurora.scheduler.mesos.Driver;
 import org.apache.aurora.scheduler.storage.entities.IScheduledTask;
+import org.apache.aurora.scheduler.storage.entities.ITaskConfig;
 import org.apache.aurora.scheduler.storage.testing.StorageTestUtil;
 import org.apache.aurora.scheduler.testing.FakeScheduledExecutor;
 import org.junit.Before;
@@ -77,7 +84,7 @@ public class TaskReconcilerTest extends EasyMockTest {
     expect(statsProvider.makeCounter(IMPLICIT_STAT_NAME)).andReturn(implicitRuns);
     clock = FakeScheduledExecutor.scheduleAtFixedRateExecutor(executorService, 2, 5);
 
-    IScheduledTask task = TaskTestUtil.makeTask("id1", TaskTestUtil.JOB);
+    IScheduledTask task = makeTask("id1", TaskTestUtil.makeConfig(TaskTestUtil.JOB));
     storageUtil.expectOperations();
     storageUtil.expectTaskFetch(Query.unscoped().byStatus(Tasks.SLAVE_ASSIGNED_STATES), task)
         .times(5);
@@ -137,4 +144,24 @@ public class TaskReconcilerTest extends EasyMockTest {
         IMPLICT_SCHEDULE,
         SPREAD);
   }
+
+  private static IScheduledTask makeTask(String id, ITaskConfig config) {
+    return IScheduledTask.build(new ScheduledTask()
+        .setStatus(ScheduleStatus.ASSIGNED)
+        .setTaskEvents(ImmutableList.of(
+            new TaskEvent(100L, ScheduleStatus.ASSIGNED)
+                .setMessage("message")
+                .setScheduler("scheduler"),
+            new TaskEvent(101L, ScheduleStatus.ASSIGNED)
+                .setMessage("message")
+                .setScheduler("scheduler2")))
+        .setAncestorId("ancestor")
+        .setFailureCount(3)
+        .setAssignedTask(new AssignedTask()
+            .setInstanceId(2)
+            .setTaskId(id)
+            .setSlaveId("slave-id")
+            .setAssignedPorts(ImmutableMap.of("http", 1000))
+            .setTask(config.newBuilder())));
+  }
 }


Mime
View raw message