py2neo 2.0: ERROR:httpstream:! SocketError: timed out

半世苍凉 提交于 2019-12-06 17:29:06

问题


I execute a long running (5 mintues) Cypher query with py2neo 2.0:

graph.cypher.run(query) or result = graph.cypher.execute(query)

The query fails after ~60 sec with a Socket Error from httpstream:

ERROR:httpstream:! SocketError: timed out

The same happens when I use a Cypher transaction. This did not happen with the same query and py2neo 1.6.4. Can I increase the time py2neo waits for a response? I didn't find anything in the docs.


Update

I found a hard coded socket_timeout in py2neo.packages.httpstream.http. Setting it to a higher value avoids the SocketError:

from py2neo.packages.httpstream import http
http.socket_timeout = 9999

result = graph.cypher.execute("MATCH (g:Gene) RETURN count(g)")

Can I somehow set the timeout for a single query?


回答1:


There's currently no way to adjust the timeout for individual queries as this setting applies at a connection level and one connection can obviously be used for many queries. The socket_timeout you're using is the correct way to adjust the timeout globally though.



来源:https://stackoverflow.com/questions/27078352/py2neo-2-0-errorhttpstream-socketerror-timed-out

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!