AsyncJob
When do I need this? Most queries return in a few seconds and you will
never touch this class. Use it when a query is large enough (multi-year pulls,
very wide cone searches) that the synchronous TAP endpoint would time out before
returning. In that case, call submit_async() on an archive object instead of
a query_* method; it hands you back an AsyncJob handle immediately. You can
then poll job.phase, call job.wait() to block until the server finishes, and
collect the full astropy.table.Table with job.result(). See the
async example in Quickstart.
- class nexsci_rv.async_job.AsyncJob(status_url, session, *, output_format='votable', conf=None)
Bases:
objectHandle to an IVOA async TAP job.
- Parameters:
status_url (str) – Full URL of the job’s status resource (returned by the TAP server on submit).
session (requests.Session) – HTTP session to use for polling and result fetches; supplied by the originating
Archive.output_format (OutputFormat) – Format requested when the job was submitted; needed to parse
result()correctly.conf (Conf | None) – Process configuration.
- property phase: Literal['pending', 'queued', 'executing', 'completed', 'error', 'aborted']
Current phase as last seen by
refresh().
- property times: dict[str, datetime]
Map of
startTime/endTime/destruction/executionDuration.Only the keys present in the server’s UWS response are populated.
- refresh()
Poll the status URL once and update local state.
- Return type:
None
- wait(*, timeout=None, poll_interval=5.0)
Block until the job reaches a terminal phase or
timeoutelapses.- Raises:
TimeoutError – if
timeoutis exceeded before a terminal phase.AsyncJobError – if the job ends in
errororaborted.
- Parameters:
- Return type:
None
- abort()
Request that the server abort the job.
- Return type:
None