Commit 60f1d5e5 authored by Leo Gordon's avatar Leo Gordon
Browse files

untangling a bit. Queen does not need to re-sync and beekeeper does not need to fetch

parent 2af05379
...@@ -141,8 +141,11 @@ sub create_new_worker { ...@@ -141,8 +141,11 @@ sub create_new_worker {
if($analysis_id) { if($analysis_id) {
die "When you specify -job_id, please omit both -logic_name and -analysis_id to avoid confusion\n"; die "When you specify -job_id, please omit both -logic_name and -analysis_id to avoid confusion\n";
} else { } else {
print "fetching job for job_id '$job_id'\n"; print "resetting and fetching job for job_id '$job_id'\n";
if($job = $self->reset_and_fetch_job_by_dbID($job_id)) {
my $job_adaptor = $self->db->get_AnalysisJobAdaptor;
$job_adaptor->reset_job_by_dbID($job_id);
if($job = $job_adaptor->fetch_by_dbID($job_id)) {
$analysis_id = $job->analysis_id; $analysis_id = $job->analysis_id;
} else { } else {
die "job_id '$job_id' could not be fetched from the database\n"; die "job_id '$job_id' could not be fetched from the database\n";
...@@ -350,36 +353,32 @@ sub check_in_worker { ...@@ -350,36 +353,32 @@ sub check_in_worker {
} }
=head2 reset_and_fetch_job_by_dbID =head2 reset_job_by_dbID_and_sync
Arg [1]: int $job_id Arg [1]: int $job_id
Example: Example:
my $job = $queen->reset_and_fetch_job_by_dbID($job_id); my $job = $queen->reset_job_by_dbID_and_sync($job_id);
Description: Description:
For the specified job_id it will fetch just that job, For the specified job_id it will fetch just that job,
reset it completely as if it has never run, and return it. reset it completely as if it has never run, and return it.
Specifying a specific job bypasses the safety checks, Specifying a specific job bypasses the safety checks,
thus multiple workers could be running the thus multiple workers could be running the
same job simultaneously (use only for debugging). same job simultaneously (use only for debugging).
Returntype : Returntype : none
Bio::EnsEMBL::Hive::AnalysisJob object
Exceptions : Exceptions :
Caller : beekeepers, runWorker.pl scripts Caller : beekeeper.pl
=cut =cut
sub reset_and_fetch_job_by_dbID { sub reset_job_by_dbID_and_sync {
my $self = shift; my ($self, $job_id) = @_;
my $job_id = shift;
my $jobDBA = $self->db->get_AnalysisJobAdaptor;
$jobDBA->reset_job_by_dbID($job_id);
my $job = $jobDBA->fetch_by_dbID($job_id); my $job_adaptor = $self->db->get_AnalysisJobAdaptor;
my $stats = $self->db->get_AnalysisStatsAdaptor->fetch_by_analysis_id($job->analysis_id); $job_adaptor->reset_job_by_dbID($job_id);
$self->synchronize_AnalysisStats($stats);
my $job = $job_adaptor->fetch_by_dbID($job_id);
return $job; my $stats = $self->db->get_AnalysisStatsAdaptor->fetch_by_analysis_id($job->analysis_id);
$self->synchronize_AnalysisStats($stats);
} }
......
...@@ -186,7 +186,7 @@ sub main { ...@@ -186,7 +186,7 @@ sub main {
} }
$current_meadow->submit_workers_max($submit_workers_max); $current_meadow->submit_workers_max($submit_workers_max);
if($reset_job_id) { $queen->reset_and_fetch_job_by_dbID($reset_job_id); } if($reset_job_id) { $queen->reset_job_by_dbID_and_sync($reset_job_id); }
if($job_id_for_output) { if($job_id_for_output) {
printf("===== job output\n"); printf("===== job output\n");
......
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