From 5304bc3ff85d98dc99c8279910daf47b893e8289 Mon Sep 17 00:00:00 2001
From: Jessica Severin <jessica@ebi.ac.uk>
Date: Thu, 13 Jan 2005 13:57:57 +0000
Subject: [PATCH] added method reset_job which can be used to hard reset a job
 so it can run again. Initially used to manually re-run a job with
 runWorker.pl -job_id

---
 .../Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm b/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
index b5b34fc97..4d6a8080c 100644
--- a/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
+++ b/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
@@ -447,6 +447,21 @@ sub reset_dead_jobs_for_worker {
 }
 
 
+sub reset_job {
+  my $self = shift;
+  my $job   = shift;
+  throw("must define job") unless($job);
+
+  my ($sql, $sth);
+  #first just reset the claimed jobs, these don't need a retry_count index increment
+  $sql = "UPDATE analysis_job SET job_claim='', status='READY' WHERE analysis_job_id=?";
+  $sth = $self->prepare($sql);
+  $sth->execute($job->dbID);
+  $sth->finish;
+  #print("  done update CLAIMED\n");
+}
+
+
 1;
 
 
-- 
GitLab