Query Task Status

The JobStatusChecker is designed to monitor the status of asynchronous jobs through a WebSocket connection.

circle-info

The status channel is based on Socket.IO instead of standard WebSocket.

Workflow

  1. Initialization: Establish a WebSocket connection to the server using the base_url and subscription_key.

  2. Request Handling:

    • On a successful connection, initiate status queries with the specified job with its uuid.

  3. Status Monitoring:

    • Periodically send status queries to the server, we recommend submitting queries at 2-second intervals.

    • Listen for responses from the server and update the job status accordingly.

    • If the job is completed successfully, perform necessary cleanup actions such as closing the connection.

API Endpoint

Socket /api/scheduler_socket

Queries

Name
Value

subscription

subscripton_key

Sending a Query

To query the status of a job, send a message to the scheduler socket endpoint with the job's UUID:

// Establish connection with the scheduler socket
const socket = io('/api/scheduler_socket?subscription={subscripton_key}');

// Send a query for the job status
socket.emit('query', '{job_uuid}');

Receiving a Response

The server responds with the status of the job, including details such as the job's UUID, status, and any relevant metrics.

While the specific implementation can vary, the core functionality typically involves:

  • A WebSocket client that handles the lifecycle of the connection and communication.

  • Event handlers that react to changes in the connection status and incoming messages.

  • A mechanism to periodically send requests to the server to check the status of the job.

Examples

Last updated