From 96d89f8643541a31ed9814d0afc904de897bc724 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 19 Mar 2024 19:26:33 +0100 Subject: [PATCH 1/2] Defer any_output_dataset_collection_instances_deleted and any_output_dataset_deleted These are only needed in https://github.com/mvdbeek/galaxy/blob/release_24.0/lib/galaxy/managers/jobs.py#L388-L389, no need to always load them up. --- lib/galaxy/model/__init__.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 337e5cf7791a..bdff421c3adb 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -11134,23 +11134,27 @@ def __repr__(self): # ---------------------------------------------------------------------------------------- # The following statements must not precede the mapped models defined above. -Job.any_output_dataset_collection_instances_deleted = column_property( - exists(HistoryDatasetCollectionAssociation.id).where( - and_( - Job.id == JobToOutputDatasetCollectionAssociation.job_id, - HistoryDatasetCollectionAssociation.id == JobToOutputDatasetCollectionAssociation.dataset_collection_id, - HistoryDatasetCollectionAssociation.deleted == true(), - ) +Job.any_output_dataset_collection_instances_deleted = deferred( + column_property( + exists(HistoryDatasetCollectionAssociation.id).where( + and_( + Job.id == JobToOutputDatasetCollectionAssociation.job_id, + HistoryDatasetCollectionAssociation.id == JobToOutputDatasetCollectionAssociation.dataset_collection_id, + HistoryDatasetCollectionAssociation.deleted == true(), + ) + ), ) ) -Job.any_output_dataset_deleted = column_property( - exists(HistoryDatasetAssociation.id).where( - and_( - Job.id == JobToOutputDatasetAssociation.job_id, - HistoryDatasetAssociation.table.c.id == JobToOutputDatasetAssociation.dataset_id, - HistoryDatasetAssociation.table.c.deleted == true(), - ) +Job.any_output_dataset_deleted = deferred( + column_property( + exists(HistoryDatasetAssociation.id).where( + and_( + Job.id == JobToOutputDatasetAssociation.job_id, + HistoryDatasetAssociation.table.c.id == JobToOutputDatasetAssociation.dataset_id, + HistoryDatasetAssociation.table.c.deleted == true(), + ) + ), ) ) From b1042fc5bc5fed27b193742a28156bba0f8b34a1 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 19 Mar 2024 19:39:00 +0100 Subject: [PATCH 2/2] Just select the id instead of the whole model to access the id --- lib/galaxy/jobs/runners/pulsar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/jobs/runners/pulsar.py b/lib/galaxy/jobs/runners/pulsar.py index 45128847f55a..634e20675440 100644 --- a/lib/galaxy/jobs/runners/pulsar.py +++ b/lib/galaxy/jobs/runners/pulsar.py @@ -977,8 +977,8 @@ def __async_update(self, full_status): remote_job_id = full_status["job_id"] if len(remote_job_id) == 32: # It is a UUID - assign_ids = uuid in destination params... - stmt = select(model.Job).filter(model.Job.job_runner_external_id == remote_job_id) - galaxy_job_id = self.app.model.session.execute(stmt).scalar_one().id + stmt = select(model.Job.id).filter(model.Job.job_runner_external_id == remote_job_id) + galaxy_job_id = self.app.model.session.execute(stmt).scalar_one() else: galaxy_job_id = remote_job_id job, job_wrapper = self.app.job_manager.job_handler.job_queue.job_pair_for_id(galaxy_job_id)