NAME

Proc::JobQueue::DependencyJob - job object for DependencyQueue's

SYNOPSIS

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)

DESCRIPTION

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.

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.

If the job is not done, then it needs to signal it's completion later by calling $job->finished(0) or $job->failure($reason).

CONSTRUCTION

These jobs require a dependency graph for construction.

METHODS

In addition to the methods in Proc::JobQueue::Job...

startup()

This is called by Proc::JobQueue::Job::start(). It calls the callback. The callback must return. The return value must be one of:

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->{dependency_graph}->remove_dependency($job);
job-keep,dep-done

The job is not done, but the dependency has been been fullfilled. The job can be marked done with:

$job->finished(0);

Or

$job->job_part_finished($do_startmore)
failed()

This overrides JobQueue::Job's failure() method to mark the dependency as stuck.

failure(@reason)

This marks this job as failed.

SEE ALSO

Proc::JobQueue::DependencyQueue Proc::JobQueue::Job Proc::JobQueue

LICENSE

This package may be used and redistributed under the terms of either the Artistic 2.0 or LGPL 2.1 license.