Commit 6e515886 authored by Leo Gordon's avatar Leo Gordon
Browse files

drop fetch_all_by_from_analysis_id_and_branch_code() method and rely on...

drop fetch_all_by_from_analysis_id_and_branch_code() method and rely on AUTOLOADed BaseAdaptor's methods instead
parent 26400bb7
......@@ -164,11 +164,13 @@ sub dataflow_rules { # if ever set will prevent the Job from fetching rules f
my $branch_code = Bio::EnsEMBL::Hive::DBSQL::DataflowRuleAdaptor::branch_name_2_code($branch_name_or_code);
$self->{'_dataflow_rules'}{$branch_code} = shift if(@_);
if(@_) {
$self->{'_dataflow_rules'}{$branch_code} = shift @_;
}
$self->{'_dataflow_rules'} ||= $self->adaptor->db->get_DataflowRuleAdaptor->fetch_all_by_from_analysis_id_HASHED_FROM_branch_code( $self->analysis_id );
return $self->{'_dataflow_rules'}
? ( $self->{'_dataflow_rules'}{$branch_code} || [] )
: $self->adaptor->db->get_DataflowRuleAdaptor->fetch_all_by_from_analysis_id_and_branch_code($self->analysis_id, $branch_code);
return $self->{'_dataflow_rules'}{$branch_code} || [];
}
sub stdout_file {
......
......@@ -48,6 +48,7 @@ use Bio::EnsEMBL::Utils::Exception ('throw');
use Bio::EnsEMBL::Hive::DBSQL::AnalysisDataAdaptor;
use Bio::EnsEMBL::Hive::AnalysisJob;
use Bio::EnsEMBL::Hive::DBSQL::DataflowRuleAdaptor;
use Bio::EnsEMBL::Hive::Utils ('stringify');
use base ('Bio::EnsEMBL::Hive::DBSQL::ObjectAdaptor');
......@@ -553,8 +554,10 @@ sub release_and_age_job {
sub gc_dataflow {
my ($self, $analysis, $job_id, $branch_name) = @_;
unless(@{ $self->db->get_DataflowRuleAdaptor->fetch_all_by_from_analysis_id_and_branch_code($analysis->dbID, $branch_name) }) {
return 0; # no corresponding gc_dataflow rule has been defined
my $branch_code = Bio::EnsEMBL::Hive::DBSQL::DataflowRuleAdaptor::branch_name_2_code($branch_name);
unless( $self->db->get_DataflowRuleAdaptor->count_all_by_from_analysis_id_AND_branch_code($analysis->dbID, $branch_code) ) {
return 0; # just return if no corresponding gc_dataflow rule has been defined
}
my $job = $self->fetch_by_dbID($job_id);
......
......@@ -84,31 +84,5 @@ sub branch_name_2_code {
return defined($branch_code) ? $branch_code : die "Could not map the branch_name '$branch_name_or_code' to the internal code";
}
=head2 fetch_all_by_from_analysis_id_and_branch_code
Args : unsigned int $analysis_id, unsigned int $branch_code
Example : my @rules = @{$ruleAdaptor->fetch_all_by_from_analysis_id_and_branch_code($analysis_id, $branch_code)};
Description: searches database for rules with given from_analysis_id and branch_code
and returns all such rules in a list (by reference)
Returntype : reference to list of Bio::EnsEMBL::Hive::DataflowRule objects
Exceptions : none
Caller : Bio::EnsEMBL::Hive::AnalysisJob::dataflow_output_id
=cut
sub fetch_all_by_from_analysis_id_and_branch_code {
my ($self, $analysis_id, $branch_name_or_code) = @_;
return [] unless($analysis_id);
my $branch_code = $self->branch_name_2_code($branch_name_or_code);
my $constraint = "from_analysis_id=${analysis_id} AND branch_code=${branch_code}";
return $self->fetch_all($constraint);
}
1;
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