Skip to content

Commit

Permalink
fix output discovery
Browse files Browse the repository at this point in the history
1. `primary_output_assigned` needs to be reset for each output

   lets say there are two outputs: `datasets` (a normal dataset)
   and `discovered` (discovered datasets). if `datasets` is
   processed after `discovered` then `primary_output_assigned`
   is still true from the first loop (where `discovered` was precessed).
   this leads to overwriting of info (e.g. name) of the `dataset` output
   (in the `if primary_output_assigned` branch at the end of the outer
   loop).

2. assign_primary_output must be obeyed for all outputs (not just the
   first).

   sticking to the above example, `assign_primary_output` would
   work only if `dataset` is processed after `discovered`
  • Loading branch information
bernt-matthias committed Jan 11, 2024
1 parent 181d5d2 commit f91e9be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/galaxy/job_execution/output_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,11 @@ def collect_primary_datasets(job_context: Union[JobContext, SessionlessJobContex

# Loop through output file names, looking for generated primary
# datasets in form specified by discover dataset patterns or in tool provided metadata.
primary_output_assigned = False
new_outdata_name = None
primary_datasets: Dict[str, Dict[str, Union[HistoryDatasetAssociation, LibraryDatasetDatasetAssociation]]] = {}
storage_callbacks: List[Callable] = []
for output_index, (name, outdata) in enumerate(output.items()):
for name, outdata in output.items():
primary_output_assigned = False
dataset_collectors = [DEFAULT_DATASET_COLLECTOR]
output_def = job_context.output_def(name)
if output_def is not None:
Expand All @@ -504,7 +504,7 @@ def collect_primary_datasets(job_context: Union[JobContext, SessionlessJobContex
dbkey = fields_match.dbkey
if dbkey == INPUT_DBKEY_TOKEN:
dbkey = job_context.input_dbkey
if filename_index == 0 and extra_file_collector.assign_primary_output and output_index == 0:
if filename_index == 0 and extra_file_collector.assign_primary_output:
new_outdata_name = fields_match.name or f"{outdata.name} ({designation})"
outdata.change_datatype(ext)
outdata.dbkey = dbkey
Expand Down

0 comments on commit f91e9be

Please sign in to comment.