aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject aurora git commit: Descheduling a cron should not fail if the job is not scheduled.
Date Tue, 22 Mar 2016 23:24:18 GMT
Repository: aurora
Updated Branches:
  refs/heads/master b5c9e1bc4 -> b6d23afdf


Descheduling a cron should not fail if the job is not scheduled.

This allows clients to be more declarative rather than imperative
when expressing that the given job should not be scheduled.

Bugs closed: AURORA-1645

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


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

Branch: refs/heads/master
Commit: b6d23afdf092b41a93ac45b4f3385e081cb46231
Parents: b5c9e1b
Author: Stephan Erb <serb@apache.org>
Authored: Wed Mar 23 00:23:46 2016 +0100
Committer: Stephan Erb <stephan@dev.static-void.de>
Committed: Wed Mar 23 00:23:46 2016 +0100

----------------------------------------------------------------------
 RELEASE-NOTES.md                                             | 1 +
 .../aurora/scheduler/thrift/SchedulerThriftInterface.java    | 7 ++++---
 .../scheduler/thrift/SchedulerThriftInterfaceTest.java       | 8 +++++++-
 3 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/b6d23afd/RELEASE-NOTES.md
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 6e9364e..34f28a1 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -10,6 +10,7 @@
   See [here](docs/deploying-aurora-scheduler.md#dedicated-attribute) for more details.
 - Added a new argument `--announcer-hostname` to thermos executor to override hostname in
service
   registry endpoint. See [here](docs/configuration-reference.md#announcer-objects) for details.
+- Descheduling a cron job that was not actually scheduled will no longer return an error.
 
 ### Deprecations and removals:
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/b6d23afd/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 d217faf..5d246be 100644
--- a/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
+++ b/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
@@ -342,10 +342,11 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
           ILockKey.build(LockKey.job(jobKey.newBuilder())),
           java.util.Optional.ofNullable(mutableLock).map(ILock::build));
 
-      if (!cronJobManager.deleteJob(jobKey)) {
-        return invalidRequest(notScheduledCronMessage(jobKey));
+      if (cronJobManager.deleteJob(jobKey)) {
+        return ok();
+      } else {
+        return addMessage(empty(), OK, notScheduledCronMessage(jobKey));
       }
-      return ok();
     } catch (LockException e) {
       return error(LOCK_ERROR, e);
     }

http://git-wip-us.apache.org/repos/asf/aurora/blob/b6d23afd/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 c774ac0..0a7b518 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
@@ -1020,7 +1020,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
     control.replay();
 
     assertEquals(
-        invalidResponse(notScheduledCronMessage(JOB_KEY)),
+        okEmptyResponse(notScheduledCronMessage(JOB_KEY)),
         thrift.descheduleCronJob(JOB_KEY.newBuilder(), null));
   }
 
@@ -1254,6 +1254,12 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
     return response(OK, Optional.absent());
   }
 
+  private static Response okEmptyResponse(String message) {
+    return Responses.empty()
+        .setResponseCode(OK)
+        .setDetails(ImmutableList.of(new ResponseDetail(message)));
+  }
+
   private static Response invalidResponse(String message) {
     return Responses.empty()
         .setResponseCode(INVALID_REQUEST)


Mime
View raw message