Autotest: Update RPC, Scheduler and AFE to use timeout_mins.

Now that timeout_mins is in the database, we need to update the
infrastructure to display and utilize timeout_mins rather than
timeout.

The scheduler now aborts based off of timeout_mins.

The afe displays/creates jobs using timeout_mins rather than timeout.

The RPC's take in timeout and timeout_min depending on what is inputted
to the system. Note the value supplied for timeout_mins takes precedence
over timeout.

BUG=chromium:221264
TEST=Created job through AFE, run_suite with smoke suite, job_unittest
and rpc_unittests.
DEPLOY=apache, afe, scheduler

CQ-DEPEND=I09f8b6023a31dcef37e98c298dc0d63b37bc0a9e

Change-Id: I838cd1ff85a2ce6bd49fe96bf18fd82be608c758
Reviewed-on: https://chromium-review.googlesource.com/176605
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
diff --git a/frontend/afe/site_rpc_interface.py b/frontend/afe/site_rpc_interface.py
index 9c7d31b..fc7de1f 100644
--- a/frontend/afe/site_rpc_interface.py
+++ b/frontend/afe/site_rpc_interface.py
@@ -79,7 +79,7 @@
 
 
 def create_suite_job(suite_name, board, build, pool, check_hosts=True,
-                     num=None, file_bugs=False, timeout=24,
+                     num=None, file_bugs=False, timeout=24, timeout_mins=None,
                      priority=priorities.Priority.DEFAULT,
                      suite_args=None):
     """
@@ -98,6 +98,8 @@
                 Leave unspecified or use None to use default sharding factor.
     @param file_bugs: File a bug on each test failure in this suite.
     @param timeout: The max lifetime of this suite, in hours.
+    @param timeout_mins: The max lifetime of this suite, in minutes. Takes
+                         priority over timeout.
     @param priority: Integer denoting priority. Higher is more important.
     @param suite_args: Optional arguments which will be parsed by the suite
                        control file. Used by control.test_that_wrapper to
@@ -136,6 +138,8 @@
     control_file_in = get_control_file_contents_by_name(build, board, ds,
                                                         suite_name)
 
+    timeout_mins = timeout_mins or timeout * 60
+
 
     # prepend build and board to the control file
     inject_dict = {'board': board,
@@ -145,6 +149,7 @@
                    'num': num,
                    'file_bugs': file_bugs,
                    'timeout': timeout,
+                   'timeout_mins': timeout_mins,
                    'devserver_url': ds.url(),
                    'priority': priority,
                    'suite_args' : suite_args
@@ -154,7 +159,7 @@
 
     return _rpc_utils().create_job_common('%s-%s' % (build, suite_name),
                                           priority=priority,
-                                          timeout=timeout,
+                                          timeout_mins=timeout_mins,
                                           max_runtime_mins=timeout*60,
                                           control_type='Server',
                                           control_file=control_file,