From 87fa292115a6bfabb4b06805b43890b43bce3a88 Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas.kluyver@xfel.eu>
Date: Wed, 19 Apr 2023 16:04:18 +0200
Subject: [PATCH] Fix checking if jobs already running

---
 webservice/webservice.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/webservice/webservice.py b/webservice/webservice.py
index 44d673f72..2663b27f4 100644
--- a/webservice/webservice.py
+++ b/webservice/webservice.py
@@ -967,7 +967,7 @@ class ActionsServer:
                 # A correction is already running for this run
                 msg = Success.ALREADY_REQUESTED.format(proposal, runnr)
                 logging.debug(msg)
-                return msg
+                return msg.encode()
 
             with time_db_transaction(self.job_db, 'Insert request'):
                 cur = self.job_db.execute(  # 2
@@ -1093,7 +1093,7 @@ class ActionsServer:
                 # A correction is already running for this run
                 msg = Success.ALREADY_REQUESTED.format(proposal, runnr)
                 logging.debug(msg)
-                return msg
+                return msg.encode()
 
             with time_db_transaction(self.job_db, 'Insert request'):
                 cur = self.job_db.execute(
@@ -1388,7 +1388,7 @@ class ActionsServer:
             "INNER JOIN requests USING (req_id) "
             "WHERE proposal = ? AND run = ? AND action = 'CORRECT' "
             "  AND slurm_jobs.finished = 0", (proposal, runnr)
-        )
+        ).fetchone()
         return row is not None
 
     @staticmethod
-- 
GitLab