ensembl-hive  2.7.0
RunListOfCommandsOnFarm_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::Factories::PipeConfig::RunListOfCommandsOnFarm_conf -password <your_password> -inputfile file_with_cmds.txt
10 
11 =head1 DESCRIPTION
12 
13  This is an example pipeline put together from basic building blocks:
14 
15  Analysis_1: JobFactory.pm is used to turn the list of commands in a file into jobs
16 
17  these jobs are sent down the branch #2 into the second analysis
18 
19  Analysis_2: SystemCmd.pm is used to run these jobs in parallel.
20 
21 =head1 LICENSE
22 
23  See the NOTICE file distributed with this work for additional information
24  regarding copyright ownership.
25 
26  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
27  You may obtain a copy of the License at
28 
29  http://www.apache.org/licenses/LICENSE-2.0
30 
31  Unless required by applicable law or agreed to in writing, software distributed under the License
32  is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33  See the License for the specific language governing permissions and limitations under the License.
34 
35 =head1 CONTACT
36 
37  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
38 
39 =cut
40 
41 
42 package Bio::EnsEMBL::Hive::Examples::Factories::PipeConfig::RunListOfCommandsOnFarm_conf;
43 
44 use strict;
45 use warnings;
46 
47 use base ('Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf'); # All Hive databases configuration files should inherit from HiveGeneric, directly or indirectly
48 
49 =head2 default_options
50 
51  Description : Implements default_options() interface method of Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf that is used to initialize default options.
52  In addition to the standard things it defines three options:
53  o('capacity') defines how many files can be run in parallel
54 
55  There are rules dependent on two options that do not have defaults (this makes them mandatory):
56  o('password') your read-write password for creation and maintenance of the hive database
57  o('inputfile') name of the inputfile where the commands are
58 
59 =cut
60 
61 sub default_options {
62  my ($self) = @_;
63  return {
64  %{ $self->SUPER::default_options() }, # inherit other stuff from the base class
65 
66  'pipeline_name' => 'ifile_syscmd', # name used by the beekeeper to prefix job names on the farm
67 
68  'capacity' => 100, # how many commands can be run in parallel
69  };
70 }
71 
72 
73 =head2 pipeline_analyses
74 
75  Description : Implements pipeline_analyses() interface method of Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf that defines the structure of the pipeline: analyses, jobs, rules, etc.
76  Here it defines two analyses:
77 
78  * 'create_jobs' reads commands line-by-line from inputfile
79  Each job of this analysis will dataflow (create jobs) via branch #2 into 'run_cmd' analysis.
80 
81  * 'run_cmd' actually runs the commands in parallel
82 
83 =cut
84 
85 sub pipeline_analyses {
86  my ($self) = @_;
87  return [
88  { -logic_name => 'create_jobs',
89  -module => 'Bio::EnsEMBL::Hive::RunnableDB::JobFactory',
90  -parameters => {
91  'column_names' => [ 'cmd' ],
92  },
93  -input_ids => [
94  { 'inputfile' => $self->o('inputfile') }, # A new file-with-commands could be loaded at each -topup_jobs execution of init_pipeline
95  ],
96  -flow_into => {
97  2 => [ 'run_cmd' ], # will create a fan of jobs
98  },
99  },
100 
101  { -logic_name => 'run_cmd',
102  -module => 'Bio::EnsEMBL::Hive::RunnableDB::SystemCmd',
103  -parameters => { },
104  -analysis_capacity => $self->o('capacity'), # allow several workers to perform identical tasks in parallel
105  },
106  ];
107 }
108 
109 1;
110 
Bio::EnsEMBL::Hive::Version
Definition: Version.pm:19
run
public run()
Bio::EnsEMBL::Hive::Examples::Factories::PipeConfig::RunListOfCommandsOnFarm_conf
Definition: RunListOfCommandsOnFarm_conf.pm:24
Bio::EnsEMBL::Hive
Definition: Hive.pm:38
Bio
Definition: AltAlleleGroup.pm:4