Skip to content

Commit

Permalink
Assign default data extension on discovered collection output
Browse files Browse the repository at this point in the history
They used to be persisted as null in the database prior to this change.
  • Loading branch information
mvdbeek committed Jun 13, 2024
1 parent dd171fe commit e5fca08
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lib/galaxy/model/store/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
from galaxy.util.hash_util import HASH_NAME_MAP

if TYPE_CHECKING:
from galaxy.job_execution.output_collect import (
DatasetCollector,
ToolMetadataDatasetCollector,
)
from galaxy.model.store import ModelExportStore

log = logging.getLogger(__name__)
Expand All @@ -50,7 +54,7 @@ class MaxDiscoveredFilesExceededError(ValueError):
pass


CollectorT = Any # TODO: setup an interface for these file collectors data classes.
CollectorT = Union["DatasetCollector", "ToolMetadataDatasetCollector"]


class ModelPersistenceContext(metaclass=abc.ABCMeta):
Expand Down Expand Up @@ -1056,19 +1060,21 @@ def name(self):
return self.as_dict.get("name")

@property
def dbkey(self):
return self.as_dict.get("dbkey", getattr(self.collector, "default_dbkey", "?"))
def dbkey(self) -> str:
return self.as_dict.get("dbkey", self.collector and self.collector.default_dbkey or "?")

@property
def ext(self):
return self.as_dict.get("ext", getattr(self.collector, "default_ext", "data"))
def ext(self) -> str:
return self.as_dict.get("ext", self.collector and self.collector.default_ext or "data")

@property
def visible(self):
def visible(self) -> bool:
try:
return self.as_dict["visible"].lower() == "visible"
except KeyError:
return getattr(self.collector, "default_visible", True)
if self.collector and self.collector.default_visible is not None:
return self.collector.default_visible
return True

@property
def link_data(self):
Expand Down

0 comments on commit e5fca08

Please sign in to comment.