[autotest] Allow control file to specify maximum test results to collect

Control file can set an attribute MAX_RESULT_SIZE_KB to specify the maximum
test result size to collect. By default, it will be 20MB if
`enable_result_throttling` is set to True in global config.

BUG=chromium:716218
TEST=unittest, local run dummy tests

Change-Id: Ia6b9a04d92ec91179ceb99466b5e9d6a5d1b3ef3
Reviewed-on: https://chromium-review.googlesource.com/540196
Commit-Ready: Dan Shi <[email protected]>
Tested-by: Dan Shi <[email protected]>
Reviewed-by: Dan Shi <[email protected]>
diff --git a/server/server_job.py b/server/server_job.py
index d96e609..35f1d54 100644
--- a/server/server_job.py
+++ b/server/server_job.py
@@ -30,6 +30,7 @@
 
 from autotest_lib.client.bin import sysinfo
 from autotest_lib.client.common_lib import base_job
+from autotest_lib.client.common_lib import control_data
 from autotest_lib.client.common_lib import error
 from autotest_lib.client.common_lib import global_config
 from autotest_lib.client.common_lib import logging_manager
@@ -353,6 +354,14 @@
         # to client jobs is suspect.  Probably, we should remove it.
         self.harness = None
 
+        if control:
+            self.max_result_size_KB = control_data.parse_control(
+                    control, raise_warnings=False).max_result_size_KB
+        else:
+            # Set the maximum result size to be the default specified in
+            # global config, if the job has no control file associated.
+            self.max_result_size_KB = control_data.DEFAULT_MAX_RESULT_SIZE_KB
+
 
     @classmethod
     def _find_base_directories(cls):