Skip to content

Job Status

Grant Carthew edited this page Aug 16, 2016 · 12 revisions

Description

During the life cycle of a job it can have it status changed a number of times. This document will give you a better understanding of the job status values and when they get assigned.

Status Description
created After creating the job
added After being added to the queue
active Whilst the job is being processed
completed When the job has been processed successfully
failed When the job has failed being processed
terminated When a job has failed and will not be retried

Job created Status

Before you can process jobs with the Queue object you need to create jobs. Jobs get created by calling the Queue.createJob method. A newly created job will have a status of created and does not exist in the queue database table. The created status is used to prevent invalid queue function calls prior to the job being added to the queue.

Once you have added data to your new job, add it to the queue using Queue.addJob. After the job is added to the queue the created job status will no longer be assigned to this job.

Job added Status

After calling Queue.addJob the job status in the database will be set to added. A job should not stay at this status for long because it is ready for processing. As soon as a Queue object with a Queue.process handler function is available to process the job it will get assigned the active status.

Once a job gets picked up for processing the added status will no longer be assigned to this job.

Job active Status

A job gets a status of active when it is picked up by a Queue object enabled for processing jobs. If you do not add a job handling function to your Queue objects using Queue.process they will never process jobs. Once a Queue object has a handling function assigned, it will query the queue database for the next pool of jobs and they will all be assigned an active status.

The active status can be assigned to a job a number of times if it fails processing and is available to retry processing. See the Job Retry document for more detail.

Job completed Status

On the successful completion of job processing, jobs will be updated to have a completed status. This is the desired state of all jobs added to the queue. Depending on the removeFinishedJobs Queue option a completed job may be removed from the queue database table.

The completed job status is the end game for any jobs. Not all jobs will make it this far.

Job failed Status

Main

How It Works

Contributing

API

Queue Methods

Queue Properties

Queue Events

Job Methods

Job Properties

Documentation

Clone this wiki locally