To successfully run a job in aiWARE, you must first get a token. Then, using the REST API, you can create the job, poll the job's status, and get the job's results.
Before you begin
To access any aiWARE API, you must first Get a token.
Steps
(Optional) Select an engine. If you don't already know the engines you want to use as part of your job, you can get all available engines and review them.
To get a list of all engines, use the AI Processing REST API by making a GET request to /admin/engines. This returns a list of the available engines on a given instance of AI Processing.
The response is a JSON array that includes three key-value pairs:
The category ID of the engine(transcription, translation, etc.)
The input file is not uploaded but is specified via a URL (in a serialized payload object). The fields containing "UUID___" must include a unique identifier in the form of a UUID. You can use any UUID-generation library to generate these values.
Poll the job for status.
You can review the status of the job you created by polling it for status. The possible statuses of a job are:
Pending - The job definition has been validated, the job is created, and it's waiting to be picked up from an AI Processing node.
Complete - The job is complete and the job results are now available.
Running - The job is currently in progress and has at least one task being executed.
Canceled - The job has been canceled and will not be completed. SeeCanceling jobs for more information.
Queued - The job has been selected by an AI Processing node and is awaiting available resources for execution.
Failed - An error occurred and the job has failed. Errors occur at the individual task level, but you can retry the failed job once any error has been addressed.
You can poll a job status by sending a GET request to /proc/job/<_YOUR_JOB_ID>/outputs with the InternalJobId. You can periodically make GET requests until a JSON file is returned in the name key of the outputs array of the API response:
Once the job is completed, you can download the engine results by passing the InternalJobId and name from when you polled the job's status, as shown in the curl sample below.
curl --request GET \
--url http://localhost:9000/edge/v1/proc/job/<job id here>/output/<file name here>.json \
--header 'authorization: Bearer <_TOKEN_>'