You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2020/07/29 14:29:45 UTC
[libcloud] branch trunk updated: Allow user to pass "wait_period"
argument to the deploy_method() and default it to a more reasonable value.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
The following commit(s) were added to refs/heads/trunk by this push:
new f938cc5 Allow user to pass "wait_period" argument to the deploy_method() and default it to a more reasonable value.
f938cc5 is described below
commit f938cc5cccdf5afcb7a69282e5f07beac063282b
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Wed Jul 29 16:16:01 2020 +0200
Allow user to pass "wait_period" argument to the deploy_method() and
default it to a more reasonable value.
---
CHANGES.rst | 12 ++++++++++++
libcloud/compute/base.py | 9 ++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index 6198f52..6690636 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -43,6 +43,18 @@ Compute
(GITHUB-1469)
[Eis D. Zaster - @Eis-D-Z]
+- [Deployment] Add new ``wait_period`` argument to the ``deploy_node`` method
+ and default it to 5 seconds.
+
+ This argument tells Libcloud how long to wait between each poll interval when
+ waiting for a node to come online and have IP address assigned to it.
+
+ Previously this argument was not exposed to the end user and defaulted to 3
+ seconds which means it would be quite easy to reach rate limits with some
+ providers when spinning up many instances concurrently using the same
+ credentials.
+ [Tomaz Muraus - @Kami]
+
Changes in Apache Libcloud 3.1.0
--------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index e28feee..d0b02e0 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -999,6 +999,7 @@ class NodeDriver(BaseDriver):
max_tries=3, # type: int
ssh_interface='public_ips', # type: str
at_exit_func=None, # type: Callable
+ wait_period=5, # type: int
**create_node_kwargs):
# type: (...) -> Node
"""
@@ -1105,6 +1106,12 @@ class NodeDriver(BaseDriver):
finishes (this includes throwing an exception),
at exit handler function won't be called.
:type at_exit_func: ``func``
+
+ :param wait_period: How many seconds to wait between each iteration
+ while waiting for node to transition into
+ running state and have IP assigned. (default is 5)
+ :type wait_period: ``int``
+
"""
if not libcloud.compute.ssh.have_paramiko:
raise RuntimeError('paramiko is not installed. You can install ' +
@@ -1182,7 +1189,7 @@ class NodeDriver(BaseDriver):
try:
node, ip_addresses = self.wait_until_running(
nodes=[node],
- wait_period=3,
+ wait_period=wait_period,
timeout=wait_timeout,
ssh_interface=ssh_interface)[0]
except Exception as e: