I have an action using the “python-script” runner, which is finishing with a “TIMEOUT” status, a lot before reaching the timeout interval (600 sec).
For example, the action below ran for 159 seconds before timing out.
id: 5f7d4a4346d46f00f77c3f73 status: timeout (159s elapsed) parameters: device_hostname: mytestdevice password: '********' username: test result: error: Action failed to complete in 600 seconds exit_code: -9 result: None
The python script uses the “requests” library to make a GET request, with the timeout set to 60 seconds. However, when reducing the timeout (to say, 10 seconds) the action status is “FAILED” with the exception “requests.exceptions.ReadTimeout”.
Please note the Python code works fine outside of Stackstorm , regardless of the timeout interval with the GET request.
The action meta-data is as follows:
--- name: run_api_method description: 'Run a method using the API.' entry_point: run_api_method.py runner_type: "python-script" enabled: true parameters: device_hostname: type: "string" required: true description: "Hostname of the device." username: type: "string" required: true description: "Username to use to log on to the device." password: type: "string" required: true description: "Password to use to log on to the device." secret: true
The .py file:
from lib import helpers class TestAction(helpers.BaseAction): def run(self, device_hostname, username, password): device = self.login_to_device(device_hostname, '443',username, password) return_data = device.save_binary_config() if return_data.ok: return True, return_data.text return False, 'Failed'
st2 3.1.0, on Python 2.7.6
Have checked the logs, but couldn’t find anything noteworthy there.
Any help is much appreciated.