Adding a timeout field to the "Create Job" tab, modified the create_job
RPC to handle a "timeout" argument, and added a "timeout" column to the
AUTOTEST_WEB database. Sets how long a job should run until it is
automatically aborted.
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1765 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index e316084..b421f4b 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -30,6 +30,8 @@
__author__ = 'showard@google.com (Steve Howard)'
import models, model_logic, control_file, rpc_utils
+from autotest_lib.client.common_lib import global_config
+
# labels
@@ -247,8 +249,8 @@
return cf_text, is_server, is_synchronous
-def create_job(name, priority, control_file, control_type, is_synchronous=None,
- hosts=None, meta_hosts=None):
+def create_job(name, priority, control_file, control_type, timeout=None,
+ is_synchronous=None, hosts=None, meta_hosts=None):
"""\
Create and enqueue a job.
@@ -260,7 +262,13 @@
meta_hosts: list where each entry is a label name, and for each entry
one host will be chosen from that label to run the job
on.
+ timeout: hours until job times out
"""
+
+ if timeout is None:
+ timeout=global_config.global_config.get_config_value(
+ 'AUTOTEST_WEB', 'job_timeout_default')
+
owner = rpc_utils.get_user().login
# input validation
if not hosts and not meta_hosts:
@@ -309,7 +317,8 @@
control_file=control_file,
control_type=control_type,
synch_type=synch_type,
- hosts=host_objects)
+ hosts=host_objects,
+ timeout=timeout)
job.queue(host_objects)
return job.id
@@ -425,4 +434,6 @@
result['user_login'] = rpc_utils.get_user().login
result['host_statuses'] = sorted(models.Host.Status.names)
result['job_statuses'] = sorted(models.Job.Status.names)
+ result['job_timeout_default'] = global_config.global_config.get_config_value(
+ 'AUTOTEST_WEB', 'job_timeout_default')
return result