mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 17:37:30 -02:30
Merge pull request #4800 from AlanCoding/bad_node_redo
Avoid signal_start override for workflow job spawn
This commit is contained in:
@@ -606,11 +606,10 @@ class Job(UnifiedJob, JobOptions, SurveyJobMixin, JobNotificationMixin):
|
|||||||
evars.update(extra_vars)
|
evars.update(extra_vars)
|
||||||
self.update_fields(extra_vars=json.dumps(evars))
|
self.update_fields(extra_vars=json.dumps(evars))
|
||||||
|
|
||||||
def signal_start(self, **kwargs):
|
def _resources_sufficient_for_launch(self):
|
||||||
# Block cases that would cause the task manager to error
|
if self.job_type == PERM_INVENTORY_SCAN:
|
||||||
if self.inventory_id is None or self.project_id is None:
|
return self.inventory_id is not None
|
||||||
return False
|
return not (self.inventory_id is None or self.project_id is None)
|
||||||
return super(Job, self).signal_start(**kwargs)
|
|
||||||
|
|
||||||
def display_artifacts(self):
|
def display_artifacts(self):
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -561,6 +561,9 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique
|
|||||||
"Override in child classes, None value indicates this is not configurable"
|
"Override in child classes, None value indicates this is not configurable"
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def _resources_sufficient_for_launch(self):
|
||||||
|
return True
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u'%s-%s-%s' % (self.created, self.id, self.status)
|
return u'%s-%s-%s' % (self.created, self.id, self.status)
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,10 @@ class TaskManager():
|
|||||||
job = spawn_node.unified_job_template.create_unified_job(**kv)
|
job = spawn_node.unified_job_template.create_unified_job(**kv)
|
||||||
spawn_node.job = job
|
spawn_node.job = job
|
||||||
spawn_node.save()
|
spawn_node.save()
|
||||||
can_start = job.signal_start(**kv)
|
if job._resources_sufficient_for_launch():
|
||||||
|
can_start = job.signal_start(**kv)
|
||||||
|
else:
|
||||||
|
can_start = False
|
||||||
if not can_start:
|
if not can_start:
|
||||||
job.status = 'failed'
|
job.status = 'failed'
|
||||||
job.job_explanation = _("Job spawned from workflow could not start because it "
|
job.job_explanation = _("Job spawned from workflow could not start because it "
|
||||||
|
|||||||
Reference in New Issue
Block a user