From 012a10be495ad20a53ebab9cfde422c72d13b94a Mon Sep 17 00:00:00 2001 From: Lukas Forer Date: Thu, 21 Mar 2024 14:37:35 +0100 Subject: [PATCH] Revert deletion of parameters --- .../mapred/api/v2/admin/ArchiveJob.java | 3 --- .../mapred/api/v2/jobs/GetJobDetails.java | 3 --- .../cloudgene/mapred/cron/CleanUpTasks.java | 4 ---- .../mapred/database/ParameterDao.java | 23 ------------------- 4 files changed, 33 deletions(-) diff --git a/src/main/java/cloudgene/mapred/api/v2/admin/ArchiveJob.java b/src/main/java/cloudgene/mapred/api/v2/admin/ArchiveJob.java index 02f76320..e97c6f30 100644 --- a/src/main/java/cloudgene/mapred/api/v2/admin/ArchiveJob.java +++ b/src/main/java/cloudgene/mapred/api/v2/admin/ArchiveJob.java @@ -83,9 +83,6 @@ public Representation get() { job.setState(AbstractJob.STATE_RETIRED); dao.update(job); - ParameterDao parameterDao = new ParameterDao(getDatabase()); - parameterDao.deleteAllByJob(job); - if (externalWorkspace != null) { try { externalWorkspace.delete(job.getId()); diff --git a/src/main/java/cloudgene/mapred/api/v2/jobs/GetJobDetails.java b/src/main/java/cloudgene/mapred/api/v2/jobs/GetJobDetails.java index 520ec3bb..da456e1b 100644 --- a/src/main/java/cloudgene/mapred/api/v2/jobs/GetJobDetails.java +++ b/src/main/java/cloudgene/mapred/api/v2/jobs/GetJobDetails.java @@ -149,9 +149,6 @@ public Representation deleteJob(Representation entity) { job.setState(AbstractJob.STATE_DELETED); dao.update(job); - ParameterDao parameterDao = new ParameterDao(getDatabase()); - parameterDao.deleteAllByJob(job); - Settings settings = getSettings(); IExternalWorkspace externalWorkspace = null; diff --git a/src/main/java/cloudgene/mapred/cron/CleanUpTasks.java b/src/main/java/cloudgene/mapred/cron/CleanUpTasks.java index f3cb97e3..cdc10cf2 100644 --- a/src/main/java/cloudgene/mapred/cron/CleanUpTasks.java +++ b/src/main/java/cloudgene/mapred/cron/CleanUpTasks.java @@ -26,8 +26,6 @@ public class CleanUpTasks { public static int executeRetire(Database database, Settings settings) { JobDao dao = new JobDao(database); - ParameterDao parameterDao = new ParameterDao(database); - List oldJobs = dao.findAllNotifiedJobs(); int deleted = 0; @@ -57,8 +55,6 @@ public static int executeRetire(Database database, Settings settings) { dao.update(job); - parameterDao.deleteAllByJob(job); - log.info("Job " + job.getId() + " retired."); deleted++; diff --git a/src/main/java/cloudgene/mapred/database/ParameterDao.java b/src/main/java/cloudgene/mapred/database/ParameterDao.java index 6028b8b8..e6251463 100644 --- a/src/main/java/cloudgene/mapred/database/ParameterDao.java +++ b/src/main/java/cloudgene/mapred/database/ParameterDao.java @@ -183,29 +183,6 @@ public CloudgeneParameterOutput findById(int id) { } } - public boolean deleteAllByJob(AbstractJob job) { - try { - - StringBuilder sql = new StringBuilder(); - sql.append("delete "); - sql.append("from parameter "); - sql.append("where job_id = ?"); - - Object[] params = new Object[1]; - params[0] = job.getId(); - - update(sql.toString(), params); - - log.debug("delete all parameters by job_id '" + job.getId() + "' successful."); - - return true; - - } catch (SQLException e) { - log.error("delete all parameters by job_id '" + job.getId() + "' failed.", e); - return false; - } - } - class ParameterInputMapper implements IRowMapper { @Override