aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject aurora git commit: Deprecate JobUpdateSettings.maxWaitToInstanceRunning and UpdateConfig.restart_threshold
Date Thu, 17 Dec 2015 18:57:04 GMT
Repository: aurora
Updated Branches:
  refs/heads/master c912c3459 -> 82bb64315


Deprecate JobUpdateSettings.maxWaitToInstanceRunning and UpdateConfig.restart_threshold

Bugs closed: AURORA-1252, AURORA-1253

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


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

Branch: refs/heads/master
Commit: 82bb6431589bfb4e8670627a2066ff375f207b52
Parents: c912c34
Author: Bill Farner <wfarner@apache.org>
Authored: Thu Dec 17 10:56:51 2015 -0800
Committer: Bill Farner <wfarner@apache.org>
Committed: Thu Dec 17 10:56:56 2015 -0800

----------------------------------------------------------------------
 NEWS                                            |  3 ++
 .../thrift/org/apache/aurora/gen/api.thrift     |  2 +-
 .../thrift/SchedulerThriftInterface.java        | 13 ++++++-
 .../updater/InstanceActionHandler.java          | 22 +++++------
 .../updater/JobUpdateControllerImpl.java        | 12 +++---
 .../aurora/scheduler/updater/UpdateFactory.java |  3 --
 .../python/apache/aurora/client/api/__init__.py |  8 +---
 .../apache/aurora/client/api/restarter.py       | 40 ++++++++++++++------
 .../apache/aurora/client/api/updater_util.py    | 20 ++--------
 .../python/apache/aurora/client/cli/jobs.py     | 18 ++++-----
 .../apache/aurora/client/hooks/hooked_api.py    | 15 +++++---
 .../aurora/scheduler/updater/JobUpdaterIT.java  |  9 ++---
 .../python/apache/aurora/client/api/test_api.py |  1 -
 .../apache/aurora/client/api/test_restarter.py  | 14 +++----
 .../apache/aurora/client/cli/test_restart.py    | 24 +++++++-----
 .../aurora/client/hooks/test_non_hooked_api.py  | 16 ++++----
 16 files changed, 114 insertions(+), 106 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/NEWS
----------------------------------------------------------------------
diff --git a/NEWS b/NEWS
index 7a80f32..89ebe0d 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@
   'aurora job update' and 'aurora job cancel-update'.  Users are encouraged to take
   advantage of scheduler-driven updates (see 'aurora update -h' for usage), which has been
a
   stable feature for several releases.
+- The field 'JobUpdateSettings.maxWaitToInstanceRunningMs' (UpdateConfig.restart_threshold
in
+  client-side configuration) is now deprecated.  This setting was brittle in practice, and
is
+  ignored by the 0.11.0 scheduler.
 
 0.10.0
 ------

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/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 d765dd7..ad74685 100644
--- a/api/src/main/thrift/org/apache/aurora/gen/api.thrift
+++ b/api/src/main/thrift/org/apache/aurora/gen/api.thrift
@@ -671,7 +671,7 @@ struct JobUpdateSettings {
 
   /**
    * Max time to wait until an instance reaches RUNNING state.
-   * Note: Deprecated in 0.8.0.
+   * Note: Deprecated in 0.11.0.
    */
   4: i32 maxWaitToInstanceRunningMs
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/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 9aef59a..fd5e2f2 100644
--- a/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
+++ b/src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java
@@ -967,6 +967,14 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
               .setKey(new JobUpdateKey(job.newBuilder(), updateId))
               .setUser(remoteUserName))
           .setInstructions(instructions));
