Bio::EnsEMBL::Hive::RunnableDB
Test
Toolbar
Summary
Bio::EnsEMBL::Hive::RunnableDB::Test
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
my $db = Bio::EnsEMBL::DBAdaptor->new($locator);
my $repmask = Bio::EnsEMBL::Hive::RunnableDB::Dummy->new (
-db => $db,
-input_id => $input_id
-analysis => $analysis );
$repmask->fetch_input(); #reads from DB
$repmask->run();
$repmask->output();
$repmask->write_output(); #writes to DB
Description
This object is used to test failure of jobs in the hive system.
It is intended for development purposes only!!
It parses the analysis.parameters and analysis_job.input_id as
(string representing) hasrefs and extracts the divisor and the value.
If the modulo (value % divisor) is 0, the job will fail.
Methods
Methods description
Arg [1] : (optional) $divisor Example : $object->divisor($divisor); Example : $divisor = $object->divisor(); Description : Getter/setter for the divisor attribute Returntype : Exceptions : none Caller : general Status : Stable |
Implementation of the Bio::EnsEMBL::Hive::Process interface |
Implementation of the Bio::EnsEMBL::Hive::Process interface |
Arg [1] : (optional) $time_fetching Example : $object->time_fetching($time_fetching); Example : $time_fetching = $object->time_fetching(); Description : Getter/setter for the time_fetching attribute Returntype : Exceptions : none Caller : general Status : Stable |
Arg [1] : (optional) $time_running Example : $object->time_running($time_running); Example : $time_running = $object->time_running(); Description : Getter/setter for the time_running attribute Returntype : Exceptions : none Caller : general Status : Stable |
Arg [1] : (optional) $time_writting Example : $object->time_writting($time_writting); Example : $time_writting = $object->time_writting(); Description : Getter/setter for the time_writting attribute Returntype : Exceptions : none Caller : general Status : Stable |
Arg [1] : (optional) $value Example : $object->value($value); Example : $value = $object->value(); Description : Getter/setter for the value attribute Returntype : Exceptions : none Caller : general Status : Stable |
Implementation of the Bio::EnsEMBL::Hive::Process interface |
Methods code
sub divisor
{ my $self = shift;
if (@_) {
$self->{_divisor} = shift;
}
return $self->{_divisor}; } |
sub fetch_input
{ my $self = shift;
$self->divisor(2);
$self->value(1);
$self->time_fetching(0);
$self->time_running(0);
$self->time_writting(0);
$self->get_params($self->parameters);
$self->get_params($self->input_id);
sleep($self->time_fetching);
return 1; } |
sub get_params
{ my $self = shift;
my $param_string = shift;
return unless($param_string);
my $params = eval($param_string);
return unless($params);
if(defined($params->{'divisor'})) {
$self->divisor($params->{'divisor'});
}
if(defined($params->{'value'})) {
$self->value($params->{'value'});
}
if(defined($params->{'time_fetching'})) {
$self->time_fetching($params->{'time_fetching'});
}
if(defined($params->{'time_running'})) {
$self->time_running($params->{'time_running'});
}
if(defined($params->{'time_writting'})) {
$self->time_writting($params->{'time_writting'});
}
}
1; } |
sub run
{
my $self = shift;
sleep($self->time_running);
my $divisor = $self->divisor();
my $value = $self->value();
if (!$divisor or !defined($value)) {
die "Wrong parameters: divisor = $divisor and value = $value\n";
} elsif ($value % $divisor == 0) {
die "$value % $divisor is 0 => die!\n";
}
return 1; } |
sub time_fetching
{ my $self = shift;
if (@_) {
$self->{_time_fetching} = shift;
}
return $self->{_time_fetching}; } |
sub time_running
{ my $self = shift;
if (@_) {
$self->{_time_running} = shift;
}
return $self->{_time_running}; } |
sub time_writting
{ my $self = shift;
if (@_) {
$self->{_time_writting} = shift;
}
return $self->{_time_writting}; } |
sub value
{ my $self = shift;
if (@_) {
$self->{_value} = shift;
}
return $self->{_value}; } |
sub write_output
{ my $self = shift;
sleep($self->time_writting);
return 1; } |
General documentation
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _