ensembl-hive  2.7.0
LongMultWfClient_conf.pm
Go to the documentation of this file.
1 =pod
2 
3 =head1 NAME
4 
6 
7 =head1 SYNOPSIS
8 
9  # initialize the "server" database first and note its URL - you will need it to initialize the "client" later:
11 
12  # initialize the "client" database by plugging the server's URL:
13  init_pipeline.pl Bio::EnsEMBL::Hive::Examples::LongMult::PipeConfig::LongMultWfClient_conf -password <mypass> -server_url $SERVER_HIVE_URL
14 
15  # optionally also seed it with your specific values:
16  seed_pipeline.pl -url $CLIENT_HIVE_URL -logic_name take_b_apart -input_id '{ "a_multiplier" => "12345678", "b_multiplier" => "3359559666" }'
17 
18  # run the "server" (it will have to be stopped manually when the "client" is done):
19  beekeeper.pl -url $SERVER_HIVE_URL -keep_alive
20 
21  # run the "client" (it will exit by itself):
22  beekeeper.pl -url $CLIENT_HIVE_URL -loop
23 
24 =head1 DESCRIPTION
25 
26  This is the "client" PipeConfig file of a special two-part version of the long multiplication example pipeline.
27  Please make sure you FULLY understand how the LongMult_conf works before trying this one.
28 
29  We have split the original LongMult_conf into two parts, the "client" and the "server" that can be used to initialize
30  two separate Hive pipeline databases.
31 
32  The "client" kept 'take_apart' and 'add_together' analyses and the 'final_result' table, but the 'part_multpily' analysis
33  has been outsourced into the "server" which also maintains its local 'intermediate_result' table.
34 
35  There are 3 links between the pipelines, all established from the "client" side (the "server" doesn't know about them) :
36  1. The "client" seeds the "server" via a cross-database dataflow rule ('take_b_apart'#2 -> 'part_multiply)
37  2. The "client" waits for the 'part_multiply' analysis to complete on the "server" via an analysis_ctrl_rule
38  3. The "client" reads the data from the 'intermediate_result' table of the "server"
39 
40 =head1 LICENSE
41 
42  See the NOTICE file distributed with this work for additional information
43  regarding copyright ownership.
44 
45  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
46  You may obtain a copy of the License at
47 
48  http://www.apache.org/licenses/LICENSE-2.0
49 
50  Unless required by applicable law or agreed to in writing, software distributed under the License
51  is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52  See the License for the specific language governing permissions and limitations under the License.
53 
54 =head1 CONTACT
55 
56  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
57 
58 =cut
59 
60 
61 package Bio::EnsEMBL::Hive::Examples::LongMult::PipeConfig::LongMultWfClient_conf;
62 
63 use strict;
64 use warnings;
65 
66 use base ('Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf'); # All Hive databases configuration files should inherit from HiveGeneric, directly or indirectly
67 use Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf; # Allow this particular config to use conditional dataflow and INPUT_PLUS
68 
69 
70 =head2 pipeline_create_commands
71 
72  Description : Implements pipeline_create_commands() interface method of Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf that lists the commands that will create and set up the Hive database.
73  In addition to the standard creation of the database and populating it with Hive tables and procedures it also creates two pipeline-specific tables used by Runnables to communicate.
74 
75 =cut
76 
77 sub pipeline_create_commands {
78  my ($self) = @_;
79  return [
80  @{$self->SUPER::pipeline_create_commands}, # inheriting database and hive tables' creation
81 
82  # additional tables needed for long multiplication pipeline's operation:
83  $self->db_cmd('CREATE TABLE final_result (a_multiplier varchar(40) NOT NULL, b_multiplier varchar(40) NOT NULL, result varchar(80) NOT NULL, PRIMARY KEY (a_multiplier, b_multiplier))'),
84  ];
85 }
86 
87 
88 =head2 pipeline_wide_parameters
89 
90  Description : Interface method that should return a hash of pipeline_wide_parameter_name->pipeline_wide_parameter_value pairs.
91  The value doesn't have to be a scalar, can be any Perl structure now (will be stringified and de-stringified automagically).
92  Please see existing PipeConfig modules for examples.
93 
94 =cut
95 
96 sub pipeline_wide_parameters {
97  my ($self) = @_;
98  return {
99  %{$self->SUPER::pipeline_wide_parameters}, # here we inherit anything from the base class
100 
101  'take_time' => 1,
102  };
103 }
104 
105 
106 sub pipeline_analyses {
107  my ($self) = @_;
108  return [
109  { -logic_name => 'take_b_apart',
111  -meadow_type=> 'LOCAL', # do not bother the farm with such a simple task (and get it done faster)
112  -analysis_capacity => 2, # use per-analysis limiter
113  -input_ids => [
114  { 'a_multiplier' => '9650156169', 'b_multiplier' => '327358788' },
115  { 'a_multiplier' => '327358788', 'b_multiplier' => '9650156169' },
116  ],
117  -flow_into => {
118  # A WHEN block is not a hash, so multiple occurences of each condition (including ELSE) are permitted.
119  2 => WHEN(
120  '#digit#>1' => { $self->o('server_url').'?logic_name=part_multiply' => INPUT_PLUS( {'digit' => '#digit#', 'take_time' => '#take_time#'} ) },
121  ),
122  1 => [ 'add_together' ],
123  },
124  },
125 
126  #
127  # 'take_b_apart' seeds an externally looping "server" pipeline which will put results into its local 'intermediate_result' table and unblock 'add_together'
128  #
129 
130  { -logic_name => 'add_together',
132  -parameters => {
133  'intermediate_table_url' => $self->o('server_url').'?table_name=intermediate_result',
134  },
135  -wait_for => [ $self->o('server_url').'?logic_name=part_multiply' ],
136  -flow_into => {
137  1 => [ '?table_name=final_result' ],
138  },
139  },
140  ];
141 }
142 
143 1;
144 
Bio::EnsEMBL::Hive::Examples::LongMult::PipeConfig::LongMultWfClient_conf
Definition: LongMultWfClient_conf.pm:44
Bio::EnsEMBL::Hive::Examples::LongMult::RunnableDB::DigitFactory
Definition: DigitFactory.pm:25
Bio::EnsEMBL::Hive::Version
Definition: Version.pm:19
Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf
Definition: HiveGeneric_conf.pm:54
Bio::EnsEMBL::Hive
Definition: Hive.pm:38
Bio::EnsEMBL::Hive::Examples::LongMult::RunnableDB::AddTogether
Definition: AddTogether.pm:21
Bio
Definition: AltAlleleGroup.pm:4
Bio::EnsEMBL::Hive::Examples::LongMult::PipeConfig::LongMultWfServer_conf
Definition: LongMultWfServer_conf.pm:44