Commit a3896369 authored by Alejandro Alvarez Ayllon's avatar Alejandro Alvarez Ayllon Committed by Maria Arsuaga Rios
Browse files

Try optimize query to cancel by user_dn

parent 8dfa1f02
......@@ -157,7 +157,9 @@ def _cancel_jobs(dn):
Cancel all jobs that belong to dn.
Returns the list of affected jobs ids.
"""
jobs = Session.query(Job.job_id).filter(Job.job_state.in_(JobActiveStates)).filter(Job.user_dn == dn)
jobs = Session.query(Job.job_id).filter(
Job.job_state.in_(JobActiveStates), Job.user_dn == dn, Job.job_finished == None
)
job_ids = map(lambda j: j[0], jobs)
try:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment