mirror of https://github.com/docker/compose.git
Hide parallel pull behind --parallel flag
Signed-off-by: Evan Shaw <evan@vendhq.com>
This commit is contained in:
parent
f85da99ef3
commit
c6a271e57c
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue