Merge pull request #5787 from mnottale/pull-parallel-by-default

Pull parallel by default
This commit is contained in:
Joffrey F 2018-03-19 05:19:32 -07:00 committed by GitHub
commit 4a75fc7bbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 12 deletions

View File

@ -711,14 +711,17 @@ class TopLevelCommand(object):
Options: Options:
--ignore-pull-failures Pull what it can and ignores images with pull failures. --ignore-pull-failures Pull what it can and ignores images with pull failures.
--parallel Pull multiple images in parallel. --parallel Deprecated, pull multiple images in parallel (enabled by default).
--no-parallel Disable parallel pulling.
-q, --quiet Pull without printing progress information -q, --quiet Pull without printing progress information
--include-deps Also pull services declared as dependencies --include-deps Also pull services declared as dependencies
""" """
if options.get('--parallel'):
log.warn('--parallel option is deprecated and will be removed in future versions.')
self.project.pull( self.project.pull(
service_names=options['SERVICE'], service_names=options['SERVICE'],
ignore_pull_failures=options.get('--ignore-pull-failures'), ignore_pull_failures=options.get('--ignore-pull-failures'),
parallel_pull=options.get('--parallel'), parallel_pull=not options.get('--no-parallel'),
silent=options.get('--quiet'), silent=options.get('--quiet'),
include_deps=options.get('--include-deps'), include_deps=options.get('--include-deps'),
) )

View File

@ -551,7 +551,7 @@ class Project(object):
services, services,
pull_service, pull_service,
operator.attrgetter('name'), operator.attrgetter('name'),
'Pulling', not silent and 'Pulling' or None,
limit=5, limit=5,
) )
if len(errors): if len(errors):

View File

@ -545,13 +545,11 @@ class CLITestCase(DockerClientTestCase):
def test_pull(self): def test_pull(self):
result = self.dispatch(['pull']) result = self.dispatch(['pull'])
assert sorted(result.stderr.split('\n'))[1:] == [ assert 'Pulling simple' in result.stderr
'Pulling another (busybox:latest)...', assert 'Pulling another' in result.stderr
'Pulling simple (busybox:latest)...',
]
def test_pull_with_digest(self): def test_pull_with_digest(self):
result = self.dispatch(['-f', 'digest.yml', 'pull']) result = self.dispatch(['-f', 'digest.yml', 'pull', '--no-parallel'])
assert 'Pulling simple (busybox:latest)...' in result.stderr assert 'Pulling simple (busybox:latest)...' in result.stderr
assert ('Pulling digest (busybox@' assert ('Pulling digest (busybox@'
@ -561,7 +559,7 @@ class CLITestCase(DockerClientTestCase):
def test_pull_with_ignore_pull_failures(self): def test_pull_with_ignore_pull_failures(self):
result = self.dispatch([ result = self.dispatch([
'-f', 'ignore-pull-failures.yml', '-f', 'ignore-pull-failures.yml',
'pull', '--ignore-pull-failures'] 'pull', '--ignore-pull-failures', '--no-parallel']
) )
assert 'Pulling simple (busybox:latest)...' in result.stderr assert 'Pulling simple (busybox:latest)...' in result.stderr
@ -576,7 +574,7 @@ class CLITestCase(DockerClientTestCase):
def test_pull_with_parallel_failure(self): def test_pull_with_parallel_failure(self):
result = self.dispatch([ result = self.dispatch([
'-f', 'ignore-pull-failures.yml', 'pull', '--parallel'], '-f', 'ignore-pull-failures.yml', 'pull'],
returncode=1 returncode=1
) )
@ -593,14 +591,14 @@ class CLITestCase(DockerClientTestCase):
def test_pull_with_no_deps(self): def test_pull_with_no_deps(self):
self.base_dir = 'tests/fixtures/links-composefile' self.base_dir = 'tests/fixtures/links-composefile'
result = self.dispatch(['pull', 'web']) result = self.dispatch(['pull', '--no-parallel', 'web'])
assert sorted(result.stderr.split('\n'))[1:] == [ assert sorted(result.stderr.split('\n'))[1:] == [
'Pulling web (busybox:latest)...', 'Pulling web (busybox:latest)...',
] ]
def test_pull_with_include_deps(self): def test_pull_with_include_deps(self):
self.base_dir = 'tests/fixtures/links-composefile' self.base_dir = 'tests/fixtures/links-composefile'
result = self.dispatch(['pull', '--include-deps', 'web']) result = self.dispatch(['pull', '--no-parallel', '--include-deps', 'web'])
assert sorted(result.stderr.split('\n'))[1:] == [ assert sorted(result.stderr.split('\n'))[1:] == [
'Pulling db (busybox:latest)...', 'Pulling db (busybox:latest)...',
'Pulling web (busybox:latest)...', 'Pulling web (busybox:latest)...',