mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
set execution_node right when jobs are accepted
This commit is contained in:
parent
c868f7e91f
commit
892ca98709
@ -495,6 +495,8 @@ class TaskManager():
|
|||||||
- instance is reported as down, then fail all jobs on the node
|
- instance is reported as down, then fail all jobs on the node
|
||||||
- instance is an isolated node, then check running tasks
|
- instance is an isolated node, then check running tasks
|
||||||
among all allowed controller nodes for management process
|
among all allowed controller nodes for management process
|
||||||
|
- valid healthy instance not included in celery task list
|
||||||
|
probably a netsplit case, leave it alone
|
||||||
'''
|
'''
|
||||||
instance = Instance.objects.filter(hostname=node).first()
|
instance = Instance.objects.filter(hostname=node).first()
|
||||||
|
|
||||||
|
@ -769,7 +769,10 @@ class BaseTask(LogErrorsTask):
|
|||||||
'''
|
'''
|
||||||
Run the job/task and capture its output.
|
Run the job/task and capture its output.
|
||||||
'''
|
'''
|
||||||
instance = self.update_model(pk, status='running')
|
execution_node = settings.CLUSTER_HOST_ID
|
||||||
|
if isolated_host is not None:
|
||||||
|
execution_node = isolated_host
|
||||||
|
instance = self.update_model(pk, status='running', execution_node=execution_node)
|
||||||
|
|
||||||
instance.websocket_emit_status("running")
|
instance.websocket_emit_status("running")
|
||||||
status, rc, tb = 'error', None, ''
|
status, rc, tb = 'error', None, ''
|
||||||
@ -856,12 +859,7 @@ class BaseTask(LogErrorsTask):
|
|||||||
pexpect_timeout=getattr(settings, 'PEXPECT_TIMEOUT', 5),
|
pexpect_timeout=getattr(settings, 'PEXPECT_TIMEOUT', 5),
|
||||||
proot_cmd=getattr(settings, 'AWX_PROOT_CMD', 'bwrap'),
|
proot_cmd=getattr(settings, 'AWX_PROOT_CMD', 'bwrap'),
|
||||||
)
|
)
|
||||||
execution_node = settings.CLUSTER_HOST_ID
|
instance = self.update_model(instance.pk, output_replacements=output_replacements)
|
||||||
if isolated_host is not None:
|
|
||||||
execution_node = isolated_host
|
|
||||||
instance = self.update_model(instance.pk, status='running',
|
|
||||||
execution_node=execution_node,
|
|
||||||
output_replacements=output_replacements)
|
|
||||||
if isolated_host:
|
if isolated_host:
|
||||||
manager_instance = isolated_manager.IsolatedManager(
|
manager_instance = isolated_manager.IsolatedManager(
|
||||||
args, cwd, env, stdout_handle, ssh_key_path, **_kw
|
args, cwd, env, stdout_handle, ssh_key_path, **_kw
|
||||||
|
@ -259,7 +259,7 @@ class TestGenericRun(TestJobExecution):
|
|||||||
with pytest.raises(Exception):
|
with pytest.raises(Exception):
|
||||||
self.task.run(self.pk)
|
self.task.run(self.pk)
|
||||||
for c in [
|
for c in [
|
||||||
mock.call(self.pk, status='running'),
|
mock.call(self.pk, execution_node=settings.CLUSTER_HOST_ID, status='running'),
|
||||||
mock.call(self.pk, output_replacements=[], result_traceback=mock.ANY, status='canceled')
|
mock.call(self.pk, output_replacements=[], result_traceback=mock.ANY, status='canceled')
|
||||||
]:
|
]:
|
||||||
assert c in self.task.update_model.call_args_list
|
assert c in self.task.update_model.call_args_list
|
||||||
|
Loading…
Reference in New Issue
Block a user