REST front-end

A REST API for Celery workers.

Any incoming request on the REST interface is passed on to the Celery distributed worker queue and any service workers listening on the corresponding queue should pick up the request message and initiate their task.

From a code separation perspective this module is in charge of defining the REST API and use others modules to do the actual job. It also plays the role of formatting any response that should be sent back in the proper format.

ServiceGateway.rest_api.annotate(service_route, storage_doc_id=None)[source]

POST a processing request through a form

In the POST multi-part form document upload there can be a field called payload which contents will be passed onto the worker itself.

Parameters:
  • storage_doc_id – The unique document ID of the file to transcode. If not provided, a doc_url parameter must be submitted in the request
  • service_route – Route name of the service e.g.: [‘diarisation’, ‘STT’, etc.]
Returns:

JSON object with the task uuid or error response.

ServiceGateway.rest_api.process(service_route, storage_doc_id=None)[source]

POST a JSON structure to the service Gateway which partial contents will be passed on to the service.

Optionnal keys are the following:

Parameters:
  • storage_doc_id – The unique document ID of the file to transcode which can be found on the associated MSS. If not provided, a doc_url parameter must be submitted in the request
  • doc_url – Document on which the processing will take place. Can be set to None if using the storage_doc_id argument or if there is no actual processing on a document.
  • options – Will be used as a sub-structure which will be integrally passed on to the processing worker.
ServiceGateway.rest_api.uuid_task_route(service_route, task)[source]

GET the status or cancel a task identified by a uuid.

Parameters:
  • task – status or cancel
  • service_route – Route name of the service e.g.: [‘diarisation’, ‘STT’, etc.]
Returns:

JSON object with latest status or error response.

Todo

Fold back this information in the Users’s guide or at least merge the two.

(The original entry is located in ../README.rst, line 84.)