BullMQ
Search
K

Getters

When jobs are added to a queue, they will be in different statuses during their lifetime. BullMQ provides methods to retrieve information and jobs from the different statuses.
Lifecycle of a job

Job Counts

It is often necessary to know how many jobs are in a given status:
TypeScript
Python
import { Queue } from 'bullmq';
const myQueue = new Queue('Paint');
const counts = await myQueue.getJobCounts('wait', 'completed', 'failed');
// Returns an object like this { wait: number, completed: number, failed: number }
from bullmq import Queue
myQueue = Queue('Paint')
counts = await myQueue.getJobCounts('wait', 'completed', 'failed')
# Returns an object like this { wait: number, completed: number, failed: number }
The available status are:
  • completed,
  • failed,
  • delayed,
  • active,
  • wait,
  • waiting-children,
  • prioritized,
  • paused, and
  • repeat.

Get Jobs

It is also possible to retrieve the jobs with pagination style semantics. For example:
TypeScript
Python
const completed = await myQueue.getJobs(['completed'], 0, 100, true);
// returns the oldest 100 jobs
completed = await myQueue.getJobs(['completed'], 0, 100, True)
# returns the oldest 100 jobs

Read more:

Copyright (c) Taskforce.sh Inc.