the service should be free and unlimited per se, except for server resources, i.e. if there are many concurrent requests.
We recently created a new docker for self hosting. @JulioNoe could you post a link to instructions? Also could you check the service, whether there is a limit, either by looking at the code or running 1000 abstracts in pt through it, either the docker or http://api.dbpedia-spotlight.org/pt/annotate
I will also ping Alexioman, whether this is a pyspotlight problem.
– Sebastian
It would surprise me if someone introduced a rate limiter without telling us. The 403 definitely doesn’t come from pyspotlight, which simply passes on responses that it gets from the server.
About the docker versions. Here it is a link to the dbpedia/spotlight-databus docker image (which let you run the available languages model in Databus). But if you only want to run the Portuguese version, here it is the dbpedia/spotlight-portuguese docker image. The instructions to run the databus or Portuguese version is explained in each link.
About the “403 Client Error”: I ran the dbpedia/spotlight-databus docker image version with the Portuguese language model and I had no problems running 1000 petitions. However, I did the same with http://model.dbpedia-spotlight.org/pt/annotate and after 21 petitions sended to the server the following message is shown:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
<hr>
<address>Apache/2.4.25 (Debian) Server at model.dbpedia-spotlight.org Port 80</address>
</body></html>
I will check the code to determine where it is defined this restriction or maybe it could be a server configuration.
@mwon if you want to use the server URL (http://model.dbpedia-spotlight.org/pt/annotate) you can set a wait/sleep function for 1-2 minutes between each 20 petitions (approximately) or you can download the Databus or Portuguese docker versions which let you run any number of petitions.
I am making many requests (~10k) to the english api (http://api.dbpedia-spotlight.org/en/annotate) and receiving a lot of 403s… I’ve realized that the percentage of errors I get is inversely proportional to the interval between requests. I am also getting some 502 errors from time to time.
I hope you find this comment useful and that this issue can be solved soon.
@lucas0, @JulioNoe has reworked the spotlight docker, which works for @mwon. We will deploy it on the server as a replacement and maybe you can test it for us. We will ping you then.
@kurzum @mwon
Seems like I’ve managed to run the docker image:
$sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
47b3469ea4fa dbpedia/spotlight-english "/bin/sh" 6 minutes ago Up 6 minutes 0.0.0.0:2222->80/tcp focused_wu
An example of curl to query the dbpedia docker version is as follows:
curl http://localhost:2222/rest/annotate --data-urlencode "text=President Obama called Wednesday on Congress to extend a tax break for students included in last year's economic stimulus package, arguing that the policy provides more generous assistance." --data "confidence=0.35" -H "Accept: text/turtle"
where “Accept:text/turtle” returns a nif output but if you want a json output you must replace it for “Accept: application/json”
It could be nice if help us to try the dbpedia/spotlight-databus version. This version allows you to locally download more than one language, e.g., English (en), German (de), etc.
The docker version is another way to run DBpedia Spotlight and it follows the same instructions as the DBpedia Spotligh Github project. Thanks for the observation, I will add a “how to run” to the docker instructions.
I want to ask you for your help and support to test a new docker version of the DBpedia Spotlight. I know that you are interested into using a specific version of DBpedia Spotlight (Portuguese and English) then, it could be very useful if you can use the dbpedia/spotlight-databus docker version, in particular the v.0.2 version. Additional to your interested languages, you could try any of the available languages in this link.
docker pull dbpedia/spotlight-databus:v.0.2
If you found any issue/bug or have any question, please post it here. Thanks in advance.
docker: Error response from daemon: Conflict. The container name "/spotlight-databus" is already in use by container "24884ad77682ee1af27cad41286eb8b886602b9ef902164e8a84cfe3c6dc69de". You have to remove (or rename) that container to be able to reuse that name.
@JulioNoe
I’d be happy to help. I’ve finally found what was wrong on my docker and the reason why i was getting error 56…
I was able to put the docker on with sudo docker run -i-p 2222:80 dbpedia/spotlight-english
but since there was no entry-point created by the docker itself, it is imperative that i run the spotlight.sh bash file so the entry-point is created. Still, I was getting the same error…
Another thing was that, for some reason the docker wouldnt stay on for more than a wee bit on my local mac machine (it wasnt the same on an ubuntu 18.04 i was working through shh, where it stayed listed with docker ps for a longer while), so adding the --restart unless-stopped flag made it work. Still not completely sure why.
I’ll try to set up the databus with the instructions you’ve placed here.
If I understand, you download the latest docker English version (docker pull dbpedia/spotlight-english). The new version is tagged as “databus”, if this version works fine it will be the next latest version:
docker pull dbpedia/spotlight-english:databus
After downloading this new version, run the following command:
docker run -i -p 2222:80 dbpedia/spotlight-english:databus spotlight.sh
but I am not sure how it works on mac machines.
If it is possible, maybe you can try with the docker image dbpedia/spotlight-databus:v.0.2, following the steps posted. Thanks in advanced.
and about the other question:
Anything you would recommend on how to run the docker and how to stop it from within a python script?
An option could be to run a bash script from python. This bash script will contain the instructions to stop docker:
Thanks for your help. The main advantage of dbpdia/spotlight-databus is to download from the Databus repository the lastest version of DBpedia Spotlight model. The dbpedia/spotlight-english:databus was built with the latest available DBpedia Spotlight model version. The spotlight-databus image does not need to be updated to work with the latest DBpedia Spotlight model version, meanwhile, for the spotlight-english it could be needed to update the docker image after three or four months (only if the model change).