1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Merge pull request #4196 from jangsutsr/4137_add_ability_to_disable_global_job_timeout

Add ability to disable global job timeout
This commit is contained in:
Aaron Tan 2016-12-02 16:01:22 -05:00 committed by GitHub
commit 0456aec064
5 changed files with 51 additions and 7 deletions

View File

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0052_v310_inventory_name_non_unique'),
]
operations = [
migrations.AlterField(
model_name='inventorysource',
name='timeout',
field=models.IntegerField(default=0, blank=True),
),
migrations.AlterField(
model_name='inventoryupdate',
name='timeout',
field=models.IntegerField(default=0, blank=True),
),
migrations.AlterField(
model_name='job',
name='timeout',
field=models.IntegerField(default=0, blank=True),
),
migrations.AlterField(
model_name='jobtemplate',
name='timeout',
field=models.IntegerField(default=0, blank=True),
),
migrations.AlterField(
model_name='project',
name='timeout',
field=models.IntegerField(default=0, blank=True),
),
migrations.AlterField(
model_name='projectupdate',
name='timeout',
field=models.IntegerField(default=0, blank=True),
),
]

View File

@ -859,7 +859,7 @@ class InventorySourceOptions(BaseModel):
default=False,
help_text=_('Overwrite local variables from remote inventory source.'),
)
timeout = models.PositiveIntegerField(
timeout = models.IntegerField(
blank=True,
default=0,
)
@ -1309,4 +1309,3 @@ class CustomInventoryScript(CommonModelNameNotUnique, ResourceMixin):
def get_absolute_url(self):
return reverse('api:inventory_script_detail', args=(self.pk,))

View File

@ -148,9 +148,9 @@ class JobOptions(BaseModel):
allow_simultaneous = models.BooleanField(
default=False,
)
timeout = models.PositiveIntegerField(
timeout = models.IntegerField(
blank=True,
default=0,
default=0,
)
extra_vars_dict = VarsDictProperty('extra_vars', True)

View File

@ -106,7 +106,7 @@ class ProjectOptions(models.Model):
default=None,
on_delete=models.SET_NULL,
)
timeout = models.PositiveIntegerField(
timeout = models.IntegerField(
blank=True,
default=0,
)

View File

@ -51,7 +51,7 @@ from awx.main.queue import CallbackQueueDispatcher
from awx.main.task_engine import TaskEnhancer
from awx.main.utils import (get_ansible_version, get_ssh_version, decrypt_field, update_scm_url,
check_proot_installed, build_proot_temp_dir, wrap_args_with_proot,
get_system_task_capacity, OutputEventFilter)
get_system_task_capacity, OutputEventFilter)
from awx.main.consumers import emit_channel_notification
__all__ = ['RunJob', 'RunSystemJob', 'RunProjectUpdate', 'RunInventoryUpdate',
@ -524,6 +524,7 @@ class BaseTask(Task):
global_timeout = getattr(settings, global_timeout_setting_name, 0)
local_timeout = getattr(instance, 'timeout', 0)
job_timeout = global_timeout if local_timeout == 0 else local_timeout
job_timeout = 0 if local_timeout < 0 else job_timeout
else:
job_timeout = 0
child = pexpect.spawnu(args[0], args[1:], cwd=cwd, env=env)
@ -987,7 +988,7 @@ class RunJob(BaseTask):
Wrap stdout file object to capture events.
'''
stdout_handle = super(RunJob, self).get_stdout_handle(instance)
if getattr(settings, 'USE_CALLBACK_QUEUE', False):
dispatcher = CallbackQueueDispatcher()