+
+      Response response = empty();
+      if (update.getInstructions().getSettings().getMaxWaitToInstanceRunningMs() > 0)
{
+        addMessage(
+            response,
+            "The maxWaitToInstanceRunningMs (restart_threshold) field is deprecated.");
+      }
+
       try {
         validateTaskLimits(
             request.getTaskConfig(),
@@ -976,8 +984,9 @@ class SchedulerThriftInterface implements AnnotatedAuroraAdmin {
         jobUpdateController.start(
             update,
             new AuditData(remoteUserName, Optional.fromNullable(message)));
-        return ok(Result.startJobUpdateResult(
-            new StartJobUpdateResult(update.getSummary().getKey().newBuilder())));
+        return response.setResponseCode(OK)
+            .setResult(Result.startJobUpdateResult(
+                new StartJobUpdateResult(update.getSummary().getKey().newBuilder())));
       } catch (UpdateStateException | TaskValidationException e) {
         return error(INVALID_REQUEST, e);
       }

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/main/java/org/apache/aurora/scheduler/updater/InstanceActionHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/updater/InstanceActionHandler.java
b/src/main/java/org/apache/aurora/scheduler/updater/InstanceActionHandler.java
index 0880cf2..35c68f1 100644
--- a/src/main/java/org/apache/aurora/scheduler/updater/InstanceActionHandler.java
+++ b/src/main/java/org/apache/aurora/scheduler/updater/InstanceActionHandler.java
@@ -39,7 +39,7 @@ import static org.apache.aurora.scheduler.storage.Storage.MutableStoreProvider;
 
 interface InstanceActionHandler {
 
-  Amount<Long, Time> getReevaluationDelay(
+  Optional<Amount<Long, Time>> getReevaluationDelay(
       IInstanceKey instance,
       IJobUpdateInstructions instructions,
       MutableStoreProvider storeProvider,
@@ -79,7 +79,7 @@ interface InstanceActionHandler {
     }
 
     @Override
-    public Amount<Long, Time> getReevaluationDelay(
+    public Optional<Amount<Long, Time>> getReevaluationDelay(
         IInstanceKey instance,
         IJobUpdateInstructions instructions,
         MutableStoreProvider storeProvider,
@@ -102,15 +102,14 @@ interface InstanceActionHandler {
             replacement,
             ImmutableSet.of(instance.getInstanceId()));
       }
-      return Amount.of(
-          (long) instructions.getSettings().getMaxWaitToInstanceRunningMs(),
-          Time.MILLISECONDS);
+      // A task state transition will trigger re-evaluation in this case, rather than a timer.
+      return Optional.absent();
     }
   }
 
   class KillTask implements InstanceActionHandler {
     @Override
-    public Amount<Long, Time> getReevaluationDelay(
+    public Optional<Amount<Long, Time>> getReevaluationDelay(
         IInstanceKey instance,
         IJobUpdateInstructions instructions,
         MutableStoreProvider storeProvider,
@@ -131,24 +130,23 @@ interface InstanceActionHandler {
         // and it's deletion from the store. This is a perfectly valid case.
         LOG.info("No active instance " + instance + " to kill while " + status);
       }
-      return Amount.of(
-          (long) instructions.getSettings().getMaxWaitToInstanceRunningMs(),
-          Time.MILLISECONDS);
+      // A task state transition will trigger re-evaluation in this case, rather than a timer.
+      return Optional.absent();
     }
   }
 
   class WatchRunningTask implements InstanceActionHandler {
     @Override
-    public Amount<Long, Time> getReevaluationDelay(
+    public Optional<Amount<Long, Time>> getReevaluationDelay(
         IInstanceKey instance,
         IJobUpdateInstructions instructions,
         MutableStoreProvider storeProvider,
         StateManager stateManager,
         JobUpdateStatus status) {
 
-      return Amount.of(
+      return Optional.of(Amount.of(
           (long) instructions.getSettings().getMinWaitInInstanceRunningMs(),
-          Time.MILLISECONDS);
+          Time.MILLISECONDS));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/main/java/org/apache/aurora/scheduler/updater/JobUpdateControllerImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/updater/JobUpdateControllerImpl.java
b/src/main/java/org/apache/aurora/scheduler/updater/JobUpdateControllerImpl.java
index 0e07560..ca46400 100644
--- a/src/main/java/org/apache/aurora/scheduler/updater/JobUpdateControllerImpl.java
+++ b/src/main/java/org/apache/aurora/scheduler/updater/JobUpdateControllerImpl.java
@@ -629,16 +629,18 @@ class JobUpdateControllerImpl implements JobUpdateController {
         if (action.isPresent()) {
           Optional<InstanceActionHandler> handler = action.get().getHandler();
           if (handler.isPresent()) {
-            Amount<Long, Time> reevaluateDelay = handler.get().getReevaluationDelay(
+            Optional<Amount<Long, Time>> reevaluateDelay = handler.get().getReevaluationDelay(
                 instance,
                 instructions,
                 storeProvider,
                 stateManager,
                 updaterStatus);
-            executor.schedule(
-                getDeferredEvaluator(instance, key),
-                reevaluateDelay.getValue(),
-                reevaluateDelay.getUnit().getTimeUnit());
+            if (reevaluateDelay.isPresent()) {
+              executor.schedule(
+                  getDeferredEvaluator(instance, key),
+                  reevaluateDelay.get().getValue(),
+                  reevaluateDelay.get().getUnit().getTimeUnit());
+            }
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/main/java/org/apache/aurora/scheduler/updater/UpdateFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/updater/UpdateFactory.java b/src/main/java/org/apache/aurora/scheduler/updater/UpdateFactory.java
index 258151f..ac8df3e 100644
--- a/src/main/java/org/apache/aurora/scheduler/updater/UpdateFactory.java
+++ b/src/main/java/org/apache/aurora/scheduler/updater/UpdateFactory.java
@@ -77,9 +77,6 @@ interface UpdateFactory {
       requireNonNull(instructions);
       IJobUpdateSettings settings = instructions.getSettings();
       checkArgument(
-          settings.getMaxWaitToInstanceRunningMs() > 0,
-          "Max wait to running must be positive.");
-      checkArgument(
           settings.getMinWaitInInstanceRunningMs() > 0,
           "Min wait in running must be positive.");
       checkArgument(

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/main/python/apache/aurora/client/api/__init__.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/__init__.py b/src/main/python/apache/aurora/client/api/__init__.py
index a638158..ac4e6f2 100644
--- a/src/main/python/apache/aurora/client/api/__init__.py
+++ b/src/main/python/apache/aurora/client/api/__init__.py
@@ -246,7 +246,7 @@ class AuroraClientAPI(object):
                            % (key, JobUpdateKey.__name__, key.__class__.__name__))
     return self._scheduler_proxy.getJobUpdateDetails(key)
 
-  def restart(self, job_key, instances, updater_config, health_check_interval_seconds):
+  def restart(self, job_key, instances, restart_settings):
     """Perform a rolling restart of the job.
 
        If instances is None or [], restart all instances.  Returns the
@@ -256,11 +256,7 @@ class AuroraClientAPI(object):
     """
     self._assert_valid_job_key(job_key)
 
-    return Restarter(
-        job_key,
-        updater_config,
-        health_check_interval_seconds,
-        self._scheduler_proxy).restart(instances)
+    return Restarter(job_key, restart_settings, self._scheduler_proxy).restart(instances)
 
   def start_maintenance(self, hosts):
     log.info("Starting maintenance for: %s" % hosts.hostNames)

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/main/python/apache/aurora/client/api/restarter.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/restarter.py b/src/main/python/apache/aurora/client/api/restarter.py
index 1983034..cd63311 100644
--- a/src/main/python/apache/aurora/client/api/restarter.py
+++ b/src/main/python/apache/aurora/client/api/restarter.py
@@ -23,25 +23,43 @@ from gen.apache.aurora.api.constants import ACTIVE_STATES
 from gen.apache.aurora.api.ttypes import ResponseCode
 
 
+class RestartSettings(object):
+  def __init__(self,
+               batch_size,
+               restart_threshold,
+               max_per_instance_failures,
+               max_total_failures,
+               watch_secs,
+               health_check_interval_seconds):
+
+    self.batch_size = batch_size
+    self.restart_threshold = restart_threshold
+    self.max_per_instance_failures = max_per_instance_failures
+    self.max_total_failures = max_total_failures
+    self.watch_secs = watch_secs
+    self.health_check_interval_seconds = health_check_interval_seconds
+
+  def __eq__(self, other):
+    return self.__dict__ == other.__dict__
+
+
 class Restarter(object):
   def __init__(self,
                job_key,
-               update_config,
-               health_check_interval_seconds,
+               restart_settings,
                scheduler,
                instance_watcher=None,
                lock=None):
     self._job_key = job_key
-    self._update_config = update_config
-    self.health_check_interval_seconds = health_check_interval_seconds
+    self._restart_settings = restart_settings
     self._scheduler = scheduler
     self._lock = lock
     self._instance_watcher = instance_watcher or InstanceWatcher(
         scheduler,
         job_key.to_thrift(),
-        update_config.restart_threshold,
-        update_config.watch_secs,
-        health_check_interval_seconds)
+        restart_settings.restart_threshold,
+        restart_settings.watch_secs,
+        restart_settings.health_check_interval_seconds)
 
   def restart(self, instances):
     # Verify that this operates on a valid job.
@@ -52,8 +70,8 @@ class Restarter(object):
       return status
 
     failure_threshold = FailureThreshold(
-        self._update_config.max_per_instance_failures,
-        self._update_config.max_total_failures)
+        self._restart_settings.max_per_instance_failures,
+        self._restart_settings.max_total_failures)
 
     if not instances:
       tasks = status.result.scheduleStatusResult.tasks
@@ -67,8 +85,8 @@ class Restarter(object):
     log.info("Performing rolling restart of job %s (instances: %s)" % (self._job_key, instances))
 
     while instances and not failure_threshold.is_failed_update():
-      batch = instances[:self._update_config.batch_size]
-      instances = instances[self._update_config.batch_size:]
+      batch = instances[:self._restart_settings.batch_size]
+      instances = instances[self._restart_settings.batch_size:]
 
       log.info("Restarting instances: %s", batch)
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/main/python/apache/aurora/client/api/updater_util.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/updater_util.py b/src/main/python/apache/aurora/client/api/updater_util.py
index b54691e..a3389f3 100644
--- a/src/main/python/apache/aurora/client/api/updater_util.py
+++ b/src/main/python/apache/aurora/client/api/updater_util.py
@@ -24,19 +24,6 @@ from gen.apache.aurora.api.ttypes import JobUpdateSettings, Range
 class UpdaterConfig(object):
   MIN_PULSE_INTERVAL_SECONDS = 60
 
-  """
-  For updates involving a health check,
-
-  UPDATE INSTANCE                         HEALTHY              REMAIN HEALTHY
-  ----------------------------------------|-----------------------|
-  \--------------------------------------/ \----------------------/
-            restart_thresold                      watch_secs
-
-  When an update is initiated, an instance is expected to be "healthy" before restart_threshold.
-  An instance is also expected to remain healthy for at least watch_secs. If these conditions
are
-  not satisfied, the instance is deemed unhealthy.
-  """
-
   def __init__(self,
                batch_size,
                restart_threshold,
@@ -49,15 +36,15 @@ class UpdaterConfig(object):
 
     if batch_size <= 0:
       raise ValueError('Batch size should be greater than 0')
-    if restart_threshold <= 0:
-      raise ValueError('Restart Threshold should be greater than 0')
     if watch_secs <= 0:
       raise ValueError('Watch seconds should be greater than 0')
     if pulse_interval_secs is not None and pulse_interval_secs < self.MIN_PULSE_INTERVAL_SECONDS:
       raise ValueError('Pulse interval seconds must be at least %s seconds.'
                        % self.MIN_PULSE_INTERVAL_SECONDS)
+    if restart_threshold:
+      log.warn('restart_threshold has been deprecated and will be removed in a future release')
+
     self.batch_size = batch_size
-    self.restart_threshold = restart_threshold
     self.watch_secs = watch_secs
     self.max_total_failures = max_total_failures
     self.max_per_instance_failures = max_per_shard_failures
@@ -98,7 +85,6 @@ class UpdaterConfig(object):
         updateGroupSize=self.batch_size,
         maxPerInstanceFailures=self.max_per_instance_failures,
         maxFailedInstances=self.max_total_failures,
-        maxWaitToInstanceRunningMs=self.restart_threshold * 1000,
         minWaitInInstanceRunningMs=self.watch_secs * 1000,
         rollbackOnFailure=self.rollback_on_failure,
         waitForBatchCompletion=self.wait_for_batch_completion,

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/main/python/apache/aurora/client/cli/jobs.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/jobs.py b/src/main/python/apache/aurora/client/cli/jobs.py
index ccc52c8..deba3a9 100644
--- a/src/main/python/apache/aurora/client/cli/jobs.py
+++ b/src/main/python/apache/aurora/client/cli/jobs.py
@@ -32,8 +32,8 @@ from thrift.protocol import TJSONProtocol
 from thrift.TSerialization import serialize
 
 from apache.aurora.client.api.job_monitor import JobMonitor
+from apache.aurora.client.api.restarter import RestartSettings
 from apache.aurora.client.api.scheduler_client import SchedulerProxy
-from apache.aurora.client.api.updater_util import UpdaterConfig
 from apache.aurora.client.base import get_job_page, synthesize_url
 from apache.aurora.client.cli import (
     EXIT_COMMAND_FAILURE,
@@ -584,14 +584,14 @@ class RestartCommand(Verb):
       context.verify_instances_option_validity(job, instances)
     api = context.get_api(job.cluster)
     config = context.get_job_config_optional(job, context.options.config)
-    updater_config = UpdaterConfig(
-        context.options.batch_size,
-        context.options.restart_threshold,
-        context.options.watch_secs,
-        context.options.max_per_instance_failures,
-        context.options.max_total_failures)
-    resp = api.restart(job, instances, updater_config,
-        context.options.healthcheck_interval_seconds, config=config)
+    restart_settings = RestartSettings(
+        batch_size=context.options.batch_size,
+        restart_threshold=context.options.restart_threshold,
+        watch_secs=context.options.watch_secs,
+        max_per_instance_failures=context.options.max_per_instance_failures,
+        max_total_failures=context.options.max_total_failures,
+        health_check_interval_seconds=context.options.healthcheck_interval_seconds)
+    resp = api.restart(job, instances, restart_settings, config=config)
 
     context.log_response_and_raise(resp,
                                    err_msg="Error restarting job %s:" % str(job))

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/main/python/apache/aurora/client/hooks/hooked_api.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/hooks/hooked_api.py b/src/main/python/apache/aurora/client/hooks/hooked_api.py
index 6410908..185e57d 100644
--- a/src/main/python/apache/aurora/client/hooks/hooked_api.py
+++ b/src/main/python/apache/aurora/client/hooks/hooked_api.py
@@ -52,9 +52,8 @@ class NonHookedAuroraClientAPI(AuroraClientAPI):
   def kill_job(self, job_key, instances=None, lock=None, config=None):
     return super(NonHookedAuroraClientAPI, self).kill_job(job_key, instances=instances, lock=lock)
 
-  def restart(self, job_key, shards, updater_config, health_check_interval_seconds, config=None):
-    return super(NonHookedAuroraClientAPI, self).restart(job_key, shards, updater_config,
-        health_check_interval_seconds)
+  def restart(self, job_key, shards, restart_settings, config=None):
+    return super(NonHookedAuroraClientAPI, self).restart(job_key, shards, restart_settings)
 
   def start_cronjob(self, job_key, config=None):
     return super(NonHookedAuroraClientAPI, self).start_cronjob(job_key)
@@ -160,10 +159,14 @@ class HookedAuroraClientAPI(NonHookedAuroraClientAPI):
         _partial(super(HookedAuroraClientAPI, self).kill_job,
             job_key, instances=instances, lock=lock, config=config))
 
-  def restart(self, job_key, shards, updater_config, health_check_interval_seconds, config=None):
+  def restart(self, job_key, shards, restart_settings, config=None):
     return self._hooked_call(config, job_key,
-        _partial(super(HookedAuroraClientAPI, self).restart,
-            job_key, shards, updater_config, health_check_interval_seconds, config=config))
+        _partial(
+            super(HookedAuroraClientAPI, self).restart,
+            job_key,
+            shards,
+            restart_settings,
+            config=config))
 
   def start_cronjob(self, job_key, config=None):
     return self._hooked_call(config, job_key,

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java b/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
index f7f5275..2024b2c 100644
--- a/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
@@ -406,12 +406,13 @@ public class JobUpdaterIT extends EasyMockTest {
     // The update is blocked due to expired pulse timeout.
     clock.advance(Amount.of(PULSE_TIMEOUT_MS, Time.MILLISECONDS));
     actions.put(2, INSTANCE_UPDATING);
+    changeState(JOB, 2, KILLED);
     assertState(ROLL_FORWARD_AWAITING_PULSE, actions.build());
     assertLatestUpdateMessage(JobUpdateControllerImpl.PULSE_TIMEOUT_MESSAGE);
 
     // Pulse arrives and instance 2 is updated.
     assertEquals(JobUpdatePulseStatus.OK, updater.pulse(UPDATE_ID));
-    changeState(JOB, 2, KILLED, ASSIGNED, STARTING, RUNNING);
+    changeState(JOB, 2, ASSIGNED, STARTING, RUNNING);
     clock.advance(WATCH_TIMEOUT);
     actions.put(2, INSTANCE_UPDATED);
 
@@ -982,7 +983,7 @@ public class JobUpdaterIT extends EasyMockTest {
     // Instance 0 is updated.
     updater.start(update, AUDIT);
     releaseAllLocks();
-    clock.advance(RUNNING_TIMEOUT);
+    changeState(JOB, 0, KILLED);
     ImmutableMultimap.Builder<Integer, JobUpdateAction> actions = ImmutableMultimap.builder();
     actions.putAll(0, INSTANCE_UPDATING);
     assertState(ERROR, actions.build());
@@ -1009,10 +1010,6 @@ public class JobUpdaterIT extends EasyMockTest {
     expectInvalid(update);
 
     update = makeJobUpdate().newBuilder();
-    update.getInstructions().getSettings().setMaxWaitToInstanceRunningMs(0);
-    expectInvalid(update);
-
-    update = makeJobUpdate().newBuilder();
     update.getInstructions().getSettings().setMinWaitInInstanceRunningMs(0);
     expectInvalid(update);
   }

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/test/python/apache/aurora/client/api/test_api.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/api/test_api.py b/src/test/python/apache/aurora/client/api/test_api.py
index 7debc79..59f34a5 100644
--- a/src/test/python/apache/aurora/client/api/test_api.py
+++ b/src/test/python/apache/aurora/client/api/test_api.py
@@ -84,7 +84,6 @@ class TestJobUpdateApis(unittest.TestCase):
         updateGroupSize=1,
         maxPerInstanceFailures=2,
         maxFailedInstances=1,
-        maxWaitToInstanceRunningMs=50 * 1000,
         minWaitInInstanceRunningMs=50 * 1000,
         rollbackOnFailure=True,
         waitForBatchCompletion=False)

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/test/python/apache/aurora/client/api/test_restarter.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/api/test_restarter.py b/src/test/python/apache/aurora/client/api/test_restarter.py
index 7557144..8ab21a8 100644
--- a/src/test/python/apache/aurora/client/api/test_restarter.py
+++ b/src/test/python/apache/aurora/client/api/test_restarter.py
@@ -15,8 +15,7 @@
 from mox import IgnoreArg, MoxTestBase
 
 from apache.aurora.client.api.instance_watcher import InstanceWatcher
-from apache.aurora.client.api.restarter import Restarter
-from apache.aurora.client.api.updater_util import UpdaterConfig
+from apache.aurora.client.api.restarter import Restarter, RestartSettings
 from apache.aurora.common.aurora_job_key import AuroraJobKey
 from apache.aurora.common.cluster import Cluster
 
@@ -39,15 +38,13 @@ from gen.apache.aurora.api.ttypes import (
 
 CLUSTER = 'east'
 JOB = AuroraJobKey(CLUSTER, 'johndoe', 'test', 'test_job')
-HEALTH_CHECK_INTERVAL_SECONDS = 5
-UPDATER_CONFIG = UpdaterConfig(
+RESTART_SETTINGS = RestartSettings(
     batch_size=2,
     restart_threshold=23,
     watch_secs=45,
-    max_per_shard_failures=0,
+    max_per_instance_failures=0,
     max_total_failures=0,
-    rollback_on_failure=True,
-)
+    health_check_interval_seconds=5)
 
 
 def make_response(code=ResponseCode.OK, message='test', result=None):
@@ -69,8 +66,7 @@ class TestRestarter(MoxTestBase):
 
     self.restarter = Restarter(
         JOB,
-        UPDATER_CONFIG,
-        HEALTH_CHECK_INTERVAL_SECONDS,
+        RESTART_SETTINGS,
         FakeSchedulerProxy(Cluster(name=CLUSTER), self.mock_scheduler),
         self.mock_instance_watcher)
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/test/python/apache/aurora/client/cli/test_restart.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_restart.py b/src/test/python/apache/aurora/client/cli/test_restart.py
index 2c51d54..fb4afcf 100644
--- a/src/test/python/apache/aurora/client/cli/test_restart.py
+++ b/src/test/python/apache/aurora/client/cli/test_restart.py
@@ -18,8 +18,8 @@ import pytest
 from mock import call, create_autospec, patch
 from twitter.common.contextutil import temporary_file
 
-from apache.aurora.client.api import UpdaterConfig
 from apache.aurora.client.api.health_check import Retriable, StatusHealthCheck
+from apache.aurora.client.api.restarter import RestartSettings
 from apache.aurora.client.cli import EXIT_API_ERROR, EXIT_INVALID_PARAMETER, Context
 from apache.aurora.client.cli.client import AuroraCommandLine
 from apache.aurora.client.cli.jobs import RestartCommand
@@ -50,15 +50,19 @@ class TestRestartJobCommand(AuroraClientCommandTest):
     with pytest.raises(Context.CommandError):
       command.execute(fake_context)
 
-    updater_config = UpdaterConfig(
-      mock_options.batch_size,
-      mock_options.restart_threshold,
-      mock_options.watch_secs,
-      mock_options.max_per_instance_failures,
-      mock_options.max_total_failures)
-
-    mock_api.restart.assert_called_once_with(jobkey, mock_options.instance_spec.instance,
-      updater_config, mock_options.healthcheck_interval_seconds, config=None)
+    restart_settings = RestartSettings(
+        batch_size=mock_options.batch_size,
+        restart_threshold=mock_options.restart_threshold,
+        max_per_instance_failures=mock_options.max_per_instance_failures,
+        max_total_failures=mock_options.max_total_failures,
+        watch_secs=mock_options.watch_secs,
+        health_check_interval_seconds=mock_options.healthcheck_interval_seconds)
+
+    mock_api.restart.assert_called_once_with(
+        jobkey,
+        mock_options.instance_spec.instance,
+        restart_settings,
+        config=None)
     self.assert_lock_message(fake_context)
 
   def test_restart_inactive_instance_spec(self):

http://git-wip-us.apache.org/repos/asf/aurora/blob/82bb6431/src/test/python/apache/aurora/client/hooks/test_non_hooked_api.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/hooks/test_non_hooked_api.py b/src/test/python/apache/aurora/client/hooks/test_non_hooked_api.py
index 97ce973..f4b771b 100644
--- a/src/test/python/apache/aurora/client/hooks/test_non_hooked_api.py
+++ b/src/test/python/apache/aurora/client/hooks/test_non_hooked_api.py
@@ -46,9 +46,8 @@ class TestNonHookedAuroraClientAPI(unittest.TestCase):
         test_obj.API_CALL = functools.partial(self.kill_job, job_key, instances, lock)
         return test_obj.RETURN_VALUE
 
-      def restart(self, job_key, shards, updater_config, health_check_interval_seconds):
-        test_obj.API_CALL = functools.partial(self.restart, job_key, shards,
-            updater_config, health_check_interval_seconds)
+      def restart(self, job_key, shards, restart_settings):
+        test_obj.API_CALL = functools.partial(self.restart, job_key, shards, restart_settings)
         return test_obj.RETURN_VALUE
 
       def start_cronjob(self, job_key):
@@ -63,7 +62,6 @@ class TestNonHookedAuroraClientAPI(unittest.TestCase):
     self.test_config = 'bar'
     self.test_shards = 'baz'
     self.test_lock = 'lock'
-    self.test_updater_config = 'blah'
     self.health_check_interval_seconds = 'baa'
 
   def tearDown(self):
@@ -90,10 +88,12 @@ class TestNonHookedAuroraClientAPI(unittest.TestCase):
     self._verify_api_call(return_value, self.test_job_key, self.test_shards, self.test_lock)
 
   def test_restart_discards_config(self):
-    return_value = self.api.restart(self.test_job_key, self.test_shards,
-        self.test_updater_config, self.health_check_interval_seconds, config=self.test_config)
-    self._verify_api_call(return_value, self.test_job_key, self.test_shards,
-        self.test_updater_config, self.health_check_interval_seconds)
+    return_value = self.api.restart(
+        self.test_job_key,
+        self.test_shards,
+        'fake',
+        config=self.test_config)
+    self._verify_api_call(return_value, self.test_job_key, self.test_shards, 'fake')
 
   def test_start_cronjob_discards_config(self):
     return_value = self.api.start_cronjob(self.test_job_key, config=self.test_config)


Mime
View raw message