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

Moved runnable checks into a separate method Analysis::get_compiled_module_name()

parent fd5f5221
......@@ -127,6 +127,21 @@ sub analysis_capacity {
}
sub get_compiled_module_name {
my $self = shift;
my $runnable_module_name = $self->module
or die "Analysis '".$self->logic_name."' does not have its 'module' defined";
eval "require $runnable_module_name";
die "The runnable module '$runnable_module_name' cannot be loaded or compiled:\n$@" if($@);
die "Problem accessing methods in '$runnable_module_name'. Please check that it inherits from Bio::EnsEMBL::Hive::Process and is named correctly.\n"
unless($runnable_module_name->isa('Bio::EnsEMBL::Hive::Process'));
return $runnable_module_name;
}
=head2 process
Arg [1] : none
......@@ -141,24 +156,9 @@ sub analysis_capacity {
sub process {
my $self = shift;
my $process_class = $self->module
or die "Analysis '".$self->logic_name."' does not have its 'module' defined";
if($process_class!~/::/) {
$process_class = 'Bio::EnsEMBL::Hive::Runnable::'.$process_class;
}
my $file = $process_class;
$file =~ s/::/\//g;
require "${file}.pm";
my $process_object = $process_class->new(
-db => $self->adaptor->db,
-input_id => '1',
-analysis => $self,
);
my $runnable_object = $self->get_compiled_module_name->new( -analysis => $self );
return $process_object;
return $runnable_object;
}
......
......@@ -420,12 +420,6 @@ sub run {
$rc_id = $rc->dbID();
}
## Module has to be compilable and accessible
eval "require $module;";
die "The module '$module' cannot be loaded.\n$@" if $@;
die "Problem accessing methods in '$module'. Please check that it inherits from Bio::EnsEMBL::Hive::Process and is named correctly.\n"
unless($module->isa('Bio::EnsEMBL::Hive::Process'));
if ($meadow_type and not exists $valley->available_meadow_hash()->{$meadow_type}) {
die "The meadow '$meadow_type' is currently not registered (analysis '$logic_name')\n";
}
......@@ -442,6 +436,7 @@ sub run {
-meadow_type => $meadow_type,
-analysis_capacity => $analysis_capacity,
);
$analysis->get_compiled_module_name(); # check if it compiles and is named correctly
$analysis_adaptor->store($analysis);
my $stats = Bio::EnsEMBL::Hive::AnalysisStats->new(
......
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