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