App-Prove-Plugin-Elasticsearch
view release on metacpan or search on metacpan
}
sub worker {
my ($conf, $worker_state, $jobspec, $q) = @_;
$worker_state->{MCE->wid()} = 1;
my $msg = "testd - worker " . MCE->wid() . ":";
$0 = "$msg starting up";
while (1) {
#check if every job is not busy, and if so, return so we can re-provision.
return 1 unless sum(values(%$worker_state));
$worker_state->{MCE->wid()} = 1;
$0 = "$msg looking for jobs";
my @jobs = $q->get_jobs($jobspec);
MCE->say("Found " . scalar(@jobs) . " jobs for worker " . MCE->wid());
if (!@jobs) {
$worker_state->{MCE->wid()} = 0;
$0 = "$msg waiting for jobs";
sleep $interval;
lib/App/Prove/Elasticsearch/Queue/Default.pm view on Meta::CPAN
=head2 new(%config_options)
Thin wrapper around App::Prove::Elasticsearch::Utils::process_configuration.
Subclasses likely will do more with this, such as advertise their availability to a queue.
=head1 METHODS
=head2 get_jobs
Gets the runner a selection of jobs that the queue thinks appropriate to our current configuration (if possible),
and that should keep it busy for a reasonable amount of time (see the granularity option).
The idea here is that clients will run get_jobs in a loop (likely using several workers) and run them until exhausted.
=head2 list_queues(%provision_options)
List the existing queues of jobs available.
=head2 queue_jobs
Stub method. Does nothing except in 'real' queue modules like Rabbit, etc.
lib/App/Prove/Elasticsearch/Queue/Rabbit.pm view on Meta::CPAN
=head2 queue_jobs
Takes the jobs produced by get_work_for_plan() in the parent, and queues them in your configured rabbit server
Returns the number of jobs that failed to queue.
=head2 get_jobs
Gets the runner a selection of jobs that the queue thinks appropriate to our current configuration (if possible),
and that should keep it busy for a reasonable amount of time.
The idea here is that clients will run get_jobs in a loop (likely using several workers) and run them until exhausted.
The queue will be considered exhausted if this returns undef.
=head1 AUTHOR
George S. Baugh <teodesian@cpan.org>
=head1 SOURCE
( run in 0.435 second using v1.01-cache-2.11-cpan-87723dcf8b7 )