Proc::JobQueue::DependencyJob - job object for DependencyQueue's
use Proc::JobQueue::DependencyJob; use Object::Dependency; $graph = Object::Dependency->new() $job = Proc::JobQueue::DependencyJob->new($graph, $callback_func, %params); $job->startup() $job->job_part_finished() $job->failure(@exit_code)
Proc::JobQueue::DependencyJob is a subclass of Proc::JobQueue::Job for use with Proc::JobQueue::DependencyQueue.
DependencyJob jobs are perl callbacks. $job->startup() is called to start the job. That in turn calls, the callback. The $job object is added to the argument list for the callback.
$job->startup()
$job
The return value from the callback let's startup() know what to do next: the job is finished; the job finished but it remains a dependency in the dependency graph; the job is not done but it should be removed from the dependency graph; or the job is not done and should remain in the dependency graph.
startup()
If the job is not done, then it needs to signal it's completion later by calling $job->finished(0) or $job->failure($reason).
$job->finished(0)
$job->failure($reason)
These jobs require a dependency graph for construction.
In addition to the methods in Proc::JobQueue::Job...
This is called by Proc::JobQueue::Job::start(). It calls the callback. The callback must return. The return value must be one of:
Proc::JobQueue::Job::start()
all-done
The job has completed and the dependency in the dependency graph should be removed.
all-keep
The job has not completed and the dependency in the dependency graph should be completed.
The job can be marked as done with:
$job->job_part_finished($do_startmore)
The dependency can be marked as completed with:
$job->{dependency_graph}->remove_dependency($job);
Or both the job and the dependency can be marked as done/completed:
$job->finished(0);
job-done,dep-keep
The job has completed, but it should not be removed from the dependency graph. Somehow the callback must arrange that the dependency graph dependency gets removed later:
job-keep,dep-done
The job is not done, but the dependency has been been fullfilled. The job can be marked done with:
Or
This overrides JobQueue::Job's failure() method to mark the dependency as stuck.
This marks this job as failed.
Proc::JobQueue::DependencyQueue Proc::JobQueue::Job Proc::JobQueue
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.