ensembl-hive  2.7.0
ApplyToDatabases_conf.pm
Go to the documentation of this file.
1 =pod
2 
3 =head1 NAME
4 
6 
7 =head1 SYNOPSIS
8 
10 
11  init_pipeline.pl Bio::EnsEMBL::Hive::Examples::Factories::PipeConfig::ApplyToDatabases_conf -password <your_password> -only_databases '%'
12 
13 =head1 DESCRIPTION
14 
15  This is an example framework to run queries against databases whose names have been fetched from server:
16 
17  Analysis_1: JobFactory.pm is used to turn the list of databases on a particular mysql instance into jobs
18 
19  these jobs are sent down the branch #2 into the second analysis
20 
21  Analysis_2: Use SqlCmd.pm to run queries directly or another JobFactory.pm if you need a further fan on tables.
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::Factories::PipeConfig::ApplyToDatabases_conf;
45 
46 use strict;
47 use warnings;
48 use base ('Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf'); # All Hive databases configuration files should inherit from HiveGeneric, directly or indirectly
49 
50 sub default_options {
51  my ($self) = @_;
52  return {
53  %{ $self->SUPER::default_options() }, # inherit other stuff from the base class
54 
55  'pipeline_name' => 'apply_to_databases', # name used by the beekeeper to prefix job names on the farm
56 
57  'source_server1' => 'mysql://ensadmin:'.$self->o('password').'@127.0.0.1:3306/',
58  'source_server2' => 'mysql://ensadmin:'.$self->o('password').'@127.0.0.1:2914/',
59 
60  'only_databases' => '%\_core\_%', # use '%' to get a list of all available databases
61  };
62 }
63 
64 sub pipeline_analyses {
65  my ($self) = @_;
66  return [
67  { -logic_name => 'get_databases',
68  -module => 'Bio::EnsEMBL::Hive::RunnableDB::JobFactory',
69  -parameters => {
70  'inputquery' => q{SHOW DATABASES LIKE "}.$self->o('only_databases').q{"},
71  'column_names' => [ 'dbname' ],
72  },
73  -input_ids => [
74  { 'db_conn' => $self->o('source_server1') },
75  { 'db_conn' => $self->o('source_server2') },
76  ],
77  -flow_into => {
78  2 => { 'run_sql' => { 'db_conn' => '#db_conn##dbname#' },
79  }
80  },
81  },
82 
83  { -logic_name => 'run_sql',
84  -module => 'Bio::EnsEMBL::Hive::RunnableDB::Dummy', # use SqlCmd.pm to run your query or another JobFactory.pm to make another fan on table names
85  -parameters => {
86  },
87  -analysis_capacity => 10, # allow several workers to perform identical tasks in parallel
88  -input_ids => [
89  # (jobs for this analysis will be flown_into via branch-2 from 'get_databases' jobs above)
90  ],
91  },
92  ];
93 }
94 
95 1;
96 
Bio::EnsEMBL::Hive::Version
Definition: Version.pm:19
run
public run()
Bio::EnsEMBL::Hive::Examples::Factories::PipeConfig::ApplyToDatabases_conf
Definition: ApplyToDatabases_conf.pm:15
Bio::EnsEMBL::Hive
Definition: Hive.pm:38