下面是烧瓶应用程序模块:
@app.route('/service', methods=['POST'])
def service():
postData = request.data
try:
mgmt = src.connect();
src.execute(mgmt);
return "request completed"
except Exception, e:
return ("Exception occured" + str(e));
if __name__ == "__main__":
app.run(port=5050, debug=True, use_reloader=False)
#app.run(port=5050);
下面是进行连接的模块:
^{pr2}$我不是在启动一个新线程,但是它抛出了值错误:signal只在主线程中工作,而在下面的步骤中连接到大IP,如上图所示
mgmt = ManagementRoot(config.get('connection','ipaddr'),config.get('connection','user'),decoded_pass)
我使用的是f5 sdk,其中signal的用法如下:
if HAS_SIGNAL:
signal.signal(SIGALRM, timeout_handler) ## this line throws the error
signal.alarm(int(self.args['timeout']))
response = connect.get(base_uri)
signal.alarm(0)
else:
response = connect.get(base_uri)
是的,UNIX信号不能从主线程以外的线程设置。在
看来f5sdk使用的是连接超时的信号(这有点傻,但确实如此)。在
您可以通过在应用程序的早期显式地告诉SDK您没有setting the flag可用的信号来解决此问题:
当然,另一种解决方法是从主线程进行连接,但我认为这不是出于任何原因而想做的事情:)
我在我的flask应用程序模块中添加了下面的代码,而不是添加了注释的代码。在
相关问题 更多 >
编程相关推荐