Skip to content
Snippets Groups Projects
Commit 87fa2921 authored by Thomas Kluyver's avatar Thomas Kluyver Committed by Karim Ahmed
Browse files

Fix checking if jobs already running

parent cb8c5d80
No related branches found
No related tags found
1 merge request!836[Webservice] Check for unfinished corrections before launching a new one
...@@ -967,7 +967,7 @@ class ActionsServer: ...@@ -967,7 +967,7 @@ class ActionsServer:
# A correction is already running for this run # A correction is already running for this run
msg = Success.ALREADY_REQUESTED.format(proposal, runnr) msg = Success.ALREADY_REQUESTED.format(proposal, runnr)
logging.debug(msg) logging.debug(msg)
return msg return msg.encode()
with time_db_transaction(self.job_db, 'Insert request'): with time_db_transaction(self.job_db, 'Insert request'):
cur = self.job_db.execute( # 2 cur = self.job_db.execute( # 2
...@@ -1093,7 +1093,7 @@ class ActionsServer: ...@@ -1093,7 +1093,7 @@ class ActionsServer:
# A correction is already running for this run # A correction is already running for this run
msg = Success.ALREADY_REQUESTED.format(proposal, runnr) msg = Success.ALREADY_REQUESTED.format(proposal, runnr)
logging.debug(msg) logging.debug(msg)
return msg return msg.encode()
with time_db_transaction(self.job_db, 'Insert request'): with time_db_transaction(self.job_db, 'Insert request'):
cur = self.job_db.execute( cur = self.job_db.execute(
...@@ -1388,7 +1388,7 @@ class ActionsServer: ...@@ -1388,7 +1388,7 @@ class ActionsServer:
"INNER JOIN requests USING (req_id) " "INNER JOIN requests USING (req_id) "
"WHERE proposal = ? AND run = ? AND action = 'CORRECT' " "WHERE proposal = ? AND run = ? AND action = 'CORRECT' "
" AND slurm_jobs.finished = 0", (proposal, runnr) " AND slurm_jobs.finished = 0", (proposal, runnr)
) ).fetchone()
return row is not None return row is not None
@staticmethod @staticmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment