Skip to content

Commit 407c279

Browse files
committed
added time to live option in updating available servers api
1 parent 8967126 commit 407c279

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sliderule/sliderule.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ def set_rqst_timeout (timeout):
537537
#
538538
# UPDATE_AVAIABLE_SERVERS
539539
#
540-
def update_available_servers (desired_nodes=None):
540+
def update_available_servers (desired_nodes=None, time_to_live=None):
541541
'''
542542
Manages the number of servers in the cluster.
543543
If the desired_nodes parameter is set, then a request is made to change the number of servers in the cluster to the number specified.
@@ -548,6 +548,8 @@ def update_available_servers (desired_nodes=None):
548548
----------
549549
desired_nodes: int
550550
the desired number of nodes in the cluster
551+
time_to_live: int
552+
number of minutes for the desired nodes to run
551553
552554
Returns
553555
-------
@@ -567,6 +569,8 @@ def update_available_servers (desired_nodes=None):
567569
# Update number of nodes
568570
if type(desired_nodes) == int:
569571
host = "https://ps." + service_url + "/api/desired_org_num_nodes/" + service_org + "/" + str(desired_nodes) + "/"
572+
if type(time_to_live) == int:
573+
host = host + str(time_to_live) + "/"
570574
headers = __build_auth_header()
571575
rsps = requests.put(host, headers=headers, timeout=request_timeout)
572576
rsps.raise_for_status()

0 commit comments

Comments
 (0)