RunListOfCommandsOnFarm_conf.pm 4.16 KB
Newer Older
1 2 3 4
=pod

=head1 NAME

5
    Bio::EnsEMBL::Hive::PipeConfig::RunListOfCommandsOnFarm_conf
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

=head1 SYNOPSIS

    init_pipeline.pl Bio::EnsEMBL::Hive::PipeConfig::RunListOfCommandsOnFarm_conf -password <your_password> -inputfile file_with_cmds.txt

=head1 DESCRIPTION

    This is an example pipeline put together from basic building blocks:

    Analysis_1: JobFactory.pm is used to turn the list of commands in a file into jobs

        these jobs are sent down the branch #2 into the second analysis

    Analysis_2: SystemCmd.pm is used to run these jobs in parallel.

21 22
=head1 LICENSE

23
    Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Matthieu Muffato's avatar
Matthieu Muffato committed
24
    Copyright [2016-2018] EMBL-European Bioinformatics Institute
25 26 27 28 29 30 31 32 33 34

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software distributed under the License
    is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and limitations under the License.

35 36
=head1 CONTACT

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 40

=cut

41

42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
package Bio::EnsEMBL::Hive::PipeConfig::RunListOfCommandsOnFarm_conf;

use strict;
use warnings;

use base ('Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf');  # All Hive databases configuration files should inherit from HiveGeneric, directly or indirectly

=head2 default_options

    Description : Implements default_options() interface method of Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf that is used to initialize default options.
                  In addition to the standard things it defines three options:
                    o('capacity')   defines how many files can be run in parallel
                
                  There are rules dependent on two options that do not have defaults (this makes them mandatory):
                    o('password')           your read-write password for creation and maintenance of the hive database
                    o('inputfile')          name of the inputfile where the commands are

=cut

sub default_options {
    my ($self) = @_;
    return {
        %{ $self->SUPER::default_options() },               # inherit other stuff from the base class

        'pipeline_name' => 'ifile_syscmd',                  # name used by the beekeeper to prefix job names on the farm

        'capacity'  => 100,                                 # how many commands can be run in parallel
    };
}


=head2 pipeline_analyses

    Description : Implements pipeline_analyses() interface method of Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf that defines the structure of the pipeline: analyses, jobs, rules, etc.
                  Here it defines two analyses:

                    * 'create_jobs'  reads commands line-by-line from inputfile
                      Each job of this analysis will dataflow (create jobs) via branch #2 into 'run_cmd' analysis.

                    * 'run_cmd'   actually runs the commands in parallel

=cut

sub pipeline_analyses {
    my ($self) = @_;
    return [
        {   -logic_name => 'create_jobs',
            -module     => 'Bio::EnsEMBL::Hive::RunnableDB::JobFactory',
            -parameters => {
                'column_names' => [ 'cmd' ],
            },
            -input_ids => [
                { 'inputfile' => $self->o('inputfile') },   # A new file-with-commands could be loaded at each -topup_jobs execution of init_pipeline
            ],
            -flow_into => {
                2 => [ 'run_cmd' ],   # will create a fan of jobs
            },
        },

        {   -logic_name    => 'run_cmd',
            -module        => 'Bio::EnsEMBL::Hive::RunnableDB::SystemCmd',
            -parameters    => { },
104
            -analysis_capacity => $self->o('capacity'),   # allow several workers to perform identical tasks in parallel
105 106 107 108 109 110
        },
    ];
}

1;