Forum Discussion
REST Call Timeout - Python SDK
Running 11.6.0 HF5 the following Python SDK call:
mgmt.tm.util.bash.exec_cmd(
command='run',
utilCmdArgs="-c 'tmsh save /sys ucs /var/local/ucs/f5-create-backup-python.ucs'",
)
...throws this exception:
Traceback (most recent call last):
File "", line 1, in
File ".../f5env/lib/python3.6/site-packages/f5/bigip/tm/util/bash.py", line 55, in exec_cmd
return self._exec_cmd(command, **kwargs)
File ".../f5env/lib/python3.6/site-packages/f5/bigip/mixins.py", line 257, in _exec_cmd
self._meta_data['uri'], json=kwargs, **requests_params)
File ".../f5env/lib/python3.6/site-packages/icontrol/session.py", line 287, in wrapper
raise iControlUnexpectedHTTPError(error_message, response=response)
icontrol.exceptions.iControlUnexpectedHTTPError: 400 Unexpected Error: Bad Request for uri: https://my.ltm.com:443/mgmt/tm/util/bash/
Text: '{
"code":400,
"message":"remoteSender:10.1.1.1,
uri:http://localhost:8110/tm/util/bash/,
method:POST ",
"originalRequestBody":"{
\\"utilCmdArgs\\": \\"-c \'tmsh save /sys ucs /var/local/ucs/f5-create-backup-python.ucs\'\\",
\\"command\\": \\"run\\"",
"referer":"10.1.1.1",
"restOperationId":28795163,
"errorStack":[
"java.util.concurrent.TimeoutException: remoteSender:10.1.1.1,
uri:http://localhost:8110/tm/util/bash/,
method:POST ",
"at com.f5.rest.common.RestRequestSender.checkExpiredOperations(RestRequestSender.java:505)",
"at com.f5.rest.common.RestServer.checkAndExpirePendingWorkerOperations(RestServer.java:854)",
"at com.f5.rest.common.RestServer.access$400(RestServer.java:43)",
"at com.f5.rest.common.RestServer$3.run(RestServer.java:822)",
"at com.f5.rest.common.ScheduleTaskManager$2.run(ScheduleTaskManager.java:105)",
"at java.util.TimerThread.mainLoop(Timer.java:555)",
"at java.util.TimerThread.run(Timer.java:505)\\n"
]
}'
I'm using util.bash to make the call because of the old TMOS version. This same script works fine on our other 11.6.0 LTMs - two of them are failing and under much heavier load.
Is there a way to increase this timeout?
1 Reply
- Lee_Sutcliffe
Nacreous
I use this method to increase the timeout using the REST API, so you may be able to translate it for the SDK. (sorry Python SDK isn't my strong point)
curl -X POST \ 'https://bigip1.local/mgmt/shared/authn/login' \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -d '{ "username":"admin", "password":"admin", "loginProviderName": "tmos" }'
This will respond with a JSON body containing a token (token.token) Use this token on a second request to extend your timeout. If your token was ABCDEFGHIJKMLNOPQRSTUVWXYZ, your second request would look like this:
curl -X PATCH \ https://bigip1.local/mgmt/shared/authz/tokens/ABCDEFGHIJKMLNOPQRSTUVWXYZ \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -d '{ "timeout":"36000" }'
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com