NAME
App::Netdisco::JobQueue
DESCRIPTION
Interface for Netdisco job queue.
There are no default exports, however the :all
tag will export all subroutines.
EXPORT_OK
jq_getsome( $num? )
Returns a list of randomly selected queued jobs. Default is to return one job, unless $num
is provided. Jobs are returned as objects which implement the Netdisco job instance interface (see below).
jq_locked()
Returns the list of jobs currently booked out to this processing node (denoted by the local hostname). Jobs are returned as objects which implement the Netdisco job instance interface (see below).
jq_queued( $job_type )
Returns a list of IP addresses of devices which currently have a job of the given $job_type
queued (e.g. discover
, arpnip
, etc).
jq_log()
Returns a list of the most recent 50 jobs in the queue. Jobs are returned as objects which implement the Netdisco job instance interface (see below).
jq_userlog( $user )
Returns a list of jobs which have been entered into the queue by the passed $user
. Jobs are returned as objects which implement the Netdisco job instance interface (see below).
jq_take( $wid, $type, $max? )
Searches in the queue for jobs of type $type
and if up to $max
are available, will book them out to the worker with ID $wid
. The default number of booked jobs is 1.
jq_lock( $job )
Marks a job in the queue as booked out to this processing node (denoted by the local hostname). The $job
parameter must be an object which implements the Netdisco job instance interface (see below).
Returns true if successful else returns false.
jq_defer( $job )
Marks a job in the queue as available for taking. This is usually done after a job is booked but the processing node changes its mind and decides to return the job to the queue. The $job
parameter must be an object which implements the Netdisco job instance interface (see below).
Returns true if successful else returns false.
jq_complete( $job )
Marks a job as complete. The $job
parameter must be an object which implements the Netdisco job instance interface (see below). The queue item's status, log and finished fields will be updated from the passed $job
.
Returns true if successful else returns false.
jq_insert( \%job | [ \%job, \%job ...] )
Adds the passed jobs to the queue.
jq_delete( $id? )
If passed the ID of a job, deletes it from the queue. Otherwise deletes ALL jobs from the queue.