Skip to content

Commit

Permalink
Fix bug (missing commit) + SA2.0 usage in model.Job.update_hdca_updat…
Browse files Browse the repository at this point in the history
…e_time_for_job
  • Loading branch information
jdavcs committed Oct 2, 2023
1 parent 13d8342 commit 29ba66b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1860,26 +1860,29 @@ def to_dict(self, view="collection", system_details=False):

def update_hdca_update_time_for_job(self, update_time, sa_session, supports_skip_locked):
subq = (
sa_session.query(HistoryDatasetCollectionAssociation.id)
select(HistoryDatasetCollectionAssociation.id)
.join(ImplicitCollectionJobs)
.join(ImplicitCollectionJobsJobAssociation)
.filter(ImplicitCollectionJobsJobAssociation.job_id == self.id)
)
if supports_skip_locked:
subq = subq.with_for_update(skip_locked=True).subquery()
subq = subq.with_for_update(skip_locked=True)
subq = subq.subquery()
implicit_statement = (
HistoryDatasetCollectionAssociation.table.update()
.where(HistoryDatasetCollectionAssociation.table.c.id.in_(select(subq)))
update(HistoryDatasetCollectionAssociation)
.where(HistoryDatasetCollectionAssociation.id.in_(subq))
.values(update_time=update_time)
)
explicit_statement = (
HistoryDatasetCollectionAssociation.table.update()
.where(HistoryDatasetCollectionAssociation.table.c.job_id == self.id)
update(HistoryDatasetCollectionAssociation)
.where(HistoryDatasetCollectionAssociation.job_id == self.id)
.values(update_time=update_time)
)
sa_session.execute(explicit_statement)
if supports_skip_locked:
sa_session.execute(implicit_statement)
with transaction(sa_session):
sa_session.commit()
else:
conn = sa_session.connection(execution_options={"isolation_level": "SERIALIZABLE"})
with conn.begin() as trans:
Expand Down

0 comments on commit 29ba66b

Please sign in to comment.