Why not adopt me?This distribution is up for adoption! If you're interested then please contact the PAUSE module admins via email.
Proc::JobQueue::DependencyJob - dependency-aware job object for Proc::JobQueue
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->jobdone(); $job->failure(@exit_code)
DependencyJob jobs are perl objects with a callback API.
$job->startup() is called to start the job. That in turn calls, the callback provided in construction. The
$job object is added to the argument list for the callback.
The return value from the callback lets
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.
If the job is not done, then it needs to signal it's completion later by calling
These jobs require a dependency graph for construction. The
%params parameter represents additional parameters passed to Proc::JobQueue::Job.
In addition to the methods in Proc::JobQueue::Job, DependencyJob provides:
This is called by
Proc::JobQueue::Job::start(). It calls the callback. The callback must return. A reference to self (
$job) is provided as an argument to the callback. The return value from the callback must be a string from the following set:
The job has completed and the dependency in the dependency graph should be removed.
The job has not completed and the dependency in the dependency graph should be kept.
The job can be marked as done with:
The dependency can be marked as completed with:
Or both the job and the dependency can be marked as done/completed with one call:
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:
The job is not done, but the dependency has been been fullfilled. The job can be marked done with:
Things which depend on this job are eligible to be started.
This overrides JobQueue::Job's failure() method to mark the dependency as stuck.
This marks this job as failed.
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.