Skip to content

Commit

Permalink
Merge pull request #19494 from mvdbeek/prevent_trackster_conversion_j…
Browse files Browse the repository at this point in the history
…ob_cycling

[24.0] Prevent cycling through failing conversion jobs in trackster
  • Loading branch information
dannon authored Feb 4, 2025
2 parents 929a833 + 291dd45 commit 31c0eba
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4713,11 +4713,16 @@ def display_name(self):
def display_info(self):
return self.datatype.display_info(self)

def get_converted_files_by_type(self, file_type):
def get_converted_files_by_type(self, file_type, include_errored=False):
for assoc in self.implicitly_converted_datasets:
if not assoc.deleted and assoc.type == file_type:
item = assoc.dataset or assoc.dataset_ldda
if not item.deleted and item.state in Dataset.valid_input_states:
valid_states = (
(Dataset.states.ERROR, *Dataset.valid_input_states)
if include_errored
else Dataset.valid_input_states
)
if not item.deleted and item.state in valid_states:
return item
return None

Expand All @@ -4732,7 +4737,7 @@ def get_converted_dataset_deps(self, trans, target_ext):
depends_list = []
return {dep: self.get_converted_dataset(trans, dep) for dep in depends_list}

def get_converted_dataset(self, trans, target_ext, target_context=None, history=None):
def get_converted_dataset(self, trans, target_ext, target_context=None, history=None, include_errored=False):
"""
Return converted dataset(s) if they exist, along with a dict of dependencies.
If not converted yet, do so and return None (the first time). If unconvertible, raise exception.
Expand All @@ -4744,7 +4749,7 @@ def get_converted_dataset(self, trans, target_ext, target_context=None, history=
converted_dataset = self.get_metadata_dataset(target_ext)
if converted_dataset:
return converted_dataset
converted_dataset = self.get_converted_files_by_type(target_ext)
converted_dataset = self.get_converted_files_by_type(target_ext, include_errored=include_errored)
if converted_dataset:
return converted_dataset
deps = {}
Expand Down Expand Up @@ -4966,7 +4971,8 @@ def convert_dataset(self, trans, target_type):

# Get converted dataset; this will start the conversion if necessary.
try:
converted_dataset = self.get_converted_dataset(trans, target_type)
# Include errored datasets here, we let user chose to retry or view error
converted_dataset = self.get_converted_dataset(trans, target_type, include_errored=True)
except NoConverterException:
return self.conversion_messages.NO_CONVERTER
except ConverterDependencyException as dep_error:
Expand Down

0 comments on commit 31c0eba

Please sign in to comment.