mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03: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:
parent
8c5e2237f4
commit
25303ee625
@ -19,7 +19,18 @@ def get_task_queuename():
|
||||
if os.getenv('AWX_COMPONENT') == 'web':
|
||||
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:
|
||||
return settings.CLUSTER_HOST_ID
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user