Add job maximum runtime, a new per-job timeout that counts time since the job actually started.
* added started_on field to host_queue_entries, so that we could actually compute this timeout
* added max_runtime_hrs to jobs, with default in global config, and added option to create_job() RPC
* added the usual controls to AFE and the CLI for the new job option
* added new max runtime timeout method to
* added migration to add new fields and set a safe default max runtime for existing jobs
Signed-off-by: Steve Howard <showard@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3132 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index 09f88ed..a0a5634 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -349,11 +349,12 @@
return cf_info
-def create_job(name, priority, control_file, control_type, is_template=False,
- timeout=None, synch_count=None, hosts=(), meta_hosts=(),
- run_verify=True, one_time_hosts=(), email_list='',
- dependencies=(), reboot_before=None, reboot_after=None,
- parse_failed_repair=None, atomic_group_name=None):
+def create_job(name, priority, control_file, control_type,
+ hosts=(), meta_hosts=(), one_time_hosts=(),
+ atomic_group_name=None, synch_count=None, is_template=False,
+ timeout=None, max_runtime_hrs=None, run_verify=True,
+ email_list='', dependencies=(), reboot_before=None,
+ reboot_after=None, parse_failed_repair=None):
"""\
Create and enqueue a job.
@@ -366,6 +367,7 @@
given this value is treated as a minimum.
@param is_template If true then create a template job.
@param timeout Hours after this call returns until the job times out.
+ @param max_runtime_hrs Hours from job starting time until job times out
@param run_verify Should the host be verified before running the test?
@param email_list String containing emails to mail when the job is done
@param dependencies List of label names on which this job depends
@@ -430,6 +432,7 @@
control_type=control_type,
is_template=is_template,
timeout=timeout,
+ max_runtime_hrs=max_runtime_hrs,
synch_count=synch_count,
run_verify=run_verify,
email_list=email_list,
@@ -666,6 +669,7 @@
result['host_statuses'] = sorted(models.Host.Status.names)
result['job_statuses'] = sorted(models.HostQueueEntry.Status.names)
result['job_timeout_default'] = models.Job.DEFAULT_TIMEOUT
+ result['job_max_runtime_hrs_default'] = models.Job.DEFAULT_MAX_RUNTIME_HRS
result['parse_failed_repair_default'] = bool(
models.Job.DEFAULT_PARSE_FAILED_REPAIR)
result['reboot_before_options'] = models.RebootBefore.names