Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

neo4j

py2neo

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?

like image 987
Martin Preusse Avatar asked Nov 22 '14 14:11

Martin Preusse


1 Answers

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.

like image 66
Nigel Small Avatar answered Nov 01 '22 22:11

Nigel Small