diff --git a/app/models.py b/app/models.py index 1d23a0258841a9ebf58144fd98e942061ab499c7..e7bce666b6f90b35eb3ef3362ab4b8248e8135db 100644 --- a/app/models.py +++ b/app/models.py @@ -347,7 +347,7 @@ class User(db.Model, UserMixin): The task is added to the session but not committed. """ - q = Queue(queue_name) + q = Queue(queue_name, default_timeout=current_app.config["RQ_DEFAULT_TIMEOUT"]) job = q.enqueue(f"app.tasks.{func}", **kwargs) # The status will be set to QUEUED or DEFERRED task = Task( diff --git a/app/settings.py b/app/settings.py index b7e0c432855f20cf4a17eed862dcfb949b8cbb46..625938efc5e382776775cf8884ecd85b97c42db5 100644 --- a/app/settings.py +++ b/app/settings.py @@ -146,3 +146,5 @@ SENTRY_DSN = os.environ.get("SENTRY_DSN", "") # Static local files CSENTRY_STATIC_DIR = Path(__file__).parent / "static" CSENTRY_STATIC_FILES = CSENTRY_STATIC_DIR / "files" + +RQ_DEFAULT_TIMEOUT = 1800 diff --git a/app/utils.py b/app/utils.py index 3fa9bbf5ede57c808d6b51d6d4aa6f2ef810a743..b1b120d58d4a27326b5316cd1bf3d4c0de22f9c3 100644 --- a/app/utils.py +++ b/app/utils.py @@ -258,7 +258,6 @@ def trigger_core_services_update(): "job_template": job_template, "resource": resource, "depends_on": inventory_task.id, - "timeout": 500, } current_app.logger.info(f"Launch new job to update core services: {job_template}") task = current_user.launch_task( @@ -350,7 +349,6 @@ def trigger_vm_creation( func="launch_awx_job", job_template=job_template, extra_vars=extra_vars, - timeout=500, ) if ( post_job_template @@ -365,7 +363,6 @@ def trigger_vm_creation( job_template=post_job_template, limit=f"{host.fqdn}", depends_on=task.id, - timeout=500, ) current_app.logger.info( f"Trigger post install job: run {post_job_template} on {host.fqdn}" @@ -395,7 +392,6 @@ def trigger_ztp_configuration(host): func="launch_awx_job", job_template=job_template, extra_vars=extra_vars, - timeout=500, ) return task @@ -417,7 +413,6 @@ def trigger_set_network_boot_profile(host, boot_profile): func="launch_awx_job", job_template=job_template, extra_vars=extra_vars, - timeout=500, ) return task