Skip to content
Snippets Groups Projects
Commit 7e9c6567 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Merge branch 'feat/check-websvc-db' into 'master'

Add script to check run in webservice DB

See merge request !831
parents 966273a1 c8e76463
No related branches found
No related tags found
1 merge request!831Add script to check run in webservice DB
"""Usage: check_run_status.py <proposal> <run>
e.g. check_run_status.py 3279 168
"""
import sqlite3
import sys
from config import webservice as config
proposal, run = sys.argv[1:3]
proposal = proposal.zfill(6)
run = int(run)
conn = sqlite3.connect(config['web-service']['job-db'])
req_cur = conn.execute("""
SELECT req_id, timestamp FROM requests
WHERE proposal = ? AND run = ? AND action = 'CORRECT'
""", (proposal, run))
for req_id, req_time in req_cur:
print(f"Request {req_id} at {req_time}")
for exec_id, karabo_id in conn.execute(
"SELECT exec_id, karabo_id FROM executions WHERE req_id = ?", (req_id,)
):
print(f"- {karabo_id}")
jobs_by_status = {}
for job_id, status in conn.execute(
"SELECT job_id, status FROM slurm_jobs WHERE exec_id = ?", (exec_id,)
):
jobs_by_status.setdefault(status, []).append(job_id)
for status, job_ids in sorted(jobs_by_status.items()):
print(f" {status}:", *job_ids)
print()
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