Skip to content

Commit

Permalink
Pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuwd committed Dec 19, 2024
1 parent fb55adc commit 78220f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions diracx-db/src/diracx/db/sql/job/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from datetime import datetime, timezone
from typing import TYPE_CHECKING, Any

from sqlalchemy import bindparam, delete, func, insert, select, update, case
from sqlalchemy import bindparam, case, delete, func, insert, select, update
from sqlalchemy.exc import IntegrityError, NoResultFound

if TYPE_CHECKING:
Expand Down Expand Up @@ -224,15 +224,18 @@ async def setJobAttributesBulk(self, jobData):
column: case(
*[
(Jobs.__table__.c.JobID == job_id, attrs[column])
for job_id, attrs in jobData.items() if column in attrs
for job_id, attrs in jobData.items()
if column in attrs
],
else_=getattr(Jobs.__table__.c, column) # Retain original value
else_=getattr(Jobs.__table__.c, column), # Retain original value
)
for column in columns
}

stmt = Jobs.__table__.update().values(**case_expressions).where(
Jobs.__table__.c.JobID.in_(jobData.keys())
stmt = (
Jobs.__table__.update()
.values(**case_expressions)
.where(Jobs.__table__.c.JobID.in_(jobData.keys()))
)
await self.conn.execute(stmt)

Expand Down
3 changes: 2 additions & 1 deletion diracx-db/src/diracx/db/sql/utils/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ def parse_jdl(job_id, job_jdl):
**attribute_changes[job_id],
**set_status_result.model_dump(),
}
for job_id, set_status_result in set_job_status_result.success.items() if job_id not in failed
for job_id, set_status_result in set_job_status_result.success.items()
if job_id not in failed
},
}

Expand Down

0 comments on commit 78220f1

Please sign in to comment.