astroquery
astroquery copied to clipboard
Astrometry.net solvers should return the jobid
Currently, both solvers call monitor_submission before returning. This has for consequence that the only way to obtain the jobid, which is required to download the result files from the server, is to force a TimeoutError.
This leads to code that is hard to read and potentially unreliable if the solve is particularly fast.
For example, here is a code sample adapted from the documentation:
submission_id = None
while True:
try:
if not submission_id:
wcs_header = ast.solve_from_image('/path/to/image.fit', solve_timeout=1)
else:
wcs_header = ast.monitor_submission(submission_id, solve_timeout=120)
except TimeoutError as e:
submission_id = e.args[1]
else:
break
I propose that the solvers directly return the jobid and let the user call the monitor_submission method themselves. Here is the same code with the proposed change:
submission_id = ast.solve_from_image('/path/to/image.fit')
while True:
try:
wcs_header = ast.monitor_submission(submission_id, solve_timeout=120)
except TimeoutError as e:
continue
else:
break