mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Merge pull request #6142 from jangsutsr/6113_allow_concurrent_workflow_job_runs
Allow concurrent workflow job runs
This commit is contained in:
@@ -2510,7 +2510,7 @@ class WorkflowJobTemplateSerializer(JobTemplateMixin, LabelsListMixin, UnifiedJo
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = WorkflowJobTemplate
|
model = WorkflowJobTemplate
|
||||||
fields = ('*', 'extra_vars', 'organization', 'survey_enabled',)
|
fields = ('*', 'extra_vars', 'organization', 'survey_enabled', 'allow_simultaneous',)
|
||||||
|
|
||||||
def get_related(self, obj):
|
def get_related(self, obj):
|
||||||
res = super(WorkflowJobTemplateSerializer, self).get_related(obj)
|
res = super(WorkflowJobTemplateSerializer, self).get_related(obj)
|
||||||
@@ -2547,7 +2547,7 @@ class WorkflowJobSerializer(LabelsListMixin, UnifiedJobSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = WorkflowJob
|
model = WorkflowJob
|
||||||
fields = ('*', 'workflow_job_template', 'extra_vars')
|
fields = ('*', 'workflow_job_template', 'extra_vars', 'allow_simultaneous',)
|
||||||
|
|
||||||
def get_related(self, obj):
|
def get_related(self, obj):
|
||||||
res = super(WorkflowJobSerializer, self).get_related(obj)
|
res = super(WorkflowJobSerializer, self).get_related(obj)
|
||||||
|
|||||||
@@ -147,4 +147,16 @@ class Migration(migrations.Migration):
|
|||||||
name='verbosity',
|
name='verbosity',
|
||||||
field=models.PositiveIntegerField(default=1, blank=True, choices=[(0, b'0 (WARNING)'), (1, b'1 (INFO)'), (2, b'2 (DEBUG)')]),
|
field=models.PositiveIntegerField(default=1, blank=True, choices=[(0, b'0 (WARNING)'), (1, b'1 (INFO)'), (2, b'2 (DEBUG)')]),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
# Workflows
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='workflowjob',
|
||||||
|
name='allow_simultaneous',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='workflowjobtemplate',
|
||||||
|
name='allow_simultaneous',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -284,6 +284,9 @@ class WorkflowJobOptions(BaseModel):
|
|||||||
blank=True,
|
blank=True,
|
||||||
default='',
|
default='',
|
||||||
))
|
))
|
||||||
|
allow_simultaneous = models.BooleanField(
|
||||||
|
default=False
|
||||||
|
)
|
||||||
|
|
||||||
extra_vars_dict = VarsDictProperty('extra_vars', True)
|
extra_vars_dict = VarsDictProperty('extra_vars', True)
|
||||||
|
|
||||||
@@ -356,7 +359,7 @@ class WorkflowJobTemplate(UnifiedJobTemplate, WorkflowJobOptions, SurveyJobTempl
|
|||||||
@classmethod
|
@classmethod
|
||||||
def _get_unified_job_field_names(cls):
|
def _get_unified_job_field_names(cls):
|
||||||
return ['name', 'description', 'extra_vars', 'labels', 'survey_passwords',
|
return ['name', 'description', 'extra_vars', 'labels', 'survey_passwords',
|
||||||
'schedule', 'launch_type']
|
'schedule', 'launch_type', 'allow_simultaneous']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_unified_jt_copy_names(cls):
|
def _get_unified_jt_copy_names(cls):
|
||||||
|
|||||||
@@ -178,6 +178,8 @@ class DependencyGraph(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def can_workflow_job_run(self, job):
|
def can_workflow_job_run(self, job):
|
||||||
|
if job['allow_simultaneous'] is True:
|
||||||
|
return True
|
||||||
return self.data[self.WORKFLOW_JOB_TEMPLATES_JOBS].get(job['workflow_job_template_id'], True)
|
return self.data[self.WORKFLOW_JOB_TEMPLATES_JOBS].get(job['workflow_job_template_id'], True)
|
||||||
|
|
||||||
def can_system_job_run(self):
|
def can_system_job_run(self):
|
||||||
@@ -217,4 +219,3 @@ class DependencyGraph(object):
|
|||||||
|
|
||||||
def add_jobs(self, jobs):
|
def add_jobs(self, jobs):
|
||||||
map(lambda j: self.add_job(j), jobs)
|
map(lambda j: self.add_job(j), jobs)
|
||||||
|
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ class AdHocCommandDict(PartialModelDict):
|
|||||||
|
|
||||||
class WorkflowJobDict(PartialModelDict):
|
class WorkflowJobDict(PartialModelDict):
|
||||||
FIELDS = (
|
FIELDS = (
|
||||||
'id', 'created', 'status', 'workflow_job_template_id',
|
'id', 'created', 'status', 'workflow_job_template_id', 'allow_simultaneous',
|
||||||
)
|
)
|
||||||
model = WorkflowJob
|
model = WorkflowJob
|
||||||
|
|
||||||
@@ -272,4 +272,3 @@ class WorkflowJobDict(PartialModelDict):
|
|||||||
|
|
||||||
def task_impact(self):
|
def task_impact(self):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ Workflow job summary:
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Starting from Tower 3.2, Workflow jobs support simultaneous job runs just like that of ordinary jobs. It is controlled by `allow_simultaneous` field of underlying workflow job template. By default, simultaneous workflow job runs are disabled and users should be prudent in enabling this functionality. Because the performance boost of simultaneous workflow runs will only manifest when a large portion of jobs contained by a workflow allow simultaneous runs. Otherwise it is expected to have some long-running workflow jobs since its spawned jobs can be in pending state for a long time.
|
||||||
|
|
||||||
### Workflow Copy and Relaunch
|
### Workflow Copy and Relaunch
|
||||||
Other than the normal way of creating workflow job templates, it is also possible to copy existing workflow job templates. The resulting new workflow job template will be mostly identical to the original, except for `name` field which will be appended a text to indicate it's a copy.
|
Other than the normal way of creating workflow job templates, it is also possible to copy existing workflow job templates. The resulting new workflow job template will be mostly identical to the original, except for `name` field which will be appended a text to indicate it's a copy.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user