Skip to content
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

FileNotFoundError when using POST method #2

Open
shipse92 opened this issue Jun 30, 2020 · 9 comments
Open

FileNotFoundError when using POST method #2

shipse92 opened this issue Jun 30, 2020 · 9 comments

Comments

@shipse92
Copy link

I built this docker image and ran.
It works well except gene normalizer couldn't find gene IDs when http get request. like bellow.
http://localhost:8008/?pmid=30429604&format=pubtator

But when I do post request, I can't got any result.

I did like this

python code:
import json
import requests
server = 'localhost:8008'
abstract = 'CD95L is a transmembrane ligand (m-CD95L) that is cleaved by metalloproteases to release a soluble ligand (s-CD95L). Unlike m-CD95L, interaction between s-CD95L and CD95 fails to recruit caspase-8 and FADD to trigger apoptosis and instead induces a Ca2+ response via docking of PLCgamma1 to the calcium-inducing domain (CID) within CD95. '
param = {'param':json.dumps({'text':abstract})}
NERRequest = requests.post(server, data = param)
print (NERRequest .text)

This did't print any result.

So I saw log, recorded like this

nohup_BERN.out:
Exception happened during processing of request from ('172.17.0.1', 35880)
Traceback (most recent call last):
File "/usr/lib/python3.5/socketserver.py", line 625, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.5/socketserver.py", line 681, in init
self.handle()
File "/usr/lib/python3.5/http/server.py", line 422, in handle
self.handle_one_request()
File "/usr/lib/python3.5/http/server.py", line 410, in handle_one_request
method()
File "server.py", line 317, in do_POST
text, cur_thread_name, is_raw_text=True, reuse=False)
File "server.py", line 452, in tag_entities
self.biobert_recognize(dict_list, is_raw_text, cur_thread_name)
File "server.py", line 490, in biobert_recognize
thread_id=cur_thread_name)
File "/app/biobert_ner/utils.py", line 15, in with_profiling
ret = fn(*args, **kwargs)
File "/app/biobert_ner/run_ner.py", line 488, in recognize
with open(token_path, 'r') as reader:
FileNotFoundError: [Errno 2] No such file or directory: 'biobert_ner/tmp/token_test_Thread-54.txt'

GET method worked well, but POST method did'nt work.
When GET method, txt file was in directory 'biobert_ner/tmp/' , and was immediately removed.
But POST method didn't make any file in that directory,

What was wrong?
Could you fix this?

Thanks your effort.

@amalic
Copy link
Owner

amalic commented Jun 30, 2020

Looks like this is also Bern related. See here

@shipse92
Copy link
Author

Your bern-docker runs well?

Could you test Post method like above in your system?

@amalic
Copy link
Owner

amalic commented Jun 30, 2020

I just ran it, and all my sample calls from this project's readme file work.

I think your issue is related to this --> dmis-lab/bern#17

@shipse92
Copy link
Author

shipse92 commented Jul 1, 2020

Yes. I know your smaple calls in readme file all works.
That sample call GET method.
Bern can recieve POST method.

If you call your bern-docker by POST method, you cannot get any results.
You will see this message in log.
(I edited your 'entrypoint.sh' to write log out.)

Exception happened during processing of request from ('172.17.0.1', 35880) Traceback (most recent call last): File "/usr/lib/python3.5/socketserver.py", line 625, in process_request_thread self.finish_request(request, client_address) File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python3.5/socketserver.py", line 681, in init self.handle() File "/usr/lib/python3.5/http/server.py", line 422, in handle self.handle_one_request() File "/usr/lib/python3.5/http/server.py", line 410, in handle_one_request method() File "server.py", line 317, in do_POST text, cur_thread_name, is_raw_text=True, reuse=False) File "server.py", line 452, in tag_entities self.biobert_recognize(dict_list, is_raw_text, cur_thread_name) File "server.py", line 490, in biobert_recognize thread_id=cur_thread_name) File "/app/biobert_ner/utils.py", line 15, in with_profiling ret = fn(*args, **kwargs) File "/app/biobert_ner/run_ner.py", line 488, in recognize with open(token_path, 'r') as reader: FileNotFoundError: [Errno 2] No such file or directory: 'biobert_ner/tmp/token_test_Thread-54.txt'

@avacaondata
Copy link

@amalic Please what was the problem with directories that you mentioned in BERN repository? I think it might fix this issue. I'm running into the same problem: FileNotFoundError: [Errno 2] No such file or directory: 'biobert_ner/tmp/token_test_Thread-10.txt'

@shipse92
Copy link
Author

shipse92 commented Sep 24, 2020 via email

@avacaondata
Copy link

Could you please show me how to disable gnormal and tmvar2 in server.py?
Thank you very much for your reply, really. I've been struggling with this since yesterday and I don't find the bug...
I think it's clear that run_ner.py is trying to use a token.txt placed in biobert_ner/tmp/, but I don't see the process where this token is supposed to be saved in that directory...
What's obvious to me is that the authors of the original BERN might have solved the issue, as when calling their service everything works fine, however I've found that most of the users that are deploying their own servers are encountering this issue...

@shipse92

@shipse92
Copy link
Author

shipse92 commented Sep 24, 2020 via email

@avacaondata
Copy link

I cannot see it :( I'll send you an email! Thank you very much :) @shipse92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants