Skip to content

Commit

Permalink
Fix handling of collecting discovered but purged outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Jun 9, 2024
1 parent 64adb9d commit 0467e96
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
12 changes: 10 additions & 2 deletions lib/galaxy/job_execution/output_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ def collect_primary_datasets(job_context: Union[JobContext, SessionlessJobContex
outdata.designation = designation
outdata.dataset.external_filename = None # resets filename_override
# Move data from temp location to dataset location
job_context.object_store.update_from_file(outdata.dataset, file_name=filename, create=True)
if not outdata.dataset.purged:
job_context.object_store.update_from_file(outdata.dataset, file_name=filename, create=True)
primary_output_assigned = True
continue
if name not in primary_datasets:
Expand Down Expand Up @@ -554,6 +555,7 @@ def collect_primary_datasets(job_context: Union[JobContext, SessionlessJobContex
dataset_attributes=new_primary_datasets_attributes,
creating_job_id=job_context.get_job_id() if job_context else None,
storage_callbacks=storage_callbacks,
purged=outdata.dataset.purged,
)
# Associate new dataset with job
job_context.add_output_dataset_association(f"__new_primary_file_{name}|{designation}__", primary_data)
Expand All @@ -563,7 +565,13 @@ def collect_primary_datasets(job_context: Union[JobContext, SessionlessJobContex
if primary_output_assigned:
outdata.name = new_outdata_name
outdata.init_meta()
outdata.set_meta()
if not outdata.dataset.purged:
try:
outdata.set_meta()
except Exception:
# We don't want to fail here on a single "bad" discovered dataset
log.debug("set meta failed for %s", outdata, exc_info=True)
outdata.state = HistoryDatasetAssociation.states.FAILED_METADATA
outdata.set_peek()
outdata.discovered = True
sa_session = job_context.sa_session
Expand Down
7 changes: 6 additions & 1 deletion lib/galaxy/model/store/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def create_dataset(
creating_job_id=None,
output_name=None,
storage_callbacks=None,
purged=False,
):
tag_list = tag_list or []
sources = sources or []
Expand Down Expand Up @@ -190,7 +191,11 @@ def create_dataset(

if info is not None:
primary_data.info = info
if filename:

if purged:
primary_data.dataset.purged = True
primary_data.purged = True
if filename and not purged:
if storage_callbacks is None:
self.finalize_storage(
primary_data=primary_data,
Expand Down

0 comments on commit 0467e96

Please sign in to comment.