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:
commit
0456aec064
44
awx/main/migrations/0053_v310_update_timeout_field_type.py
Normal file
44
awx/main/migrations/0053_v310_update_timeout_field_type.py
Normal 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),
|
||||||
|
),
|
||||||
|
]
|
@ -859,7 +859,7 @@ class InventorySourceOptions(BaseModel):
|
|||||||
default=False,
|
default=False,
|
||||||
help_text=_('Overwrite local variables from remote inventory source.'),
|
help_text=_('Overwrite local variables from remote inventory source.'),
|
||||||
)
|
)
|
||||||
timeout = models.PositiveIntegerField(
|
timeout = models.IntegerField(
|
||||||
blank=True,
|
blank=True,
|
||||||
default=0,
|
default=0,
|
||||||
)
|
)
|
||||||
@ -1309,4 +1309,3 @@ class CustomInventoryScript(CommonModelNameNotUnique, ResourceMixin):
|
|||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('api:inventory_script_detail', args=(self.pk,))
|
return reverse('api:inventory_script_detail', args=(self.pk,))
|
||||||
|
|
||||||
|
@ -148,9 +148,9 @@ class JobOptions(BaseModel):
|
|||||||
allow_simultaneous = models.BooleanField(
|
allow_simultaneous = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
timeout = models.PositiveIntegerField(
|
timeout = models.IntegerField(
|
||||||
blank=True,
|
blank=True,
|
||||||
default=0,
|
default=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
extra_vars_dict = VarsDictProperty('extra_vars', True)
|
extra_vars_dict = VarsDictProperty('extra_vars', True)
|
||||||
|
@ -106,7 +106,7 @@ class ProjectOptions(models.Model):
|
|||||||
default=None,
|
default=None,
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
)
|
)
|
||||||
timeout = models.PositiveIntegerField(
|
timeout = models.IntegerField(
|
||||||
blank=True,
|
blank=True,
|
||||||
default=0,
|
default=0,
|
||||||
)
|
)
|
||||||
|
@ -51,7 +51,7 @@ from awx.main.queue import CallbackQueueDispatcher
|
|||||||
from awx.main.task_engine import TaskEnhancer
|
from awx.main.task_engine import TaskEnhancer
|
||||||
from awx.main.utils import (get_ansible_version, get_ssh_version, decrypt_field, update_scm_url,
|
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,
|
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
|
from awx.main.consumers import emit_channel_notification
|
||||||
|
|
||||||
__all__ = ['RunJob', 'RunSystemJob', 'RunProjectUpdate', 'RunInventoryUpdate',
|
__all__ = ['RunJob', 'RunSystemJob', 'RunProjectUpdate', 'RunInventoryUpdate',
|
||||||
@ -524,6 +524,7 @@ class BaseTask(Task):
|
|||||||
global_timeout = getattr(settings, global_timeout_setting_name, 0)
|
global_timeout = getattr(settings, global_timeout_setting_name, 0)
|
||||||
local_timeout = getattr(instance, 'timeout', 0)
|
local_timeout = getattr(instance, 'timeout', 0)
|
||||||
job_timeout = global_timeout if local_timeout == 0 else local_timeout
|
job_timeout = global_timeout if local_timeout == 0 else local_timeout
|
||||||
|
job_timeout = 0 if local_timeout < 0 else job_timeout
|
||||||
else:
|
else:
|
||||||
job_timeout = 0
|
job_timeout = 0
|
||||||
child = pexpect.spawnu(args[0], args[1:], cwd=cwd, env=env)
|
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.
|
Wrap stdout file object to capture events.
|
||||||
'''
|
'''
|
||||||
stdout_handle = super(RunJob, self).get_stdout_handle(instance)
|
stdout_handle = super(RunJob, self).get_stdout_handle(instance)
|
||||||
|
|
||||||
if getattr(settings, 'USE_CALLBACK_QUEUE', False):
|
if getattr(settings, 'USE_CALLBACK_QUEUE', False):
|
||||||
dispatcher = CallbackQueueDispatcher()
|
dispatcher = CallbackQueueDispatcher()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user