-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timeout problem #29
Comments
I faced this as well. Please suggest a fix! |
This could happen if you didn't start the CoreNLP server before calling it from Python. For help with starting the CoreNLP server, see: https://stanfordnlp.github.io/CoreNLP/corenlp-server.html |
started server before calling it on the same port number tried both with large time out like 1500000 and without mannual timeout taking as default value. |
Hmmm... it's a bit hard to debug with just the information you've provided:
(a) do you have the latest version of the library (3.9.2)?
(b) When running, can you set "be_quiet=False" on the client, e.g. `with
corenlp.CoreNLPClient(annotators="tokenize ssplit pos lemma ner
depparse".split(), be_quiet=False) as client` and share what messages you
get from the Java process?
…On Mon, Jan 28, 2019 at 10:34 AM Saurabh Verma ***@***.***> wrote:
started server before calling it on the same port number tried both with
large time out like 1500000 and without mannual timeout taking as default
value.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFOyZGq9coIpRATaqtLHPA-o-HHqVZqks5vH0KlgaJpZM4aQaUZ>
.
--
Arun Tejasvi Chaganty
http://arun.chagantys.org/
|
Set the timeout parameter in the CoreNLPClient constructor. i.e.
The timeout you are experiencing is the client http request, not the server. Note that confusingly the timeout is in 2ms units! The value you provide is multiplied by 2 and then divided by 1000 before being passed to Python request module.... python-stanford-corenlp/corenlp/client.py Line 199 in 01a60b7
So in the above example using a timeout of 30000 means 60 seconds edited - not annotate function |
Ah, I think the *2 was intentional in that I wanted to provide additional
buffer to the HTTP request to make sure it didn't timeout before CoreNLP
did (and the ms -> sec conversion is because of a difference in units
between CoreNLP and the requests module).
The concern is why is the HTTP client timing out? It would be very helpful
to see the messages outputted by the CoreNLP server -- one possibility is
that the first utterance takes an exceptionally long time to load because
it's loading up all of the models: if that's the case, the best solution
for this would be to up the timeout a bit more.
More generally, I would recommend moving over to the new (official)
Stanford CoreNLP python library: https://github.com/stanfordnlp/stanfordnlp
…On Thu, Jan 31, 2019 at 2:23 PM greasystrangler ***@***.***> wrote:
getting this error *ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost',
port=9000): Read timed out. (read timeout=30)*
when tried to execute
import corenlp
text = "Chris wrote a simple sentence that he parsed with Stanford
CoreNLP."
with corenlp.CoreNLPClient(annotators="tokenize ssplit pos lemma ner
depparse".split()) as client:
ann = client.annotate(text)
sentence = ann.sentence[0]
assert corenlp.to_text(sentence) == text
print(sentence.text)
Set the timeout parameter in the annotate function. i.e.
ann = client.annotate(text, timeout=30000)
The timeout is the client http request, not the server.
Note that confusingly the timeout is in 2ms units! The value you provide
is multiplied by 2 and then divided by 1000 before being passed to Python
request module....
https://github.com/stanfordnlp/python-stanford-corenlp/blob/01a60b7eb816435c39768ff90e822aba43821229/corenlp/client.py#L199
So in the above example using a timeout of 30000 means 60 seconds
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFOydqyNfsZ52y6tf3tueX3uEU3fJRwks5vI2zggaJpZM4aQaUZ>
.
--
Arun Tejasvi Chaganty
http://arun.chagantys.org/
|
After doing this, you also have to open this in a tab as well : |
I still meet this issue, but in a different situation. With setting be_quiet=False, I printed the details:
After waiting, I got the following error with Traceback:
It seems the request has not responded. How can I fix it? Any ideas? |
We have no idea what you're doing, so probably hard to get good suggestions. However, it looks like you're running the server on port 3220. Are you also setting the client to use that port? |
I try to use CoreNLP to do some annotations under the Yes. Port 3220 is just randomly selected. I also tested with default port 9000, but doesn't work. Below is my code.
I check the listening ports, using I also tested on |
A good idea is to check the permissions as stanfordnlp/stanza#245 (comment) Any idea to see my permissions on the server? |
getting this error ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=9000): Read timed out. (read timeout=30)
when tried to execute
import corenlp
text = "Chris wrote a simple sentence that he parsed with Stanford CoreNLP."
with corenlp.CoreNLPClient(annotators="tokenize ssplit pos lemma ner depparse".split()) as client:
ann = client.annotate(text)
sentence = ann.sentence[0]
assert corenlp.to_text(sentence) == text
print(sentence.text)
The text was updated successfully, but these errors were encountered: