[autotest] Drop check_host_assignments in host-scheduler
This method is taking very long (up to 40 secs when load is high).
Since we haven't seem this problem happen since Aug.29, 2014,
I am dropping this sanity check.
BUG=chromium:395715
TEST=Run host scheduler locally and run a local suite.
DEPLOY=host-scheduler
Change-Id: I971002cbfb6c7f54061b968d753e80fbc79afa1b
Reviewed-on: https://chromium-review.googlesource.com/233728
Reviewed-by: Fang Deng <fdeng@chromium.org>
Tested-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/scheduler/host_scheduler.py b/scheduler/host_scheduler.py
index 3158ce5..6d63ca2 100755
--- a/scheduler/host_scheduler.py
+++ b/scheduler/host_scheduler.py
@@ -362,22 +362,6 @@
True, hostname__in=lease_hostnames)
- @_timer.decorate
- def _check_host_assignments(self):
- """Sanity check the current host assignments."""
- # Move this into a periodic cleanup if pressed for performance.
- message = ''
- subject = 'Unexpected host assignments'
- for offending_job in self.job_query_manager.get_overlapping_jobs():
- # TODO: crbug.com/375551
- message += ('HQE %s is using a host in use by another job. This '
- 'could be because of a frontend special task, in which '
- 'case they will only use the host sequentially. ' %
- offending_job)
- if message:
- email_manager.manager.enqueue_notify_email(subject, message)
-
-
def acquire_hosts(self, host_jobs):
"""Override acquire_hosts.
@@ -404,8 +388,6 @@
released_hosts = self._release_hosts()
logging.info('Updating suite assignment with released hosts')
self._suite_recorder.record_release(released_hosts)
- logging.info('Checking host assignments.')
- self._check_host_assignments()
logging.info('Calling email_manager.')
email_manager.manager.send_queued_emails()
diff --git a/scheduler/host_scheduler_unittests.py b/scheduler/host_scheduler_unittests.py
index 77ca0e5..ff95312 100755
--- a/scheduler/host_scheduler_unittests.py
+++ b/scheduler/host_scheduler_unittests.py
@@ -14,7 +14,6 @@
from autotest_lib.frontend.afe import frontend_test_utils
from autotest_lib.frontend.afe import models
from autotest_lib.server.cros.dynamic_suite import constants
-from autotest_lib.scheduler import email_manager
from autotest_lib.scheduler import host_scheduler
from autotest_lib.scheduler import monitor_db
from autotest_lib.scheduler import rdb
@@ -205,22 +204,6 @@
self.assertTrue(task.is_active == 0 and task.host_id == host.id)
- def testOverlappingJobs(self):
- """Check that we catch all cases of an overlapping job."""
- job_1 = self.create_job(deps=set(['a']))
- job_2 = self.create_job(deps=set(['a']))
- host = self.db_helper.create_host('h1', deps=set(['a']))
- self.db_helper.add_host_to_job(host, job_1.id, activate=True)
- self.db_helper.add_host_to_job(host, job_2.id, activate=True)
- jobs = (self.host_scheduler.job_query_manager.get_overlapping_jobs())
- self.assertTrue(len(jobs) == 2 and
- jobs[0]['host_id'] == jobs[1]['host_id'])
- email_manager.manager.enqueue_notify_email = mock.MagicMock()
- self.host_scheduler._check_host_assignments()
- self.assertTrue(
- email_manager.manager.enqueue_notify_email.call_count == 1)
-
-
def _check_agent_invariants(self, host, agent):
host_agents = list(self._dispatcher._host_agents[host.id])
self.assertTrue(len(host_agents) == 1)