How to use queueing
- Updated On 10 Jun 2020
- 1 Minute To Read
-
Print
-
DarkLight
When queries take time
The timeout for the regular Aito endpoints (predict, match, similarity, query, recommend, search, relate and evaluate) is 30 seconds due to security reasons. To circumvent this we have released the jobs endpoint which you can use for all of the regular endpoints, though the only endpoint where queries should last for longer than 30 seconds is the evaluate endpoint. If youโre running into this problem with the other endpoints, please contact us in Aito Slack.
The use of jobs endpoint is quite simple. Just add jobs into your endpoint path, the body will remain the same as in the regular endpoint. So for example instead of using the path /api/v1/_evaluate
use /api/v1/jobs/_evaluate
, simple as that.
After creating the job, it will go to a queue and the request will return you the ID of the job you can then use to check its status or get the results. You can also use the jobs endpoint to return all of the jobs currently available. Please note that the results of the jobs are not available forever but they have a defined lifespan. You can get the lifespan from the โexpiresAtโ parameter which is returned when asking for the job status.
Usage of the jobs endpoint:
- Method: POST
- Endpoint: /api/v1/jobs/your-query-endpoint
- Body: The same as used for the normal query endpoint
- Result: Job ID, startedAt and path
- Method: GET
- Endpoint: /api/v1/jobs/
- Body: None
- Result: Job ID, expiresAt, startedAt, finishedAt and path
- Method: GET
- Endpoint: /api/v1/jobs/your-job-id
- Body: None
- Result: List of job ID, expiresAt, startedAt, finishedAt and path
- Method: GET
- Endpoint: /api/v1/jobs/your-job-id/result
- Body: None
- Result: The same as from the normal query endpoint
Documentation for the jobs endpoint can also be found from our API docs.