swift_too moduleSwift_QueryJob — Removed in swifttools 4.0swifttools 2.4Note: The
QueryJobclass and the concept of querying an existing job by job number have been removed inswifttools4.0. This page is retained for historical reference only.
QueryJob removed?The v1 API used an asynchronous job-queue model: requests were submitted and placed in a queue, assigned a jobnumber, and processed in the background. Callers had to poll the server repeatedly (using QueryJob) until the job status changed from Queued or Processing to Accepted or Rejected.
Starting with swifttools 4.0, the underlying API has been replaced by a synchronous RESTful interface (API v2). All requests — visibility queries, observation queries, TOO submissions, etc. — now return their results immediately in the HTTP response. There is no queue, no job number, and no need to poll for results.
If you have code that uses QueryJob, the simplest migration is to replace the queue() + polling loop with a direct submit() call on the original query object:
Old (swifttools < 4.0):
from swifttools.swift_too import QueryJob, VisQuery
from time import sleep
vq = VisQuery(name="Crab", hires=True, length=1)
vq.queue()
while True:
qj = QueryJob(jobnumber=vq.status.jobnumber)
if qj:
break
sleep(1)
result = qj.result
New (swifttools 4.0+):
from swifttools.swift_too import VisQuery
vq = VisQuery(name="Crab", hires=True, length=1)
vq.submit() # returns synchronously with results already populated
result = vq # the query object itself contains the results
All the same result data (visibility windows, timestamps, etc.) is available directly on the query object after submit() returns.