mirror of
https://github.com/ansible/awx.git
synced 2026-02-12 07:04:45 -03:30
get_local_queuename will return the pod name of the instance now that web and task are in different pods when web container queue a task it will be put into a queue without as task worker to execute the task
36 lines
903 B
Python
36 lines
903 B
Python
# Python
|
|
import logging
|
|
|
|
# Django
|
|
from django.conf import settings
|
|
|
|
# AWX
|
|
from awx import MODE
|
|
from awx.main.scheduler import TaskManager, DependencyManager, WorkflowManager
|
|
from awx.main.dispatch.publish import task
|
|
from awx.main.dispatch import get_task_queuename
|
|
|
|
logger = logging.getLogger('awx.main.scheduler')
|
|
|
|
|
|
def run_manager(manager, prefix):
|
|
if MODE == 'development' and settings.AWX_DISABLE_TASK_MANAGERS:
|
|
logger.debug(f"Not running {prefix} manager, AWX_DISABLE_TASK_MANAGERS is True. Trigger with GET to /api/debug/{prefix}_manager/")
|
|
return
|
|
manager().schedule()
|
|
|
|
|
|
@task(queue=get_task_queuename)
|
|
def task_manager():
|
|
run_manager(TaskManager, "task")
|
|
|
|
|
|
@task(queue=get_task_queuename)
|
|
def dependency_manager():
|
|
run_manager(DependencyManager, "dependency")
|
|
|
|
|
|
@task(queue=get_task_queuename)
|
|
def workflow_manager():
|
|
run_manager(WorkflowManager, "workflow")
|