[autotest] Disable incremental updating of TKO from server job.

This is meant for long running tests so that one can see progress from a
frontend, but we've never used this feature, and it's costing us mysql
connections, load, and now bugs.

BUG=chromium:385232
TEST=test_that ran fine

Change-Id: I689ae7c184d8bc6ea3b5f755150906e5031885a8
Reviewed-on: https://chromium-review.googlesource.com/205133
Reviewed-by: Prashanth B <beeps@chromium.org>
Tested-by: Alex Miller <milleral@chromium.org>
Commit-Queue: Alex Miller <milleral@chromium.org>
diff --git a/global_config.ini b/global_config.ini
index 7c8348d..e6d9876 100644
--- a/global_config.ini
+++ b/global_config.ini
@@ -36,6 +36,8 @@
 client_autodir_paths: /usr/local/autotest
 # White list of tests with run time measurement enabled.
 measure_run_time_tests: desktopui_ScreenLocker,login_LoginSuccess,security_ProfilePermissions
+# Incrementally update TKO with the status as the test runs.
+incremental_tko_parsing: False
 
 [CLIENT]
 drop_caches: False
diff --git a/server/server_job.py b/server/server_job.py
index 64a9b44..ec1711b 100644
--- a/server/server_job.py
+++ b/server/server_job.py
@@ -14,7 +14,7 @@
 import getpass, os, sys, re, tempfile, time, select, platform
 import traceback, shutil, warnings, fcntl, pickle, logging, itertools, errno
 from autotest_lib.client.bin import sysinfo
-from autotest_lib.client.common_lib import base_job
+from autotest_lib.client.common_lib import base_job, global_config
 from autotest_lib.client.common_lib import error, utils, packages
 from autotest_lib.client.common_lib import logging_manager
 from autotest_lib.server import test, subcommand, profilers
@@ -22,6 +22,9 @@
 from autotest_lib.tko import db as tko_db, status_lib, utils as tko_utils
 
 
+INCREMENTAL_TKO_PARSING = global_config.global_config.get_config_value(
+        'autoserv', 'incremental_tko_parsing', type=bool, default=False)
+
 def _control_segment_path(name):
     """Get the pathname of the named control segment file."""
     server_dir = os.path.dirname(os.path.abspath(__file__))
@@ -235,7 +238,8 @@
             utils.write_keyval(self.resultdir, job_data)
 
         self._parse_job = parse_job
-        self._using_parser = (self._parse_job and len(machines) <= 1)
+        self._using_parser = (INCREMENTAL_TKO_PARSING and self._parse_job
+                              and len(machines) <= 1)
         self.pkgmgr = packages.PackageManager(
             self.autodir, run_function_dargs={'timeout':600})
         self.num_tests_run = 0
@@ -462,7 +466,7 @@
         if self._parse_job and is_forking and log:
             def wrapper(machine):
                 self._parse_job += "/" + machine
-                self._using_parser = True
+                self._using_parser = INCREMENTAL_TKO_PARSING
                 self.machines = [machine]
                 self.push_execution_context(machine)
                 os.chdir(self.resultdir)