[autotest] RDB Refactor II + Request/Response API.
Scheduler Refactor:
1. Batched processing of jobs.
2. Rdb hits the database instead of going through host_scheduler.
3. Migration to add a leased column.The scheduler released hosts
every tick, back to the rdb.
4. Client rdb host that queue_entries use to track a host, instead
of a database model.
Establishes a basic request/response api for the rdb:
rdb_utils:
1. Requests: Assert the format and fields of some basic request types.
2. Helper client/server modules to communicate with the rdb.
rdb_lib:
1. Request managers for rdb methods:
a. Match request-response
b. Abstract the batching of requests.
2. JobQueryManager: Regulates database access for job information.
rdb:
1. QueryManagers: Regulate database access
2. RequestHandlers: Use query managers to get things done.
3. Dispatchers: Send incoming requests to the appropriate handlers.
Ignores wire formats.
TEST=unittests, functional verification.
BUG=chromium:314081, chromium:314083, chromium:314084
DEPLOY=scheduler, migrate
Change-Id: Id174c663c6e78295d365142751053eae4023116d
Reviewed-on: https://chromium-review.googlesource.com/183385
Reviewed-by: Prashanth B <beeps@chromium.org>
Commit-Queue: Prashanth B <beeps@chromium.org>
Tested-by: Prashanth B <beeps@chromium.org>
diff --git a/frontend/migrations/085_lease_hosts.py b/frontend/migrations/085_lease_hosts.py
new file mode 100644
index 0000000..fd277bb
--- /dev/null
+++ b/frontend/migrations/085_lease_hosts.py
@@ -0,0 +1,9 @@
+UP_SQL = """
+ALTER TABLE afe_hosts ADD COLUMN leased TINYINT(1) NOT NULL DEFAULT '1';
+CREATE INDEX leased_hosts ON afe_hosts (leased, locked);
+"""
+
+DOWN_SQL = """
+DROP INDEX leased_hosts ON afe_hosts;
+ALTER TABLE afe_hosts DROP COLUMN leased;
+"""