多处理错误Snowflake Python连接器与flask_socketio
尝试使用snowflake connector for python with flask_socketio和eventlet对snowflake运行查询时,我收到以下错误。。它似乎只在monkey patching eventlet时发生。在此方面的任何帮助都将不胜感激多处理错误Snowflake Python连接器与flask_socketio,python,flask-socketio,snowflake-cloud-data-platform,Python,Flask Socketio,Snowflake Cloud Data Platform,尝试使用snowflake connector for python with flask_socketio和eventlet对snowflake运行查询时,我收到以下错误。。它似乎只在monkey patching eventlet时发生。在此方面的任何帮助都将不胜感激 import snowflake.connector as scon from flask import Flask from flask_socketio import SocketIO import eventlet ev
import snowflake.connector as scon
from flask import Flask
from flask_socketio import SocketIO
import eventlet
eventlet.monkey_patch()
def query():
# Gets the version
ctx = scon.connect(
user='xxx',
password='xxxxxxxx',
account='xxxxxx',
)
cs = ctx.cursor()
try:
cs.execute("SELECT current_version()")
one = cs.fetchone()
return 'Snowflake version={}'.format(one[0])
finally:
cs.close()
app = Flask(__name__)
socketio = SocketIO(app)
@app.route('/')
def query_route():
return query()
socketio.run(app,debug=False, host='localhost', port=5000)
收到错误:
Traceback (most recent call last):
File "/home/chad/miniconda2/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/home/chad/miniconda2/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/chad/miniconda2/lib/python2.7/multiprocessing/pool.py", line 327, in _handle_workers
while thread._state == RUN or (pool._cache and thread._state != TERMINATE):
AttributeError: '_MainThread' object has no attribute '_state'
Exception in thread Thread-6:
Traceback (most recent call last):
File "/home/chad/miniconda2/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/home/chad/miniconda2/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/chad/miniconda2/lib/python2.7/multiprocessing/pool.py", line 363, in _handle_tasks
cache[job]._set(ind + 1, (False, ex))
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
多处理程序包与Eventlet不兼容。这是Evenlet维护人员的评论 您可能应该考虑将该功能移动到一个单独的进程(可能是另一个微服务),在该进程中您不必绑定到Eventlet