Proc::JobQueue::Job - The $job objects for Proc::JobQueue
$job = Proc::JobQueue::Job->new(%params) $job->can_command() $job->can_callback() $job->start() $job->host($host) $job->host() $job->jobnum($jobnum) $job->jobnum() $job->queue($queue) $job->queue() $job->runnable() $job->finished() $job->success() $job->addpostcb()
This is the base class for the $job objects used by This class is designed to be overloaded. For user APIs, see the "SEE ALSO" section.
$job
The parameters for new() are:
new()
Sets a description for this job.
Sets a priority for this job. Higher number is higher priority. Jobs with higher priorities will be run first.
A Proc::JobQueue object, used for calling $queue->jobdone(). Usually set by Proc::JobQueue::startjob(). This can also be set by calling queue($queue).
$queue->jobdone()
queue($queue)
A job number. Usually set by Proc::JobQueue::startjob(). This can also be set by calling jobnum($jobnum).
jobnum($jobnum)
The host this job will run on. Usually set by Proc::JobQueue::startjob(). This can also be set by calling jobnum($jobnum).
A function callback to generate a unix command for this job.
A function callback that is this job. The callback will be called when the job should run. The job will be passed as the argument to the callback.
$job->callback($job).
A function callback that will be invoked only if the job fails.
$on_failure->($job, @exit_code)
Get or set (if provided with a defined parameter) the host, jobnum, or queue parameter for the job.
Checks to see if the job is still running. This only really works with jobs which are unix commands. If the job is done, checkjob() will invoke finished().
checkjob()
finished()
Called to signal that the job has completed. If $exit_code[0] is true, then the job is considered to have failed and failed() will be invoked. Otherwise, sucess() will be called. In either case the post callback (if any), $queue->jobdone and $queue->startmore will be invoked.
$exit_code[0]
failed()
sucess()
$queue->jobdone
$queue->startmore
Add a callback to be called when the job completes.
The $job object and the @exit_code will be added to the callback's arguments.
@exit_code
If you are subclassing Job then you may want to define these:
If defined, then a call to this method is what is used to start the job running.
Called when the job succeeds. Doesn't do anything -- it's a hook to override.
Called when the job fails. Invokes the on_failure action if there is one.
Returns true if the job is runnable at this time.
A return value of undef indicates the job is still running. A defined value is the exit code for the job.
Starts this job. This is usually called by Proc::JobQueue::startjob().
Proc::JobQueue::startjob()
Proc::JobQueue Proc::JobQueue::DependencyJob Proc::JobQueue::RemoteDependencyJob Proc::JobQueue::Command Proc::JobQueue::Sort Proc::JobQueue::Move Proc::JobQueue::Sequence
Copyright (C) 2007-2008 SearchMe, Inc. Copyright (C) 2008-2010 David Sharnoff. Copyright (C) 2011 Google, Inc. This package may be used and redistributed under the terms of either the Artistic 2.0 or LGPL 2.1 license.
To install Proc::JobQueue, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Proc::JobQueue
CPAN shell
perl -MCPAN -e shell install Proc::JobQueue
For more information on module installation, please visit the detailed CPAN module installation guide.