Skip to content

Commit 493cb18

Browse files
committed
Fix collection job state not preserved during history export/import
Fixes #20450 Two issues were causing collection job_state_summary to be lost: 1. Export filtering: Collections with state != "ok" were skipped during export due to using `break` instead of `continue`. This prevented error-state collections from being exported entirely. 2. Job association: During import, when restoring jobs with output collections, the HDCA's job reference was not being set. The job_state_summary property relies on this relationship to aggregate job states. Changes: - Remove state filter that skipped non-ok collections during export - Set HDCA.job during job import to restore the job state link
1 parent 8f35e5a commit 493cb18

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/galaxy/model/store/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,6 +1821,9 @@ def _connect_job_io(
18211821
output_hdca = _find_hdca(output_key)
18221822
if output_hdca:
18231823
imported_job.add_output_dataset_collection(output_name, output_hdca)
1824+
# Also set the HDCA's job reference so job_state_summary works
1825+
if output_hdca.job_id is None:
1826+
output_hdca.job = imported_job
18241827

18251828
def _normalize_job_parameters(
18261829
self,
@@ -2240,12 +2243,10 @@ def export_history(
22402243
collections = sa_session.scalars(stmt_hdca)
22412244

22422245
for collection in collections:
2243-
# filter this ?
2246+
# Skip unpopulated collections (they don't have all elements yet),
2247+
# but export all others regardless of state to preserve error states
22442248
if not collection.populated:
2245-
break
2246-
if collection.state != "ok":
2247-
break
2248-
2249+
continue
22492250
self.export_collection(collection, include_deleted=include_deleted)
22502251

22512252
# Write datasets' attributes to file.

0 commit comments

Comments
 (0)