floq.client.jobs_queue

This module provides interface for managing pending jobs queue.

class floq.client.jobs_queue.JobsQueueManager(client: floq.client.api_client.ApiClient, handler: floq.client.sse.EventStreamHandler)

Bases: object

Manages jobs queue.

The Floq service does not handle the flush queue request immediately, but schedules it for execution and starts emitting events along with run progress. Thus, when calling the flush method the manager sends the request to the service and opens an event stream connection. Every time a new message is received, the on_jobs_queue_flushed() callback method is called and prints an output message once the execution is done.

flush() None

Clears jobs queue.

This is asynchronous task, the server will emit execution progress via events stream.

get() floq.client.schemas.JobsQueue

Gets jobs queue.

Returns

JobsQueue object.

get_pending_job(job_id: uuid.UUID) floq.client.schemas.PendingJob

Gets pending job details.

Parameters

job_id – Unique job id.

Returns

PendingJob object.

on_jobs_queue_flushed(event: floq.client.schemas.TaskStatusEvent, _context: Optional[Any]) None

Callback function triggered after receiving a flush jobs queue progress event.

Parameters
  • event – Received event.

  • context – Optional user context data passed together with the event.

print_pending_jobs() None

Prints pending jobs.