aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject git commit: Expand actions in JobUpdateAction
Date Mon, 18 Aug 2014 18:30:46 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 1c4f52782 -> 4f6093bb2


Expand actions in JobUpdateAction

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


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

Branch: refs/heads/master
Commit: 4f6093bb2a1d25d60b31f073a88a332956b58b4f
Parents: 1c4f527
Author: David McLaughlin <david@dmclaughlin.com>
Authored: Mon Aug 18 11:27:16 2014 -0700
Committer: Bill Farner <wfarner@apache.org>
Committed: Mon Aug 18 11:27:16 2014 -0700

----------------------------------------------------------------------
 .../thrift/org/apache/aurora/gen/api.thrift     | 28 ++++++++++++++++++--
 .../storage/db/DBJobUpdateStoreTest.java        | 17 ++++++------
 .../scheduler/storage/log/LogStorageTest.java   |  2 +-
 .../org/apache/aurora/gen/api.thrift.md5        |  2 +-
 .../org/apache/aurora/gen/storage.thrift.md5    |  2 +-
 5 files changed, 38 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/4f6093bb/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 af9f02e..2b376d6 100644
--- a/src/main/thrift/org/apache/aurora/gen/api.thrift
+++ b/src/main/thrift/org/apache/aurora/gen/api.thrift
@@ -536,8 +536,32 @@ enum JobUpdateStatus {
 
 /** Job update actions that can be applied to job instances. */
 enum JobUpdateAction {
-  // TODO(maxim): Define when instance update part is completed.
-  ADD_INSTANCE = 1
+  /** An instance was updated and the updater declared the instance healthy. */
+  INSTANCE_UPDATED = 1,
+
+  /** A new instance was added. */
+  INSTANCE_ADDED = 2,
+
+  /** The instance was removed to match the instance count. */
+  INSTANCE_REMOVED = 3,
+
+  /** An instance was not updated because it already matches the new TaskConfig. */
+  INSTANCE_SKIPPED = 4,
+
+  /** An update was performed or attempted, but had to be rolled back due to update failure.
*/
+  INSTANCE_ROLLED_BACK = 5,
+
+  /** An update is in progress. */
+  INSTANCE_UPDATING = 6,
+
+  /** An instance is being rolled back */
+  INSTANCE_ROLLING_BACK = 7,
+
+  /** An instance update was attempted but failed and was not rolled back. */
+  INSTANCE_UPDATE_FAILED = 8,
+
+  /** An instance rollback was attempted but failed. */
+  INSTANCE_ROLLBACK_FAILED = 9
 }
 
 /** Job update thresholds and limits. */

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/4f6093bb/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
index f669dbe..0be4d78 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
@@ -58,6 +58,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.apache.aurora.gen.JobUpdateAction.INSTANCE_ADDED;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -165,8 +166,8 @@ public class DBJobUpdateStoreTest {
   public void testSaveInstanceEvents() {
     String updateId = "u3";
     IJobUpdate update = makeJobUpdate(JOB, updateId);
-    IJobInstanceUpdateEvent event1 = makeJobInstanceEvent(0, 125L, JobUpdateAction.ADD_INSTANCE);
-    IJobInstanceUpdateEvent event2 = makeJobInstanceEvent(1, 126L, JobUpdateAction.ADD_INSTANCE);
+    IJobInstanceUpdateEvent event1 = makeJobInstanceEvent(0, 125L, INSTANCE_ADDED);
+    IJobInstanceUpdateEvent event2 = makeJobInstanceEvent(1, 126L, INSTANCE_ADDED);
 
     saveUpdate(update, "lock");
     assertEquals(populateExpected(update), getUpdateDetails(updateId).get().getUpdate());
@@ -195,7 +196,7 @@ public class DBJobUpdateStoreTest {
 
   @Test(expected = StorageException.class)
   public void testSaveInstanceEventWithoutUpdateFails() {
-    saveJobInstanceEvent(makeJobInstanceEvent(0, 125L, JobUpdateAction.ADD_INSTANCE), "u1");
+    saveJobInstanceEvent(makeJobInstanceEvent(0, 125L, INSTANCE_ADDED), "u1");
   }
 
   @Test
@@ -247,13 +248,13 @@ public class DBJobUpdateStoreTest {
 
     IJobUpdateEvent jEvent11 = makeJobUpdateEvent(JobUpdateStatus.ROLLING_FORWARD, 456L);
     IJobUpdateEvent jEvent12 = makeJobUpdateEvent(JobUpdateStatus.ERROR, 457L);
-    IJobInstanceUpdateEvent iEvent11 = makeJobInstanceEvent(1, 451L, JobUpdateAction.ADD_INSTANCE);
-    IJobInstanceUpdateEvent iEvent12 = makeJobInstanceEvent(2, 452L, JobUpdateAction.ADD_INSTANCE);
+    IJobInstanceUpdateEvent iEvent11 = makeJobInstanceEvent(1, 451L, INSTANCE_ADDED);
+    IJobInstanceUpdateEvent iEvent12 = makeJobInstanceEvent(2, 452L, INSTANCE_ADDED);
 
     IJobUpdateEvent jEvent21 = makeJobUpdateEvent(JobUpdateStatus.ROLL_FORWARD_PAUSED, 567L);
     IJobUpdateEvent jEvent22 = makeJobUpdateEvent(JobUpdateStatus.ABORTED, 568L);
-    IJobInstanceUpdateEvent iEvent21 = makeJobInstanceEvent(3, 561L, JobUpdateAction.ADD_INSTANCE);
-    IJobInstanceUpdateEvent iEvent22 = makeJobInstanceEvent(4, 562L, JobUpdateAction.ADD_INSTANCE);
+    IJobInstanceUpdateEvent iEvent21 = makeJobInstanceEvent(3, 561L, INSTANCE_ADDED);
+    IJobInstanceUpdateEvent iEvent22 = makeJobInstanceEvent(4, 562L, INSTANCE_ADDED);
 
     saveJobEvent(jEvent11, updateId1);
     saveJobEvent(jEvent12, updateId1);
@@ -290,7 +291,7 @@ public class DBJobUpdateStoreTest {
     IJobUpdateEvent updateEvent = IJobUpdateEvent.build(
         new JobUpdateEvent(JobUpdateStatus.ROLLING_FORWARD, 123L));
     IJobInstanceUpdateEvent instanceEvent = IJobInstanceUpdateEvent.build(
-        new JobInstanceUpdateEvent(0, 125L, JobUpdateAction.ADD_INSTANCE));
+        new JobInstanceUpdateEvent(0, 125L, INSTANCE_ADDED));
 
     saveUpdate(update, "lock");
     saveJobEvent(updateEvent, updateId);

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/4f6093bb/src/test/java/org/apache/aurora/scheduler/storage/log/LogStorageTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/log/LogStorageTest.java b/src/test/java/org/apache/aurora/scheduler/storage/log/LogStorageTest.java
index 78798f2..339774c 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/log/LogStorageTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/log/LogStorageTest.java
@@ -808,7 +808,7 @@ public class LogStorageTest extends EasyMockTest {
   @Test
   public void testSaveJobInstanceUpdateEvent() throws Exception {
     final IJobInstanceUpdateEvent event = IJobInstanceUpdateEvent.build(new JobInstanceUpdateEvent()
-        .setAction(JobUpdateAction.ADD_INSTANCE)
+        .setAction(JobUpdateAction.INSTANCE_ADDED)
         .setTimestampMs(12345L)
         .setInstanceId(0));
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/4f6093bb/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 21a05f6..0be4d96 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 @@
-de976ca8a260380d5473ca45e32d7f95
+53397dbf466d235e9d17b52ecd912bbc

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/4f6093bb/src/test/resources/org/apache/aurora/gen/storage.thrift.md5
----------------------------------------------------------------------
diff --git a/src/test/resources/org/apache/aurora/gen/storage.thrift.md5 b/src/test/resources/org/apache/aurora/gen/storage.thrift.md5
index 4576299..6da2c2c 100644
--- a/src/test/resources/org/apache/aurora/gen/storage.thrift.md5
+++ b/src/test/resources/org/apache/aurora/gen/storage.thrift.md5
@@ -1 +1 @@
-5681efe4f270d71daab6fb5243a21a9c
+04be54e3997765d0c58cdc144323bdf4


Mime
View raw message