py2neo 2.0: ERROR:httpstream:! SocketError: timed out
Asked Answered
D

1

15

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?

Dunderhead answered 22/11, 2014 at 14:15 Comment(1)
Can you change this setting somewhere in neo4j's files (outside of the script)? Like in one of the files in the conf folder?Wattenberg
K
9

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.

Kinsman answered 23/11, 2014 at 11:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.