From 85959cdef92ca77d5dc5c0eaf181e8bb14df9f4b Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas@kluyver.me.uk>
Date: Thu, 23 Jun 2022 10:07:56 +0100
Subject: [PATCH] Update sqlite_view.py script

---
 webservice/sqlite_view.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/webservice/sqlite_view.py b/webservice/sqlite_view.py
index 29670a19f..8f9e4e6f1 100644
--- a/webservice/sqlite_view.py
+++ b/webservice/sqlite_view.py
@@ -16,11 +16,14 @@ proposal = args['proposal'].zfill(6)
 run = args['run']
 
 conn = sqlite3.connect(sqlite_fpath)
-c = conn.cursor()
 
-c.execute("SELECT * FROM jobs")
+c = conn.execute(
+    "SELECT status, elapsed, karabo_id, det_type, action FROM "
+    "slurm_jobs INNER JOIN executions USING (exec_id) "
+    "INNER JOIN requests USING (req_id) "
+    "WHERE proposal = ? AND run = ?",
+    (proposal, run)
+)
 
 for r in c.fetchall():
-    rid, jobid, db_proposal, db_run, status, time, _, _ = r
-    if db_proposal == proposal and db_run == run:
-        print(r)
+    print(r)
-- 
GitLab