summaryrefslogtreecommitdiff
path: root/docker/client.py
diff options
context:
space:
mode:
authorMariano Scazzariello <marianoscazzariello@gmail.com>2020-11-17 15:42:36 +0100
committerGitHub <noreply@github.com>2020-11-17 15:42:36 +0100
commitbb1c528ab3c67ac6ceb3f8a65a7cc0f919cf83fe (patch)
tree006fb6f313b9cf57ef16d9ef6ab74721acea27cc /docker/client.py
parent800222268a79d62a0a63411278cca736e61bc191 (diff)
downloaddocker-py-bb1c528ab3c67ac6ceb3f8a65a7cc0f919cf83fe.tar.gz
Add max_pool_size parameter (#2699)
* Add max_pool_size parameter Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com> * Add client version to tests Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com> * Fix parameter position Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
Diffstat (limited to 'docker/client.py')
-rw-r--r--docker/client.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/docker/client.py b/docker/client.py
index 1fea69e..5add5d7 100644
--- a/docker/client.py
+++ b/docker/client.py
@@ -1,5 +1,5 @@
from .api.client import APIClient
-from .constants import DEFAULT_TIMEOUT_SECONDS
+from .constants import (DEFAULT_TIMEOUT_SECONDS, DEFAULT_MAX_POOL_SIZE)
from .models.configs import ConfigCollection
from .models.containers import ContainerCollection
from .models.images import ImageCollection
@@ -38,6 +38,8 @@ class DockerClient(object):
use_ssh_client (bool): If set to `True`, an ssh connection is made
via shelling out to the ssh client. Ensure the ssh client is
installed and configured on the host.
+ max_pool_size (int): The maximum number of connections
+ to save in the pool.
"""
def __init__(self, *args, **kwargs):
self.api = APIClient(*args, **kwargs)
@@ -67,6 +69,8 @@ class DockerClient(object):
version (str): The version of the API to use. Set to ``auto`` to
automatically detect the server's version. Default: ``auto``
timeout (int): Default timeout for API calls, in seconds.
+ max_pool_size (int): The maximum number of connections
+ to save in the pool.
ssl_version (int): A valid `SSL version`_.
assert_hostname (bool): Verify the hostname of the server.
environment (dict): The environment to read environment variables
@@ -86,10 +90,12 @@ class DockerClient(object):
https://docs.python.org/3.5/library/ssl.html#ssl.PROTOCOL_TLSv1
"""
timeout = kwargs.pop('timeout', DEFAULT_TIMEOUT_SECONDS)
+ max_pool_size = kwargs.pop('max_pool_size', DEFAULT_MAX_POOL_SIZE)
version = kwargs.pop('version', None)
use_ssh_client = kwargs.pop('use_ssh_client', False)
return cls(
timeout=timeout,
+ max_pool_size=max_pool_size,
version=version,
use_ssh_client=use_ssh_client,
**kwargs_from_env(**kwargs)