File Coverage

blib/lib/Helios/MetajobBurstService.pm
Criterion Covered Total %
statement 11 17 64.7
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 16 25 64.0


line stmt bran cond sub pod time code
1             package Helios::MetajobBurstService;
2              
3 1     1   902 use 5.008000;
  1         2  
4 1     1   4 use base qw( Helios::Service );
  1         1  
  1         74  
5 1     1   4 use strict;
  1         1  
  1         16  
6 1     1   4 use warnings;
  1         1  
  1         96  
7              
8             our $VERSION = '2.83';
9              
10             # CHANGE HISTORY:
11             # [LH] [2015-08-14]: Changed all CRLF endings to Unix-style LF endings.
12              
13             =head1 NAME
14              
15             Helios::MetajobBurstService - base class for metajob burst services in Helios
16              
17             =head1 DESCRIPTION
18              
19             Helios::MetajobBurstService is a subclass of Helios::Service specially tasked with bursting
20             metajobs. You can subclass this class to provide special metajob bursters for your application.
21             This allows you more fine grained control over the volume of jobs entering the Helios job queue.
22              
23             A MetajobBurstService class supports one config parameter, burst_interval, which is the
24             number of seconds between metajob bursts. This is to prevent the metajob bursting process from
25             running so fast the Helios job queue is overwhelmed with burst jobs.
26              
27             =cut
28              
29             =head1
30              
31             =cut
32              
33             sub burstJob {
34 0     0 1   my $self = shift;
35 0           my $config = $self->getConfig();
36 0           my $jobnumber = $self->SUPER::burstJob(@_);
37 0 0         if ( defined($config->{burst_interval}) ) {
38 0           sleep $config->{burst_interval};
39             }
40 0           return $jobnumber;
41             }
42              
43              
44             1;
45             __END__