dstndstn / astrometry.net

Astrometry.net -- automatic recognition of astronomical images
http://astrometry.net
Other
650 stars 184 forks source link

processing_finished filled with value but jobs has null in the array #274

Open marcellobarile opened 11 months ago

marcellobarile commented 11 months ago

Hi, I'm trying to consume the API but, every now and then, I get this kind of response:

{
  user: 44337,
  processing_started: '2023-08-16 06:26:46.267010',
  processing_finished: '2023-08-16 06:26:48.392812',
  user_images: [ 8467187 ],
  images: [ 19718372 ],
  jobs: [ null ],
  job_calibrations: []
}

I find it confusing because of the null value in the jobs array. Isn't it supposed to be empty? Also note that the same image returns a valid response every now and then, eg:

{
  user: 44337,
  processing_started: '2023-08-15 17:04:13.573082',
  processing_finished: '2023-08-15 17:04:18.321569',
  user_images: [ 8464685 ],
  images: [ 19718372 ],
  jobs: [ 9035968 ],
  job_calibrations: [ [ 9035968, 6861327 ] ]
}

Is there something that I'm missing?

marcellobarile commented 11 months ago

could it be that processing_finished gets valued even though the job hasn't started yet?

marcellobarile commented 11 months ago

I ended up polling the service until I don't get a result that has jobs without null and job_calibrations, with a maximum number of requests to not clog the API with an infinite loop, and a delay of 2,5 seconds between the retries.

I'm not sure if this is the proper way to do it, btw I would expect that processing_finished gets valued only when the whole process is done (meaning that all jobs are done).

And maybe a status field, in case something goes wrong during the process.