FailureTest_conf.pm 4.55 KB
Newer Older
1 2 3 4
=pod

=head1 NAME

5
    Bio::EnsEMBL::Hive::PipeConfig::FailureTest_conf
6 7 8 9 10

=head1 SYNOPSIS

    init_pipeline.pl Bio::EnsEMBL::Hive::PipeConfig::FailureTest_conf -password <your_password>

11
    init_pipeline.pl FailureTest_conf.pm -host=localhost -password <your_password> -job_count 100 -failure_rate 3
12 13 14 15 16 17 18 19 20 21 22

=head1 DESCRIPTION

    This is an example pipeline built around FailureTest.pm RunnableDB. It consists of two analyses:

    Analysis_1: JobFactory.pm is used to create an array of jobs -

        these jobs are sent down the branch #2 into the second analysis

    Analysis_2: FailureTest.pm either succeeds or dies, depending on the parameters.

23 24
=head1 LICENSE

25
    Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
26 27 28 29 30 31 32 33 34 35

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software distributed under the License
    is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and limitations under the License.

36 37
=head1 CONTACT

38
    Please contact ehive-users@ebi.ac.uk mailing list with questions/suggestions.
39 40 41

=cut

42

43 44 45 46 47 48 49 50 51 52 53 54 55
package Bio::EnsEMBL::Hive::PipeConfig::FailureTest_conf;

use strict;
use warnings;

use base ('Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf');  # All Hive databases configuration files should inherit from HiveGeneric, directly or indirectly

=head2 default_options

    Description : Implements default_options() interface method of Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf that is used to initialize default options.
                  In addition to the standard things it defines three options:
                    o('job_count')          controls the total number of FailureTest jobs
                    o('failure_rate')       controls the rate of jobs that are programmed to fail
56 57
                    o('state')              controls the state in which the jobs will be failing
                    o('lethal_after')       when job_number is above this (nonzero) threshold, job's death becomes lethal to the Worker
58 59 60 61 62 63 64 65 66

                  There is a rule dependent on one option that does not have a default (this makes it mandatory):
                    o('password')           your read-write password for creation and maintenance of the hive database

=cut

sub default_options {
    my ($self) = @_;
    return {
67
        %{ $self->SUPER::default_options() },               # inherit other stuff from the base class
68 69 70

        'pipeline_name' => 'failure_test',                  # name used by the beekeeper to prefix job names on the farm

71 72 73
        'job_count'         => 20,                          # controls the total number of FailureTest jobs
        'failure_rate'      =>  3,                          # controls the rate of jobs that are programmed to fail
        'state'             => 'RUN',                       # controls in which state the jobs are programmed to fail
74
        'lethal_after'      => 0,
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
    };
}

=head2 pipeline_analyses

    Description : Implements pipeline_analyses() interface method of Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf that defines the structure of the pipeline: analyses, jobs, rules, etc.
                  Here it defines two analyses:

                    * 'generate_jobs'       generates a list of jobs

                    * 'failure_test'        either succeeds or fails, depending on parameters

=cut

sub pipeline_analyses {
    my ($self) = @_;
    return [
        {   -logic_name => 'generate_jobs',
            -module     => 'Bio::EnsEMBL::Hive::RunnableDB::JobFactory',
            -parameters => {
95
                'inputlist'    => '#expr([0..$job_count-1])expr#',    # this expression will evaluate into a listref
96
                'column_names' => [ 'value' ],
97 98
            },
            -input_ids => [
99
                { 'job_count'    => $self->o('job_count') },
100 101
            ],
            -flow_into => {
102
                2 => [ 'failure_test' ],
103 104 105 106 107
            },
        },

        {   -logic_name    => 'failure_test',
            -module        => 'Bio::EnsEMBL::Hive::RunnableDB::FailureTest',
108 109 110 111 112
            -parameters    => {
                'divisor'       => $self->o('failure_rate'),
                'state'         => $self->o('state'),
                'lethal_after'  => $self->o('lethal_after'),
            }
113 114 115 116 117 118
        },
    ];
}

1;