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.
The parameters for
Sets a description for this job.
- priority (default: 100)
Sets a priority for this job. Higher number is higher priority. Jobs with higher priorities will be run first.
A job number. Usually set by Proc::JobQueue::startjob(). This can also be set by calling
The host this job will run on. Usually set by Proc::JobQueue::startjob(). This can also be set by calling
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.
A function callback that will be invoked only if the job fails.
- host, jobnum, queue
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,
Called to signal that the job has completed. If
$exit_codeis 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->startmorewill be invoked.
- addpostcb($callback, @args)
Add a callback to be called when the job completes.
$jobobject and the
@exit_codewill be added to the callback's arguments.
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
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.