How to use queueing
  • 10 Jun 2020
  • 1 Minute To Read
  • Print
  • Share
  • Dark
    Light

How to use queueing

  • Print
  • Share
  • Dark
    Light

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:

Send query

  • 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

Get status for all jobs

  • Method: GET
  • Endpoint: /api/v1/jobs/
  • Body: None
  • Result: Job ID, expiresAt, startedAt, finishedAt and path

Get status for a job

  • Method: GET
  • Endpoint: /api/v1/jobs/your-job-id
  • Body: None
  • Result: List of job ID, expiresAt, startedAt, finishedAt and path

Get result

  • 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.

Was This Article Helpful?