2828requests .packages .urllib3 .disable_warnings () # pylint: disable=no-member
2929
3030from cmapi_server .constants import (
31- CMAPI_CONF_PATH , CMAPI_DEFAULT_CONF_PATH , DEFAULT_MCS_CONF_PATH ,
32- DEFAULT_SM_CONF_PATH , LOCALHOSTS , _version
31+ CMAPI_CONF_PATH ,
32+ CMAPI_DEFAULT_CONF_PATH ,
33+ DEFAULT_MCS_CONF_PATH ,
34+ DEFAULT_SM_CONF_PATH ,
35+ DMLPROC_SHUTDOWN_TIMEOUT ,
36+ LOCALHOSTS ,
37+ LONG_REQUEST_TIMEOUT ,
38+ TRANSACTION_TIMEOUT ,
39+ _version
3340)
3441from cmapi_server .handlers .cej import CEJPasswordHandler
3542from cmapi_server .managers .process import MCSProcessManager
@@ -63,7 +70,7 @@ def start_transaction(
6370 remove_nodes : Optional [list ] = None ,
6471 optional_nodes : Optional [list ] = None ,
6572 txn_id : Optional [int ] = None ,
66- timeout : float = 300.0
73+ timeout : float = TRANSACTION_TIMEOUT
6774):
6875 """Start internal CMAPI transaction.
6976
@@ -87,7 +94,7 @@ def start_transaction(
8794 :param txn_id: id for transaction to start, defaults to None
8895 :type txn_id: Optional[int], optional
8996 :param timeout: time in seconds for cmapi transaction lock before it ends
90- automatically, defaults to 300
97+ automatically, defaults to TRANSACTION_TIMEOUT
9198 :type timeout: float, optional
9299 :return: (success, txn_id, nodes)
93100 :rtype: tuple[bool, int, list[str]]
@@ -324,8 +331,7 @@ def broadcast_new_config(
324331 defaults to DEFAULT_SM_CONF_PATH
325332 :param test_mode: for test purposes, defaults to False TODO: remove
326333 :param nodes: nodes list for config put, defaults to None
327- :param timeout: timeout passing to gracefully stop DMLProc TODO: for next
328- releases. Could affect all logic of broadcacting new config
334+ :param timeout: timeout passing to gracefully stop DMLProc process,
329335 :param distribute_secrets: flag to distribute secrets to nodes
330336 :param stateful_config_dict: stateful config update dict to distribute to nodes
331337 :raises CMAPIBasicError: If Broadcasting config to nodes failed with errors
@@ -341,7 +347,7 @@ def broadcast_new_config(
341347 headers = {'x-api-key' : key }
342348 if stateful_config_dict :
343349 body = {
344- 'timeout' : 300 ,
350+ 'timeout' : DMLPROC_SHUTDOWN_TIMEOUT if timeout is None else timeout ,
345351 'stateful_config_dict' : stateful_config_dict ,
346352 'only_stateful_config' : True ,
347353 }
@@ -357,7 +363,7 @@ def broadcast_new_config(
357363 body = {
358364 'manager' : root .find ('./ClusterManager' ).text ,
359365 'revision' : root .find ('./ConfigRevision' ).text ,
360- 'timeout' : 300 ,
366+ 'timeout' : DMLPROC_SHUTDOWN_TIMEOUT if timeout is None else timeout ,
361367 'config' : config_text ,
362368 'mcs_config_filename' : cs_config_filename ,
363369 'sm_config_filename' : sm_config_filename ,
@@ -395,7 +401,7 @@ async def update_config(node: str, headers: dict, body: dict) -> None:
395401 async with create_traced_async_session () as session :
396402 try :
397403 async with session .put (
398- url , headers = headers , json = body , ssl = False , timeout = 120
404+ url , headers = headers , json = body , ssl = False , timeout = LONG_REQUEST_TIMEOUT
399405 ) as response :
400406 resp_json = await response .json (encoding = 'utf-8' )
401407 response .raise_for_status ()
0 commit comments