3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
33 A pipeline to change MySQL engine
for all tables in a given database
37 Please email comments or questions to the
public Ensembl
38 developers list at <http:
40 Questions may also be sent to the Ensembl help desk at
45 package Bio::EnsEMBL::Hive::Examples::Factories::PipeConfig::ChangeMySQLEngine_conf;
50 use base (
'Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf');
53 =head2 default_options
55 Description : Implements default_options()
interface method of
Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf that is used to initialize default options.
56 In addition to the standard things it defines four options:
57 o('concurrent_jobs') defines how many tables can be worked on in parallel
64 %{$self->SUPER::default_options(@_)},
66 'concurrent_jobs' => 2, # how many tables can be worked on in parallel (too many will slow the process down)
70 =head2 pipeline_analyses
72 Description : Implements pipeline_analyses()
interface method of
Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf that defines the structure of the pipeline: analyses, jobs, rules, etc.
73 Here it defines two analyses:
75 * 'generate_job_list' generates a list of tables to be copied from master_db
77 * 'change_engine' changes table's engine into the target engine
81 sub pipeline_analyses {
84 { -logic_name =>
'generate_job_list',
85 -module =>
'Bio::EnsEMBL::Hive::RunnableDB::JobFactory',
87 'db_conn' =>
'#target_db#',
88 'inputquery' =>
"SELECT table_name, engine FROM information_schema.TABLES WHERE Engine != '#target_engine#' AND table_schema=DATABASE();",
92 'target_db' => $self->o(
'target_db'),
93 'target_engine' => $self->o(
'target_engine'),
97 -flow_into => { 2 => {
'change_engine' => INPUT_PLUS() } },
100 { -logic_name =>
'change_engine',
101 -module =>
'Bio::EnsEMBL::Hive::RunnableDB::SqlCmd',
103 'db_conn' =>
'#target_db#',
104 'sql' =>
"ALTER TABLE #table_name# ENGINE='#target_engine#'",
106 -hive_capacity => $self->o(
'concurrent_jobs'), # allow several workers to perform identical tasks in parallel