diff --git a/compose/cli/main.py b/compose/cli/main.py index 51ba36a09..423e214e9 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -602,10 +602,12 @@ class TopLevelCommand(object): Options: --ignore-pull-failures Pull what it can and ignores images with pull failures. + --parallel Pull multiple images in parallel. """ self.project.pull( service_names=options['SERVICE'], - ignore_pull_failures=options.get('--ignore-pull-failures') + ignore_pull_failures=options.get('--ignore-pull-failures'), + in_parallel=options.get('--parallel') ) def push(self, options): diff --git a/compose/project.py b/compose/project.py index d02d8ece3..c08fbc362 100644 --- a/compose/project.py +++ b/compose/project.py @@ -454,17 +454,22 @@ class Project(object): return plans - def pull(self, service_names=None, ignore_pull_failures=False): - def pull_service(service): - service.pull(ignore_pull_failures, True) - + def pull(self, service_names=None, ignore_pull_failures=False, in_parallel=False): services = self.get_services(service_names, include_deps=False) - parallel.parallel_execute( - services, - pull_service, - operator.attrgetter('name'), - 'Pulling', - limit=5) + + if in_parallel: + def pull_service(service): + service.pull(ignore_pull_failures, True) + + parallel.parallel_execute( + services, + pull_service, + operator.attrgetter('name'), + 'Pulling', + limit=5) + else: + for service in services: + service.pull(ignore_pull_failures) def push(self, service_names=None, ignore_push_failures=False): for service in self.get_services(service_names, include_deps=False):