From cca2727d0a6a5ef530636b9bee0439c02a1c89ab Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Wed, 6 Mar 2024 13:38:21 +0100
Subject: [PATCH] override _build_job_id_to_tools to stop using cache (create
 problems)

---
 backend/analysis/models.py | 35 ++---------------------------------
 1 file changed, 2 insertions(+), 33 deletions(-)

diff --git a/backend/analysis/models.py b/backend/analysis/models.py
index d4da135..3d42eb6 100644
--- a/backend/analysis/models.py
+++ b/backend/analysis/models.py
@@ -134,14 +134,7 @@ class Analysis(Invocation):
     class Meta:
         ordering = ["-create_time"]
 
-    @property
-    def job_id_to_tools_perso(self) -> Dict[str, dict]:
-        """Dict of job_id to wrapped tool."""
-        if getattr(self, "_job_id_to_tools", None) is None:
-            self._job_id_to_tools = self._build_job_id_to_tools_perso()
-        return self._job_id_to_tools
-
-    def _build_job_id_to_tools_perso(self) -> Dict[str, dict]:
+    def _build_job_id_to_tools(self) -> Dict[str, dict]:
         step_jobs_summary = self.galaxy_invocation.step_jobs_summary()
         job_id_to_tools = {}
         for step in step_jobs_summary:
@@ -153,8 +146,6 @@ class Analysis(Invocation):
             job_id_to_tools[job_id] = wrapped_tool
         return job_id_to_tools
 
-    @property
-    def detailed_step_jobs_summary_perso(self) -> List[dict]:
         """Retrive `step_jobs_summary` with details of tool used."""
         step_jobs_summary = self.galaxy_invocation.step_jobs_summary()
         detailed_jobs_summary = []
@@ -281,31 +272,9 @@ class Analysis(Invocation):
             prots.save()
 
     def set_stderr(self):
-        print(settings.DATABASES["default"]["ENGINE"])
-        print(settings.DATABASES["default"]["HOST"])
-        invo = self.galaxy_invocation
-        console.print(invo)
-
-        # step_jobs_summary = self.galaxy_invocation.step_jobs_summary()
-        # print(step_jobs_summary)
-        # job_id_to_tools = {}
-        # detailed_jobs_summary = []
-        # for step in step_jobs_summary:
-        #     detailed_step = step
-        #     job_id = step["id"]
-        #     job = self.workflow.galaxy_owner.obj_gi.jobs.get(job_id)
-        #     wrapped_tool = self.workflow.galaxy_owner.obj_gi.tools.get(
-        #         job.wrapped["tool_id"]
-        #     ).wrapped
-        #     console.print(wrapped_tool)
-        #     job_id_to_tools[job_id] = wrapped_tool
-        #     detailed_jobs_summary.append(detailed_step)
 
         if self.status == ERROR and self.stderr == "":
-            invo = self.galaxy_invocation
-            console.print(invo)
-            steps = self.detailed_step_jobs_summary_perso
-            
+            steps = self.detailed_step_jobs_summary
             for step in steps:
                 job_id = step["id"]
                 job = self.analysis_history.analysis_owner.obj_gi.jobs.get(
-- 
GitLab