Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug (missing commit) + SA2.0 usage in model.Job.update_hdca_update_time_for_job #16777

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading