Skip to content
Snippets Groups Projects
Commit 743d8d55 authored by Leo Gordon's avatar Leo Gordon
Browse files

API change : AJA::fetch_all_by_analysis_id_status now takes an optional $list_of_analyses argument

parent c250fa3c
No related branches found
No related tags found
No related merge requests found
...@@ -138,21 +138,29 @@ sub store_jobs_and_adjust_counters { ...@@ -138,21 +138,29 @@ sub store_jobs_and_adjust_counters {
=head2 fetch_all_by_analysis_id_status =head2 fetch_all_by_analysis_id_status
Arg [1] : (optional) int $analysis_id Arg [1] : (optional) listref $list_of_analyses
Arg [2] : (optional) string $status Arg [2] : (optional) string $status
Arg [3] : (optional) int $retry_at_least Arg [3] : (optional) int $retry_at_least
Example : $all_failed_jobs = $adaptor->fetch_all_by_analysis_id_status(undef, 'FAILED'); Example : $all_failed_jobs = $adaptor->fetch_all_by_analysis_id_status(undef, 'FAILED');
$analysis_done_jobs = $adaptor->fetch_all_by_analysis_id_status($analysis->dbID, 'DONE'); $analysis_done_jobs = $adaptor->fetch_all_by_analysis_id_status( $list_of_analyses, 'DONE');
Description: Returns a list of all jobs filtered by given analysis_id (if specified) and given status (if specified). Description: Returns a list of all jobs filtered by given analysis_id (if specified) and given status (if specified).
Returntype : reference to list of Bio::EnsEMBL::Hive::AnalysisJob objects Returntype : reference to list of Bio::EnsEMBL::Hive::AnalysisJob objects
=cut =cut
sub fetch_all_by_analysis_id_status { sub fetch_all_by_analysis_id_status {
my ($self, $analysis_id, $status, $retry_count_at_least) = @_; my ($self, $list_of_analyses, $status, $retry_count_at_least) = @_;
my @constraints = (); my @constraints = ();
push @constraints, "analysis_id=$analysis_id" if ($analysis_id);
if($list_of_analyses) {
if(ref($list_of_analyses) eq 'ARRAY') {
push @constraints, "analysis_id IN (".(join(',', map {$_->dbID} @$list_of_analyses)).")";
} else {
push @constraints, "analysis_id=$list_of_analyses"; # for compatibility with old interface
}
}
push @constraints, "status='$status'" if ($status); push @constraints, "status='$status'" if ($status);
push @constraints, "retry_count >= $retry_count_at_least" if ($retry_count_at_least); push @constraints, "retry_count >= $retry_count_at_least" if ($retry_count_at_least);
......
...@@ -275,7 +275,7 @@ sub main { ...@@ -275,7 +275,7 @@ sub main {
if($show_failed_jobs) { if($show_failed_jobs) {
print("===== failed jobs\n"); print("===== failed jobs\n");
my $failed_job_list = $self->{'dba'}->get_AnalysisJobAdaptor->fetch_all_by_analysis_id_status($analysis && $analysis->dbID, 'FAILED'); my $failed_job_list = $self->{'dba'}->get_AnalysisJobAdaptor->fetch_all_by_analysis_id_status( $self->{'logic_name'} and $list_of_analyses , 'FAILED');
foreach my $job (@{$failed_job_list}) { foreach my $job (@{$failed_job_list}) {
print $job->toString. "\n"; print $job->toString. "\n";
......
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