Commit ad756fa6 authored by Leo Gordon's avatar Leo Gordon
Browse files

parametrically slow down the LongMult test pipeline using -take_time global parameter

parent 763428b5
......@@ -75,6 +75,8 @@ sub default_options {
'first_mult' => '9650156169', # the actual numbers to be multiplied can also be specified from the command line
'second_mult' => '327358788',
'take_time' => 0, # how much time (in seconds) should each job take -- to slow things down
};
}
......@@ -98,6 +100,24 @@ sub pipeline_create_commands {
}
=head2 pipeline_wide_parameters
Description : Interface method that should return a hash of pipeline_wide_parameter_name->pipeline_wide_parameter_value pairs.
The value doesn't have to be a scalar, can be any Perl structure now (will be stringified and de-stringified automagically).
Please see existing PipeConfig modules for examples.
=cut
sub pipeline_wide_parameters {
my ($self) = @_;
return {
%{$self->SUPER::pipeline_wide_parameters}, # here we inherit anything from the base class
'take_time' => $self->o('take_time'),
};
}
=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.
......
......@@ -33,6 +33,8 @@ use base ('Bio::EnsEMBL::Hive::Process');
param('b_multiplier'): The second long number (also a string of digits).
param('take_time'): How much time to spend sleeping (seconds).
=cut
sub fetch_input { # fetch all the (relevant) precomputed products
......@@ -64,6 +66,8 @@ sub run { # call the function that will compute the stuff
my $product_pair = $self->param('product_pair');
$self->param('result', _add_together($b_multiplier, $product_pair));
sleep( $self->param('take_time') );
}
=head2 write_output
......
......@@ -42,6 +42,8 @@ sub fetch_input {
param('digit'): A decimal digit that is a part of the second multiplier.
param('take_time'): How much time to spend sleeping (seconds).
=cut
sub run { # call the recursive function that will compute the stuff
......@@ -52,7 +54,7 @@ sub run { # call the recursive function that will compute the stuff
$self->param('result', _rec_multiply($a_multiplier, $digit, 0) || 0);
sleep(1); # slow it down a little
sleep( $self->param('take_time') );
}
=head2 write_output
......
......@@ -37,6 +37,8 @@ use base ('Bio::EnsEMBL::Hive::Process');
param('b_multiplier'): The second long number (also a string of digits).
param('take_time'): How much time to spend sleeping (seconds).
=cut
sub fetch_input {
......@@ -58,16 +60,21 @@ sub fetch_input {
$self->param('output_ids', \@output_ids);
}
=head2 run
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).
Here we don't have any real work to do, just input and output, so run() remains empty.
Here we don't have any real work to do, just input and output, so run() just spends some time waiting.
=cut
sub run {
my $self = shift @_;
sleep( $self->param('take_time') );
}
=head2 write_output
Description : Implements write_output() interface method of Bio::EnsEMBL::Hive::Process that is used to deal with job's output after the execution.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment