ensembl-hive  2.6
Dummy.pm
Go to the documentation of this file.
1 =pod
2 
3 =head1 NAME
4 
6 
7 =head1 SYNOPSIS
8 
9  standaloneJob.pl Bio::EnsEMBL::Hive::RunnableDB::Dummy -input_id "{}"
10 
11  standaloneJob.pl Bio::EnsEMBL::Hive::RunnableDB::Dummy -input_id "{take_time=>3}"
12 
13  standaloneJob.pl Bio::EnsEMBL::Hive::RunnableDB::Dummy -input_id "{take_time=>'rand(3)+1'}"
14 
15 =head1 DESCRIPTION
16 
17  A job of 'Bio::EnsEMBL::Hive::RunnableDB::Dummy' analysis does not do any work by itself,
18  but it benefits from the side-effects that are associated with having an analysis.
19 
20  For example, if a dataflow rule is linked to the analysis then
21  every job that is created or flown into this analysis will be dataflown further according to this rule.
22 
23  param('take_time'): How much time to spend sleeping (floating point seconds);
24  can be given by a runtime-evaluated formula; useful for testing.
25 
26 =head1 LICENSE
27 
28  Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
29  Copyright [2016-2024] EMBL-European Bioinformatics Institute
30 
31  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
32  You may obtain a copy of the License at
33 
34  http://www.apache.org/licenses/LICENSE-2.0
35 
36  Unless required by applicable law or agreed to in writing, software distributed under the License
37  is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38  See the License for the specific language governing permissions and limitations under the License.
39 
40 =head1 CONTACT
41 
42  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
43 
44 =cut
45 
46 
47 package Bio::EnsEMBL::Hive::RunnableDB::Dummy;
48 
49 use strict;
50 use warnings;
51 use Time::HiRes ('usleep');
52 
53 use base ('Bio::EnsEMBL::Hive::Process');
54 
55 
56 =head2 param_defaults
57 
58  Description : Implements param_defaults() interface method of Bio::EnsEMBL::Hive::Process that defines module defaults for parameters.
59 
60 =cut
61 
62 sub param_defaults {
63 
64  return {
65  'take_time' => 0, # how much time run() method will spend in sleeping state
66  };
67 }
68 
69 
70 =head2 fetch_input
71 
72  Description : Implements fetch_input() interface method of Bio::EnsEMBL::Hive::Process that is used to read in parameters and load data.
73  Here we simply override this method so that nothing is done.
74 
75 =cut
76 
77 sub fetch_input {
78 }
79 
80 =head2 run
81 
82  Description : Implements run() interface method of Bio::EnsEMBL::Hive::Process that is used to perform the main bulk of the job (minus input and output).
83  Since this Runnable is a Dummy, it does nothing. But it can also optionally sleep for param('take_time') seconds.
84 
85 =cut
86 
87 sub run {
88  my $self = shift @_;
89 
90  my $take_time = eval $self->param('take_time');
91  if($take_time) {
92  $self->say_with_header("Sleeping for '$take_time' seconds...");
93  usleep( $take_time*1000000 );
94  $self->say_with_header("Done.");
95  }
96 }
97 
98 =head2 write_output
99 
100  Description : Implements write_output() interface method of Bio::EnsEMBL::Hive::Process that is used to deal with job's output after the execution.
101  Here we simply override this method so that nothing is done.
102 
103 =cut
104 
105 sub write_output {
106 }
107 
108 1;
Bio::EnsEMBL::Hive::RunnableDB::Dummy
Definition: Dummy.pm:28
Bio::EnsEMBL::Hive::Version
Definition: Version.pm:19
main
public main()
run
public run()
Bio::EnsEMBL::Hive
Definition: Hive.pm:38
Bio
Definition: AltAlleleGroup.pm:4