NAME

Proc::JobQueue::EventQueue - JobQueue combined with IO::Event

SYNOPSIS

 use Proc::JobQueue::EventQueue;
 use Proc::JobQueue::DependencyTask;
 use Proc::JobQueue::DependencyJob;

 my $queue = Proc::JobQueue::EventQueue->new(
	hold_all => 1,
 );

 my $job = Proc::JobQueue::DependencyJob->new($queue, $callback_func);

 my $task => Proc::JobQueue::DependencyTask->new(desc => $desc, func => $callback_func);

 $dependency_graph->add($job);
 $dependency_graph->add($task);

 $job_queue->hold(0);

 $queue->startmore();

 IO::Event::loop();

 IO::Event::unloop_all() if $queue->alldone;

DESCRIPTION

This module is a sublcass of Proc::JobQueue. It combines the job queue with IO::Event for an asynchronous event loop. IO::Event can use a select loop from Event, AnyEvent or its own.

The jobs that it runs are either full-fledged jobs, Proc::JobQueue::DependencyJob, or simple synchronous one-shot perl callbacks that execute as soon as their prerequisites are met: Proc::JobQueue::DependencyTask.

Generally, the way to use this is to generate your dependency graph, then create your job queue, then start some jobs.

API

In addition to the parameters supported by Proc::JobQueue, the following construction parameters are used:

unloop

Code REF. If provided, invoke it to when the job queue is empty instead of calling IO::Event::unloop_all().

on_failure

Code REF. If provided, override the default behavior of how to handle the failure of a job. See the code for details.

LICENSE

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.