App-Prove-Plugin-Elasticsearch

 view release on metacpan or  search on metacpan

lib/App/Prove/Elasticsearch/Queue/Default.pm  view on Meta::CPAN


    #OK, now I have a list of potential platforms I can ask whether they exist
    foreach my $gambit (@plots) {
        $jobspec{platforms} = $gambit;
        $plans = &{\&{$self->{planner} . "::get_plans_needing_work"}}(%jobspec);
        return @$plans if (ref($plans) eq 'ARRAY') && @$plans;
    }
    return ();
}

sub queue_jobs {
    print "Queued local job.\n";
    return 0;
}

sub build_queue_name {
    my ($self, $jobspec) = @_;
    my $name = $jobspec->{version};
    $name .= join('', @{$jobspec->{platforms}});
    return $name;
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

App::Prove::Elasticsearch::Queue::Default; - Coordinate the running of test plans across multiple forks.

=head1 VERSION

version 0.001

=head1 SUMMARY

Grabs a random selection of tests from a provided test plan, and executes them.

=head1 CONFIGURATION

Accepts a granularity option in the [Queue] section of elastest.conf controlling how many tests you want to grab at a time.
If the value is not set, we default to running everything available for our configuration.
You can use this to (minimize) duplicate work done when using multiple workers of the same configuration.

=head1 CONSTRUCTOR

=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.

Called in bin/testplan to add jobs to our queue at plan creation.
Should return the number of jobs that failed to queue.

=head2 build_queue_name

Builds a queue_name inside a passed job specification hashref containing version and platforms information.

Here mostly in case you need to override this for your queueing solution.

=head1 AUTHOR

George S. Baugh <teodesian@cpan.org>

=head1 SOURCE

The development version is on github at L<http://https://github.com/teodesian/App-Prove-Elasticsearch>
and may be cloned from L<git://https://github.com/teodesian/App-Prove-Elasticsearch.git>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by George S. Baugh.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 0.727 second using v1.01-cache-2.11-cpan-39bf76dae61 )