Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added idle_timeout setting to job settings #10906

Merged
merged 3 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions awx/main/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,21 @@
unit=_('seconds'),
)

register(
'DEFAULT_JOB_IDLE_TIMEOUT',
field_class=fields.IntegerField,
min_value=0,
default=0,
label=_('Default Job Idle Timeout'),
help_text=_(
'If no output is detected from ansible in this number of seconds the execution will be terminated. '
'Use value of 0 to used default idle_timeout is 600s.'
),
category=_('Jobs'),
category_slug='jobs',
unit=_('seconds'),
)

register(
'DEFAULT_INVENTORY_UPDATE_TIMEOUT',
field_class=fields.IntegerField,
Expand Down
4 changes: 4 additions & 0 deletions awx/main/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,10 @@ def run(self, pk, **kwargs):
},
}

idle_timeout = getattr(settings, 'DEFAULT_JOB_IDLE_TIMEOUT', 0)
if idle_timeout > 0:
params['settings']['idle_timeout'] = idle_timeout

if isinstance(self.instance, AdHocCommand):
params['module'] = self.build_module_name(self.instance)
params['module_args'] = self.build_module_args(self.instance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe('<JobsDetail />', () => {
);
assertDetail(wrapper, 'Maximum Scheduled Jobs', '10');
assertDetail(wrapper, 'Default Job Timeout', '0 seconds');
assertDetail(wrapper, 'Default Job Idle Timeout', '0 seconds');
assertDetail(wrapper, 'Default Inventory Update Timeout', '0 seconds');
assertDetail(wrapper, 'Default Project Update Timeout', '0 seconds');
assertDetail(wrapper, 'Per-Host Ansible Fact Cache Timeout', '0 seconds');
Expand Down
5 changes: 5 additions & 0 deletions awx/ui/src/screens/Setting/Jobs/JobsEdit/JobsEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ function JobsEdit() {
config={jobs.DEFAULT_JOB_TIMEOUT}
type="number"
/>
<InputField
name="DEFAULT_JOB_IDLE_TIMEOUT"
config={jobs.DEFAULT_JOB_IDLE_TIMEOUT}
type="number"
/>
<InputField
name="DEFAULT_INVENTORY_UPDATE_TIMEOUT"
config={jobs.DEFAULT_INVENTORY_UPDATE_TIMEOUT}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"AWX_TASK_ENV": {},
"DEFAULT_INVENTORY_UPDATE_TIMEOUT": 0,
"DEFAULT_JOB_TIMEOUT": 0,
"DEFAULT_JOB_IDLE_TIMEOUT": 0,
"DEFAULT_PROJECT_UPDATE_TIMEOUT": 0,
"GALAXY_IGNORE_CERTS": false,
"MAX_FORKS": 200,
Expand Down
21 changes: 21 additions & 0 deletions awx/ui/src/screens/Setting/shared/data.allSettingOptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,17 @@
"unit": "seconds",
"default": 0
},
"DEFAULT_JOB_IDLE_TIMEOUT": {
"type": "integer",
"required": false,
"label": "Default Job Idle Timeout",
"help_text": "If no output is detected from ansible in this number of seconds the execution will be terminated. Use value of 0 to used default idle_timeout is 600s.",
"min_value": 0,
"category": "Jobs",
"category_slug": "jobs",
"unit": "seconds",
"default": 0
},
"DEFAULT_INVENTORY_UPDATE_TIMEOUT": {
"type": "integer",
"required": false,
Expand Down Expand Up @@ -3987,6 +3998,16 @@
"defined_in_file": false,
"unit": "seconds"
},
"DEFAULT_JOB_IDLE_TIMEOUT": {
"type": "integer",
"label": "Default Job Idle Timeout",
"help_text": "If no output is detected from ansible in this number of seconds the execution will be terminated. Use value of 0 to used default idle_timeout is 600s.",
"min_value": 0,
"category": "Jobs",
"category_slug": "jobs",
"defined_in_file": false,
"unit": "seconds"
},
"DEFAULT_INVENTORY_UPDATE_TIMEOUT": {
"type": "integer",
"label": "Default Inventory Update Timeout",
Expand Down
1 change: 1 addition & 0 deletions awx/ui/src/screens/Setting/shared/data.allSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"SCHEDULE_MAX_JOBS":10,
"AWX_ANSIBLE_CALLBACK_PLUGINS":[],
"DEFAULT_JOB_TIMEOUT":0,
"DEFAULT_JOB_IDLE_TIMEOUT":0,
"DEFAULT_INVENTORY_UPDATE_TIMEOUT":0,
"DEFAULT_PROJECT_UPDATE_TIMEOUT":0,
"ANSIBLE_FACT_CACHE_TIMEOUT":0,
Expand Down
1 change: 1 addition & 0 deletions awx/ui/src/screens/Setting/shared/data.jobSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"SCHEDULE_MAX_JOBS": 10,
"AWX_ANSIBLE_CALLBACK_PLUGINS": [],
"DEFAULT_JOB_TIMEOUT": 0,
"DEFAULT_JOB_IDLE_TIMEOUT": 0,
"DEFAULT_INVENTORY_UPDATE_TIMEOUT": 0,
"DEFAULT_PROJECT_UPDATE_TIMEOUT": 0,
"ANSIBLE_FACT_CACHE_TIMEOUT": 0,
Expand Down