From d52e237ea09338761ec2a7f8b0e762465f625686 Mon Sep 17 00:00:00 2001 From: Aaron Tan Date: Tue, 13 Sep 2016 16:17:31 -0400 Subject: [PATCH] Implement timeout on job/job-template. --- awx/api/serializers.py | 2 +- awx/main/migrations/0033_v310_job_timeout.py | 24 ++++++++++++++++++++ awx/main/models/jobs.py | 8 +++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 awx/main/migrations/0033_v310_job_timeout.py diff --git a/awx/api/serializers.py b/awx/api/serializers.py index ded5d454c3..4ea799682d 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -1789,7 +1789,7 @@ class JobOptionsSerializer(BaseSerializer): fields = ('*', 'job_type', 'inventory', 'project', 'playbook', 'credential', 'cloud_credential', 'network_credential', 'forks', 'limit', 'verbosity', 'extra_vars', 'job_tags', 'force_handlers', - 'skip_tags', 'start_at_task',) + 'skip_tags', 'start_at_task', 'timeout') def get_related(self, obj): res = super(JobOptionsSerializer, self).get_related(obj) diff --git a/awx/main/migrations/0033_v310_job_timeout.py b/awx/main/migrations/0033_v310_job_timeout.py new file mode 100644 index 0000000000..df18030d47 --- /dev/null +++ b/awx/main/migrations/0033_v310_job_timeout.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0032_v302_credential_permissions_update'), + ] + + operations = [ + migrations.AddField( + model_name='job', + name='timeout', + field=models.PositiveIntegerField(default=0, blank=True), + ), + migrations.AddField( + model_name='jobtemplate', + name='timeout', + field=models.PositiveIntegerField(default=0, blank=True), + ), + ] diff --git a/awx/main/models/jobs.py b/awx/main/models/jobs.py index 27efff9cc7..5d33feb533 100644 --- a/awx/main/models/jobs.py +++ b/awx/main/models/jobs.py @@ -143,6 +143,10 @@ class JobOptions(BaseModel): allow_simultaneous = models.BooleanField( default=False, ) + timeout = models.PositiveIntegerField( + blank=True, + default=0, + ) extra_vars_dict = VarsDictProperty('extra_vars', True) @@ -253,7 +257,11 @@ class JobTemplate(UnifiedJobTemplate, JobOptions, ResourceMixin): 'playbook', 'credential', 'cloud_credential', 'network_credential', 'forks', 'schedule', 'limit', 'verbosity', 'job_tags', 'extra_vars', 'launch_type', 'force_handlers', 'skip_tags', 'start_at_task', 'become_enabled', +<<<<<<< 887818cb8987d465e23f1ed0c5886473acdbfcda 'labels', 'survey_passwords', 'allow_simultaneous',] +======= + 'labels', 'survey_passwords', 'timeout'] +>>>>>>> Implement timeout on job/job-template. def resource_validation_data(self): '''