gpt4 book ai didi

neo4j - py2neo: py2neo.packages.httpstream.http.SocketError: 超时 - 执行、流或事务?

转载 作者:行者123 更新时间:2023-12-02 08:29:22 24 4
gpt4 key购买 nike

首先。如果这不是同谋结构,我很抱歉。我只是不确定从哪里开始或结束,但我已尽力为您提供尽可能多的信息。

我在 AWS M3.large、py2neo 2.0.4 和 neo4j-community-2.1.7 上工作

我正在尝试使用 py2neo 将大型数据集导入到 neo4j 中。我的问题是,当我读入大约 150k 时,它只给我一个:py2neo.packages.httpstream.http.SocketError: timed out

我需要增加数百万的输入,所以 150k 应该就可以了。

整个错误:

Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/py2neo/packages/httpstream/http.py", line 322, in submit
response = send()
File "/usr/local/lib/python3.4/dist-packages/py2neo/packages/httpstream/http.py", line 318, in send
return http.getresponse(**getresponse_args)
File "/usr/lib/python3.4/http/client.py", line 1147, in getresponse
response.begin()
File "/usr/lib/python3.4/http/client.py", line 351, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.4/http/client.py", line 313, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.4/socket.py", line 371, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/py2neo/packages/httpstream/http.py", line 331, in submit
response = send("timeout")
File "/usr/local/lib/python3.4/dist-packages/py2neo/packages/httpstream/http.py", line 318, in send
return http.getresponse(**getresponse_args)
File "/usr/lib/python3.4/http/client.py", line 1147, in getresponse
response.begin()
File "/usr/lib/python3.4/http/client.py", line 351, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.4/http/client.py", line 313, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.4/socket.py", line 371, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "transactions.py", line 221, in <module>
read_zip("data")
File "transactions.py", line 44, in read_zip
create_tweets(lines)
File "transactions.py", line 215, in create_tweets
tx.process()
File "/usr/local/lib/python3.4/dist-packages/py2neo/cypher/core.py", line 296, in process
return self.post(self.__execute or self.__begin)
File "/usr/local/lib/python3.4/dist-packages/py2neo/cypher/core.py", line 248, in post
rs = resource.post({"statements": self.statements})
File "/usr/local/lib/python3.4/dist-packages/py2neo/core.py", line 322, in post
response = self.__base.post(body, headers, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/py2neo/packages/httpstream/http.py", line 984, in post
return rq.submit(**kwargs)
File "/usr/local/lib/python3.4/dist-packages/py2neo/packages/httpstream/http.py", line 433, in submit
http, rs = submit(self.method, uri, self.body, self.headers)
File "/usr/local/lib/python3.4/dist-packages/py2neo/packages/httpstream/http.py", line 362, in submit
raise SocketError(code, description, host_port=uri.host_port)
py2neo.packages.httpstream.http.SocketError: timed out

现在我使用密码。我分批写入 ~1000,但较小的批处理也不起作用。我的问题是,我可以使用其他方法来加快速度吗?

现在,我这样做:

stagement = "match (p:person {id=123}) ON CREATE SET p.age = 132" 

def add_names(names):
for-loop with batches of 1000:
tx = graph.cypher.begin()

for name in names:
tx.append(statement, {"N": name})
tx.process()

tx.commit()

但是使用 execute 或 stream 或我可以做的其他任何事情会更好吗?

有用的链接:

最佳答案

尝试添加

从 py2neo.packages.httpstream 导入 http
http.socket_timeout = 9999

关于neo4j - py2neo: py2neo.packages.httpstream.http.SocketError: 超时 - 执行、流或事务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28776140/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com