Skip to content

Commit

Permalink
Ignore converted datasets in invalid input states
Browse files Browse the repository at this point in the history
Fixes a bug reported by @jennaj where using an input dataset from a history
import (which contains implicitly converted datasets in discarded state)
in an input that would require that exact same implicit conversion
would fail with `Job output deleted by user before job completed`.

This will make the whole implicit coversion system much more robust,
since we didn't even exclude datasets in error state, so as soon as one
conversion failed ... you'd be stuck.
  • Loading branch information
mvdbeek committed Sep 19, 2024
1 parent 95ca13d commit 16b8396
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4112,7 +4112,9 @@ class Dataset(Base, StorableObject, Serializable):

non_ready_states = (states.NEW, states.UPLOAD, states.QUEUED, states.RUNNING, states.SETTING_METADATA)
ready_states = tuple(set(states.__members__.values()) - set(non_ready_states))
valid_input_states = tuple(set(states.__members__.values()) - {states.ERROR, states.DISCARDED})
valid_input_states = tuple(
set(states.__members__.values()) - {states.ERROR, states.DISCARDED, states.FAILED_METADATA}
)
no_data_states = (states.PAUSED, states.DEFERRED, states.DISCARDED, *non_ready_states)
terminal_states = (
states.OK,
Expand Down Expand Up @@ -4543,6 +4545,7 @@ class DatasetInstance(RepresentById, UsesCreateAndUpdateTime, _HasTable):
creating_job_associations: List[Union[JobToOutputDatasetCollectionAssociation, JobToOutputDatasetAssociation]]
copied_from_history_dataset_association: Optional["HistoryDatasetAssociation"]
copied_from_library_dataset_dataset_association: Optional["LibraryDatasetDatasetAssociation"]
implicitly_converted_datasets: List["ImplicitlyConvertedDatasetAssociation"]

validated_states = DatasetValidatedState

Expand Down Expand Up @@ -4870,9 +4873,9 @@ def display_info(self):
def get_converted_files_by_type(self, file_type):
for assoc in self.implicitly_converted_datasets:
if not assoc.deleted and assoc.type == file_type:
if assoc.dataset:
return assoc.dataset
return assoc.dataset_ldda
item = assoc.dataset or assoc.dataset_ldda
if not item.deleted and item.state in Dataset.valid_input_states:
return item
return None

def get_converted_dataset_deps(self, trans, target_ext):
Expand Down

0 comments on commit 16b8396

Please sign in to comment.