Swift TOO API
Swift MOC

swift_too module

Swift_QueryJob — Removed in swifttools 4.0

Previously: API version 1.2 / swifttools 2.4

Author: Jamie A. Kennea (Penn State)

Note: The QueryJob class and the concept of querying an existing job by job number have been removed in swifttools 4.0. This page is retained for historical reference only.

Why was 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.

Migrating existing code

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.

Swift Mission Operations Center

The Pennsylvania State University
301 Science Park Road,
Building 2 Suite 332,
State College, PA 16801
USA
☎ +1 (814) 865-6834
📧 swiftods@swift.psu.edu

Swift MOC Team Leads

Mission Director: John Nousek
Science Operations: Jamie Kennea
Flight Operations: Mark Hilliard
UVOT: Michael Siegel
XRT: Jamie Kennea