Repository: aurora Updated Branches: refs/heads/master 5587bce74 -> 6fc7f58ed
Remove scheduler warning when maxWaitToInstanceRunningMs is set. Bugs closed: AURORA-1240 Reviewed at https://reviews.apache.org/r/32896/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/6fc7f58e Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/6fc7f58e Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/6fc7f58e Branch: refs/heads/master Commit: 6fc7f58ed1f38f6d34f92372a4a1338715db266c Parents: 5587bce Author: Bill Farner <[email protected]> Authored: Mon Apr 6 16:19:51 2015 -0700 Committer: Bill Farner <[email protected]> Committed: Mon Apr 6 16:19:51 2015 -0700 ---------------------------------------------------------------------- .../thrift/org/apache/aurora/gen/api.thrift | 5 ++- .../thrift/SchedulerThriftInterface.java | 19 +------- .../thrift/SchedulerThriftInterfaceTest.java | 47 -------------------- 3 files changed, 6 insertions(+), 65 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/6fc7f58e/api/src/main/thrift/org/apache/aurora/gen/api.thrift ---------------------------------------------------------------------- diff --git a/api/src/main/thrift/org/apache/aurora/gen/api.thrift b/api/src/main/thrift/org/apache/aurora/gen/api.thrift index 2cbbed0..0182ecb 100644 --- a/api/src/main/thrift/org/apache/aurora/gen/api.thrift +++ b/api/src/main/thrift/org/apache/aurora/gen/api.thrift @@ -659,7 +659,10 @@ struct JobUpdateSettings { /** Max number of FAILED instances to tolerate before terminating the update. */ 3: i32 maxFailedInstances - /** Max time to wait until an instance reaches RUNNING state. */ + /** + * Max time to wait until an instance reaches RUNNING state. + * Note: Deprecated in 0.8.0. + */ 4: i32 maxWaitToInstanceRunningMs /** Min time to watch a RUNNING instance. */ http://git-wip-us.apache.org/repos/asf/aurora/blob/6fc7f58e/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 73c4605..b7d3874 100644 --- a/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java +++ b/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java @@ -1100,10 +1100,6 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin { return builder.build(); } - @VisibleForTesting - static final String MAX_WAIT_TO_INSTANCE_FIELD_WARNING = - "Warning: the maxWaitToInstanceRunningMs setting is deprecated and will be removed in 0.9.0."; - @Override public Response startJobUpdate( JobUpdateRequest mutableRequest, @@ -1136,17 +1132,6 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin { return invalidRequest(INVALID_MAX_FAILED_INSTANCES); } - final Response response = ok(); - if (settings.isSetMaxWaitToInstanceRunningMs()) { - addMessage( - response, - MAX_WAIT_TO_INSTANCE_FIELD_WARNING); - } - - if (settings.getMaxWaitToInstanceRunningMs() < 0) { - return invalidRequest(INVALID_MAX_WAIT_TO_RUNNING); - } - if (settings.getMinWaitInInstanceRunningMs() < 0) { return invalidRequest(INVALID_MIN_WAIT_TO_RUNNING); } @@ -1223,10 +1208,10 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin { jobUpdateController.start( update, new AuditData(context.getIdentity(), Optional.fromNullable(message))); - return response.setResult(Result.startJobUpdateResult( + return ok(Result.startJobUpdateResult( new StartJobUpdateResult(update.getSummary().getKey().newBuilder()))); } catch (UpdateStateException | TaskValidationException e) { - return addMessage(response, INVALID_REQUEST, e); + return error(INVALID_REQUEST, e); } } }); http://git-wip-us.apache.org/repos/asf/aurora/blob/6fc7f58e/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 9ae8f1a..1ac1a28 100644 --- a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java +++ b/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java @@ -1947,18 +1947,6 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest { } @Test - public void testStartUpdateFailsInvalidMaxWaitToRunning() throws Exception { - control.replay(); - - JobUpdateRequest updateRequest = buildServiceJobUpdateRequest(); - updateRequest.getSettings().setMaxWaitToInstanceRunningMs(-1); - - assertEquals( - invalidResponse(SchedulerThriftInterface.INVALID_MAX_WAIT_TO_RUNNING), - thrift.startJobUpdate(updateRequest, AUDIT_MESSAGE, SESSION)); - } - - @Test public void testStartUpdateFailsInvalidMinWaitInRunning() throws Exception { control.replay(); @@ -2354,41 +2342,6 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest { assertResponse(AUTH_FAILED, thrift.pulseJobUpdate(UPDATE_KEY.newBuilder(), SESSION)); } - @Test - public void testMaxWaitToInstanceRunningMsDeprecationWarning() throws Exception { - expectAuth(ROLE, true); - expectNoCronJob(); - - ITaskConfig newTask = buildTaskForJobUpdate(0).getAssignedTask().getTask(); - expect(taskIdGenerator.generate(newTask, 1)).andReturn(TASK_ID); - - IJobUpdate update = buildJobUpdate( - 1, - newTask, - ImmutableMap.<ITaskConfig, ImmutableSet<Range>>of()); - - expect(quotaManager.checkJobUpdate( - update, - storageUtil.mutableStoreProvider)).andReturn(ENOUGH_QUOTA); - - expect(uuidGenerator.createNew()).andReturn(UU_ID); - storageUtil.expectTaskFetch(Query.unscoped().byJob(JOB_KEY).active()); - - jobUpdateController.start(update, AUDIT); - - control.replay(); - - // Validate key is populated during sanitizing. - JobUpdateRequest request = buildJobUpdateRequest(update); - request.getTaskConfig().unsetJob(); - - Response response = assertOkResponse(thrift.startJobUpdate(request, AUDIT_MESSAGE, SESSION)); - assertEquals( - ImmutableList.of( - new ResponseDetail(SchedulerThriftInterface.MAX_WAIT_TO_INSTANCE_FIELD_WARNING)), - response.getDetails()); - } - private static final String AUTH_DENIED_MESSAGE = "Denied!"; private IExpectationSetters<?> expectAuth(Set<String> roles, boolean allowed)
