15 This is an example framework to
run queries against databases whose names have been fetched from server:
17 Analysis_1: JobFactory.pm is used to turn the list of databases on a particular mysql instance into jobs
19 these jobs are sent down the branch #2 into the second analysis
21 Analysis_2: Use SqlCmd.pm to
run queries directly or another JobFactory.pm
if you need a further fan on tables.
25 See the NOTICE file distributed with
this work
for additional information
26 regarding copyright ownership.
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
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.
39 Please subscribe to the
Hive mailing list: http:
44 package Bio::EnsEMBL::Hive::Examples::Factories::PipeConfig::ApplyToDatabases_conf;
48 use base (
'Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf'); # All
Hive databases configuration files should inherit from HiveGeneric, directly or indirectly
53 %{ $self->SUPER::default_options() }, # inherit other stuff from the base
class
55 'pipeline_name' =>
'apply_to_databases', # name used by the beekeeper to prefix job names on the farm
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/',
60 'only_databases' =>
'%\_core\_%', # use
'%' to get a list of all available databases
64 sub pipeline_analyses {
67 { -logic_name =>
'get_databases',
68 -module =>
'Bio::EnsEMBL::Hive::RunnableDB::JobFactory',
70 'inputquery' => q{SHOW DATABASES LIKE
"}.$self->o('only_databases').q{"},
71 'column_names' => [
'dbname' ],
74 {
'db_conn' => $self->o(
'source_server1') },
75 {
'db_conn' => $self->o(
'source_server2') },
78 2 => {
'run_sql' => {
'db_conn' =>
'#db_conn##dbname#' },
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
87 -analysis_capacity => 10, # allow several workers to perform identical tasks in parallel
89 # (jobs for this analysis will be flown_into via branch-2 from 'get_databases' jobs above)