| |
@@ -14,8 +14,9 @@
|
| |
Otherwise the whole process will hang.
|
| |
|
| |
:param compose: it is needed for logging
|
| |
- :param phases_schema: two-dimensional array of phases. Top dimension
|
| |
- denotes particular pipelines. Second dimension contains phases.
|
| |
+ :param phases_schema: multi-dimensional array of phases. Top dimension
|
| |
+ denotes particular pipelines. Second dimension can contain sub-pipelines
|
| |
+ or phases.
|
| |
"""
|
| |
|
| |
name = "weaver"
|
| |
@@ -45,7 +46,7 @@
|
| |
|
| |
def run(self):
|
| |
for pipeline in shortcuts.force_list(self._phases_schema):
|
| |
- self.pool.add(PipelineThread(self.pool))
|
| |
+ self.pool.add(PipelineThread(self.pool, self.compose._logger))
|
| |
self.pool.queue_put(shortcuts.force_list(pipeline))
|
| |
|
| |
self.pool.start()
|
| |
@@ -64,18 +65,47 @@
|
| |
Launches phases in pipeline sequentially
|
| |
"""
|
| |
|
| |
+ def __init__(self, pool, logger, subpipeline=False, *args, **kwargs):
|
| |
+ super(PipelineThread, self).__init__(pool, *args, **kwargs)
|
| |
+ self._logger = logger
|
| |
+ self._subpipeline = subpipeline
|
| |
+
|
| |
+ def get_phases_names(self, pipeline):
|
| |
+ phases_names = []
|
| |
+ if isinstance(pipeline, list) or isinstance(pipeline, tuple):
|
| |
+ for phase in pipeline:
|
| |
+ subpipeline = self.get_phases_names(phase)
|
| |
+ if len(subpipeline) > 1:
|
| |
+ subpipeline_phases_names = "(%s)" % ", ".join(subpipeline)
|
| |
+ else:
|
| |
+ subpipeline_phases_names = subpipeline[0]
|
| |
+ phases_names.append(subpipeline_phases_names)
|
| |
+ else:
|
| |
+ phases_names.append(pipeline.name)
|
| |
+ return phases_names
|
| |
+
|
| |
def process(self, item, num):
|
| |
pipeline = shortcuts.force_list(item)
|
| |
- phases_names = ", ".join(phase.name for phase in pipeline)
|
| |
- msg = "Running pipeline (%d/%d). Phases: %s" % (
|
| |
+ phases_names = ", ".join(self.get_phases_names(pipeline))
|
| |
+ msg = "Running %spipeline (%d/%d). Phases: %s" % (
|
| |
+ "sub-" if self._subpipeline else "",
|
| |
num,
|
| |
self.pool.queue_total,
|
| |
phases_names,
|
| |
)
|
| |
self.pool.log_info("[BEGIN] %s" % (msg,))
|
| |
|
| |
- for phase in pipeline:
|
| |
- phase.start()
|
| |
- phase.stop()
|
| |
+ for p in pipeline:
|
| |
+ phases = shortcuts.force_list(p)
|
| |
+ if len(phases) > 1:
|
| |
+ pool = ThreadPool(logger=self._logger)
|
| |
+ for phase in phases:
|
| |
+ pool.add(PipelineThread(pool, self._logger, True))
|
| |
+ pool.queue_put(phase)
|
| |
+ pool.start()
|
| |
+ pool.stop()
|
| |
+ else:
|
| |
+ p.start()
|
| |
+ p.stop()
|
| |
|
| |
self.pool.log_info("[DONE ] %s" % (msg,))
|
| |
Some composes recently start using scm_dict in extra_files which makes
this phase longer (around 3 minutes), but in fact it is possible to
execute extra files phase together with gather phase.
This commit allows that by introducing "sub-pipelines" in the Weaver
phase.
The saved time is interesting only for partial composes which do not
run buildinstall phase, because the buildinstall phase takes much
more time. But it might be useful even with buildinstall in case
we will start caching boot.iso.
Signed-off-by: Jan Kaluza jkaluza@redhat.com