ensembl-hive  2.7.0
FailureTest_conf.pm
Go to the documentation of this file.
1 =pod
2 
3 =head1 NAME
4 
6 
7 =head1 SYNOPSIS
8 
9  init_pipeline.pl Bio::EnsEMBL::Hive::Examples::FailureTest::PipeConfig::FailureTest_conf -password <your_password>
10 
11  init_pipeline.pl FailureTest_conf.pm -host=localhost -password <your_password> -job_count 100 -failure_rate 3
12 
13 =head1 DESCRIPTION
14 
15  This is an example pipeline built around FailureTest.pm RunnableDB. It consists of two analyses:
16 
17  Analysis_1: JobFactory.pm is used to create an array of jobs -
18 
19  these jobs are sent down the branch #2 into the second analysis
20 
21  Analysis_2: FailureTest.pm either succeeds or dies, depending on the parameters.
22 
23 =head1 LICENSE
24 
25  See the NOTICE file distributed with this work for additional information
26  regarding copyright ownership.
27 
28  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
29  You may obtain a copy of the License at
30 
31  http://www.apache.org/licenses/LICENSE-2.0
32 
33  Unless required by applicable law or agreed to in writing, software distributed under the License
34  is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35  See the License for the specific language governing permissions and limitations under the License.
36 
37 =head1 CONTACT
38 
39  Please subscribe to the Hive mailing list: http://listserver.ebi.ac.uk/mailman/listinfo/ehive-users to discuss Hive-related questions or to be notified of our updates
40 
41 =cut
42 
43 
44 package Bio::EnsEMBL::Hive::Examples::FailureTest::PipeConfig::FailureTest_conf;
45 
46 use strict;
47 use warnings;
48 
49 use base ('Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf'); # All Hive databases configuration files should inherit from HiveGeneric, directly or indirectly
50 
51 =head2 default_options
52 
53  Description : Implements default_options() interface method of Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf that is used to initialize default options.
54  In addition to the standard things it defines three options:
55  o('job_count') controls the total number of FailureTest jobs
56  o('failure_rate') controls the rate of jobs that are programmed to fail
57  o('state') controls the state in which the jobs will be failing
58  o('lethal_after') when job_number is above this (nonzero) threshold, job's death becomes lethal to the Worker
59 
60  There is a rule dependent on one option that does not have a default (this makes it mandatory):
61  o('password') your read-write password for creation and maintenance of the hive database
62 
63 =cut
64 
65 sub default_options {
66  my ($self) = @_;
67  return {
68  %{ $self->SUPER::default_options() }, # inherit other stuff from the base class
69 
70  'job_count' => 10, # controls the total number of FailureTest jobs
71  'failure_rate' => 3, # controls the rate of jobs that are programmed to fail
72  'state' => 'RUN', # controls in which state the jobs are programmed to fail
73  'lethal_after' => 0,
74  };
75 }
76 
77 =head2 pipeline_analyses
78 
79  Description : Implements pipeline_analyses() interface method of Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf that defines the structure of the pipeline: analyses, jobs, rules, etc.
80  Here it defines two analyses:
81 
82  * 'generate_jobs' generates a list of jobs
83 
84  * 'failure_test' either succeeds or fails, depending on parameters
85 
86 =cut
87 
88 sub pipeline_analyses {
89  my ($self) = @_;
90  return [
91  { -logic_name => 'generate_jobs',
92  -module => 'Bio::EnsEMBL::Hive::RunnableDB::JobFactory',
93  -parameters => {
94  'inputlist' => '#expr([0..#job_count#-1])expr#', # this expression will evaluate into a listref
95  'column_names' => [ 'value' ],
96  },
97  -input_ids => [
98  { 'job_count' => $self->o('job_count') },
99  ],
100  -flow_into => {
101  '2->A' => [ 'failure_test' ],
102  'A->1' => [ 'funnel' ],
103  },
104  },
105 
106  { -logic_name => 'failure_test',
107  -module => 'Bio::EnsEMBL::Hive::Examples::FailureTest::RunnableDB::FailureTest',
108  -parameters => {
109  'divisor' => $self->o('failure_rate'),
110  'state' => $self->o('state'),
111  'lethal_after' => $self->o('lethal_after'),
112  }
113  },
114 
115  { -logic_name => 'funnel',
116  -module => 'Bio::EnsEMBL::Hive::RunnableDB::Dummy',
117  },
118  ];
119 }
120 
121 1;
122 
Bio::EnsEMBL::Hive::Version
Definition: Version.pm:19
Bio::EnsEMBL::Hive::Worker
Definition: Worker.pm:53
Bio::EnsEMBL::Hive
Definition: Hive.pm:38
Bio::EnsEMBL::Hive::Examples::FailureTest::PipeConfig::FailureTest_conf
Definition: FailureTest_conf.pm:26
Bio
Definition: AltAlleleGroup.pm:4