mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 09:27:31 -02:30
Only select task instance that are ready and enabled
When select a queue for task instance to run task only select task instance that are ready and enabled
This commit is contained in:
@@ -19,7 +19,18 @@ def get_task_queuename():
|
|||||||
if os.getenv('AWX_COMPONENT') == 'web':
|
if os.getenv('AWX_COMPONENT') == 'web':
|
||||||
from awx.main.models.ha import Instance
|
from awx.main.models.ha import Instance
|
||||||
|
|
||||||
return Instance.objects.filter(node_type__in=['control', 'hybrid']).order_by('?').first().hostname
|
return (
|
||||||
|
Instance.objects.filter(
|
||||||
|
node_type__in=[Instance.Types.CONTROL, Instance.Types.HYBRID],
|
||||||
|
node_state=Instance.States.READY,
|
||||||
|
enabled=True,
|
||||||
|
)
|
||||||
|
.only('hostname')
|
||||||
|
.order_by('?')
|
||||||
|
.first()
|
||||||
|
.hostname
|
||||||
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return settings.CLUSTER_HOST_ID
|
return settings.CLUSTER_HOST_ID
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user