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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With