|Enrico Daga||Nov 18, 2011 6:45 am|
|Bertrand Delacretaz||Nov 18, 2011 7:22 am|
|Enrico Daga||Nov 21, 2011 1:43 am|
|Bertrand Delacretaz||Nov 24, 2011 2:48 am|
|Enrico Daga||Nov 24, 2011 3:22 am|
|Reto Bachmann-Gmür||Nov 24, 2011 6:13 am|
|Enrico Daga||Nov 24, 2011 6:28 am|
|Reto Bachmann-Gmür||Nov 24, 2011 11:56 am|
|Enrico Daga||Nov 24, 2011 12:59 pm|
|Reto Bachmann-Gmür||Nov 24, 2011 11:27 pm|
|Reto Bachmann-Gmür||Nov 25, 2011 11:43 am|
|Subject:||Reasoners jobs REST interface|
|From:||Enrico Daga (enri...@gmail.com)|
|Date:||Nov 18, 2011 6:45:27 am|
I am working on STANBOL-343 (Long term operations (Jobs) for reasoning services). The background work is almost complete, now I am going to better define the interface of the /reasoners/jobs service.
The process could be the following:
1) /reasoners/<service>/<task>/job A client send a request to a reasoning service, asking to execute it as a background job, for example:
curl http://localhost:8080/reasoners/owl/classify/job?url=<url to classify>
This service will return: - 302 Found. Job have been started. This will contain the HTTP header "Location: http://localhost:8080/reasoners/jobs/ping/JWUIiSjqZUtzmwCRqGgqeA" (last part is the job identifier) -> 2) - 400, 404, 500 (depends on the kind of error)
2) /reasoners/jobs/ping/<job id> The client goes to the ping service, which returns: - 204 No content. Job is still running, result is not ready to be consumed. - 302 Found. Job have been completed. This will contain HTTP header "Location: http://localhost:8080/reasoners/jobs/get/JWUIiSjqZUtzmwCRqGgqeA" -> 3) - 404 Job do not exists. - 500 Some error occurred.
3) /reasoners/jobs/get/<job id> The client goes to the get service, which behaves the same as GET/POST on real time requests (supports accept header, but POST+multipart here is not allowed) to obtain the response: - 200 OK. Process completed correctly, the content is consistent and if some content is produced it comes back to the client (task 'classify' or 'enrich') - 204 No content. Process completed correctly but data is not consistent - 404 The job does not exists or is not ready - 500 Some error occurred
I am not sure what will happen next. The background process, even complete, remains in memory and can be queried through the /get service more then 1 time. This could be handy, but some way of removing a completed job must exists. We could: 1) Delete the job when a first call to /get 200|204 is done 2) Prepare a service /clean/<job id> and /clean-all/ services for removal (I am for this option) (in the future we may want to support both ways, through configuration)
Another aspect is job interruption. We could setup a service /stop and /stop-all to force job stopping and cleaning.
If anybody have some feedback about this design I am happy to discuss.
-- Enrico Daga
-- http://www.enridaga.net skype: enri-pan