aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject git commit: Removing host_drain delay.
Date Mon, 15 Sep 2014 22:09:38 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master deedd16bb -> 49f424be6


Removing host_drain delay.

Bugs closed: AURORA-714

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


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

Branch: refs/heads/master
Commit: 49f424be693839768e220ce173c008acc9f6ac60
Parents: deedd16
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Mon Sep 15 15:09:09 2014 -0700
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Mon Sep 15 15:09:09 2014 -0700

----------------------------------------------------------------------
 src/main/python/apache/aurora/admin/host_maintenance.py   | 10 +---------
 .../python/apache/aurora/admin/test_host_maintenance.py   |  8 +-------
 2 files changed, 2 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/49f424be/src/main/python/apache/aurora/admin/host_maintenance.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/admin/host_maintenance.py b/src/main/python/apache/aurora/admin/host_maintenance.py
index 29745a3..b7b3397 100644
--- a/src/main/python/apache/aurora/admin/host_maintenance.py
+++ b/src/main/python/apache/aurora/admin/host_maintenance.py
@@ -12,8 +12,6 @@
 # limitations under the License.
 #
 
-import time
-
 from twitter.common import log
 from twitter.common.quantity import Amount, Time
 
@@ -37,8 +35,6 @@ class HostMaintenance(object):
   task from being constantly killed as its hosts go down from underneath it.
   """
 
-  START_MAINTENANCE_DELAY = Amount(30, Time.SECONDS)
-
   SLA_MIN_JOB_INSTANCE_COUNT = 20
 
 
@@ -52,7 +48,7 @@ class HostMaintenance(object):
   def __init__(self, cluster, verbosity):
     self._client = AuroraClientAPI(cluster, verbosity == 'verbose')
 
-  def _drain_hosts(self, drainable_hosts, clock=time):
+  def _drain_hosts(self, drainable_hosts):
     """"Drains tasks from the specified hosts.
 
     This will move active tasks on these hosts to the DRAINING state, causing them to be
@@ -60,14 +56,10 @@ class HostMaintenance(object):
 
     :param drainable_hosts: Hosts that are in maintenance mode and ready to be drained
     :type drainable_hosts: gen.apache.aurora.ttypes.Hosts
-    :param clock: time module for testing
-    :type clock: time
     """
     check_and_log_response(self._client.drain_hosts(drainable_hosts))
     not_ready_hostnames = [hostname for hostname in drainable_hosts.hostNames]
     while not_ready_hostnames:
-      log.info("Sleeping for %s." % self.START_MAINTENANCE_DELAY)
-      clock.sleep(self.START_MAINTENANCE_DELAY.as_(Time.SECONDS))
       resp = self._client.maintenance_status(Hosts(set(not_ready_hostnames)))
       if not resp.result.maintenanceStatusResult.statuses:
         not_ready_hostnames = None

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/49f424be/src/test/python/apache/aurora/admin/test_host_maintenance.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/admin/test_host_maintenance.py b/src/test/python/apache/aurora/admin/test_host_maintenance.py
index f2c5b7f..40228df 100644
--- a/src/test/python/apache/aurora/admin/test_host_maintenance.py
+++ b/src/test/python/apache/aurora/admin/test_host_maintenance.py
@@ -13,14 +13,12 @@
 #
 
 import copy
-import time
 import unittest
 from contextlib import contextmanager
 
 import mock
 from twitter.common import log
 from twitter.common.contextutil import temporary_file
-from twitter.common.quantity import Time
 
 from apache.aurora.admin.host_maintenance import HostMaintenance
 from apache.aurora.client.api import AuroraClientAPI
@@ -79,16 +77,12 @@ class TestHostMaintenance(unittest.TestCase):
       fake_maintenance_status_call_args.append(copy.deepcopy(hosts))
       return fake_maintenance_status_response.pop(0)
 
-    clock = mock.Mock(time)
     mock_drain_hosts.return_value = Response(responseCode=ResponseCode.OK)
     mock_maintenance_status.side_effect = fake_maintenance_status_side_effect
     test_hosts = Hosts(set(TEST_HOSTNAMES))
     maintenance = HostMaintenance(DEFAULT_CLUSTER, 'quiet')
-    maintenance._drain_hosts(test_hosts, clock)
+    maintenance._drain_hosts(test_hosts)
     mock_drain_hosts.assert_called_once_with(test_hosts)
-    assert clock.sleep.call_count == 4
-    assert clock.sleep.call_args == mock.call(
-        HostMaintenance.START_MAINTENANCE_DELAY.as_(Time.SECONDS))
     assert mock_maintenance_status.call_count == 4
     assert fake_maintenance_status_call_args == [
         (Hosts(set(TEST_HOSTNAMES))),


Mime
View raw message