mirror of
https://github.com/ansible/awx.git
synced 2026-05-21 15:57:52 -02:30
Merge pull request #3156 from Spredzy/schedule_max_jobs_conditiion
jt, wfjt: Ensure SCHEDULE_MAX_JOBS is accurately respect Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -451,7 +451,7 @@ class JobTemplate(UnifiedJobTemplate, JobOptions, SurveyJobTemplateMixin, Resour
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def cache_timeout_blocked(self):
|
def cache_timeout_blocked(self):
|
||||||
if Job.objects.filter(job_template=self, status__in=['pending', 'waiting', 'running']).count() > getattr(settings, 'SCHEDULE_MAX_JOBS', 10):
|
if Job.objects.filter(job_template=self, status__in=['pending', 'waiting', 'running']).count() >= getattr(settings, 'SCHEDULE_MAX_JOBS', 10):
|
||||||
logger.error("Job template %s could not be started because there are more than %s other jobs from that template waiting to run" %
|
logger.error("Job template %s could not be started because there are more than %s other jobs from that template waiting to run" %
|
||||||
(self.name, getattr(settings, 'SCHEDULE_MAX_JOBS', 10)))
|
(self.name, getattr(settings, 'SCHEDULE_MAX_JOBS', 10)))
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ class WorkflowJobTemplate(UnifiedJobTemplate, WorkflowJobOptions, SurveyJobTempl
|
|||||||
@property
|
@property
|
||||||
def cache_timeout_blocked(self):
|
def cache_timeout_blocked(self):
|
||||||
if WorkflowJob.objects.filter(workflow_job_template=self,
|
if WorkflowJob.objects.filter(workflow_job_template=self,
|
||||||
status__in=['pending', 'waiting', 'running']).count() > getattr(settings, 'SCHEDULE_MAX_JOBS', 10):
|
status__in=['pending', 'waiting', 'running']).count() >= getattr(settings, 'SCHEDULE_MAX_JOBS', 10):
|
||||||
logger.error("Workflow Job template %s could not be started because there are more than %s other jobs from that template waiting to run" %
|
logger.error("Workflow Job template %s could not be started because there are more than %s other jobs from that template waiting to run" %
|
||||||
(self.name, getattr(settings, 'SCHEDULE_MAX_JOBS', 10)))
|
(self.name, getattr(settings, 'SCHEDULE_MAX_JOBS', 10)))
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user