From 69be94feb9206203d3f17975fc0ce4d6f6c54bd8 Mon Sep 17 00:00:00 2001 From: Aaron Tan Date: Thu, 15 Sep 2016 14:56:27 -0400 Subject: [PATCH] Implement global job timeout mechanism. --- awx/main/tasks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 34edb2e4a8..7461bf9edf 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -517,8 +517,9 @@ class BaseTask(Task): if pexpect_sleep is not None: logger.info("Suspending Job Execution for QA Work") time.sleep(pexpect_sleep) - # TODO: Update job_timeout using instance field instead. - job_timeout = 10 + local_timeout = getattr(instance, 'timeout', 0) + global_timeout = getattr(settings, 'JOB_TIMEOUT', 0) + job_timeout = global_timeout if local_timeout == 0 else local_timeout child = pexpect.spawnu(args[0], args[1:], cwd=cwd, env=env) child.logfile_read = logfile canceled = False