Unverified Commit 08d42ea2 authored by Nicola Soranzo's avatar Nicola Soranzo
Browse files

Merge branch 'release_24.0' into release_24.1

parents 98bffa17 d2aea97a
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@ from galaxy.util import (
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__)
@@ -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):
@@ -1058,19 +1062,21 @@ class JsonCollectedDatasetMatch:
        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):
+7 −1
Original line number Diff line number Diff line
@@ -34,7 +34,13 @@ def dataset_collector_descriptions_from_elem(elem, legacy=True):
    if num_discover_dataset_blocks == 0 and legacy:
        collectors = [DEFAULT_DATASET_COLLECTOR_DESCRIPTION]
    else:
        collectors = [dataset_collection_description(**e.attrib) for e in primary_dataset_elems]
        default_format = elem.attrib.get("format")
        collectors = []
        for e in primary_dataset_elems:
            description_attributes = e.attrib
            if default_format and "format" not in description_attributes and "ext" not in description_attributes:
                description_attributes["format"] = default_format
            collectors.append(dataset_collection_description(**description_attributes))

    return _validate_collectors(collectors)

+6 −4
Original line number Diff line number Diff line
@@ -5641,11 +5641,13 @@ The default is ``galaxy.json``.
  <xs:attributeGroup name="OutputCommon">
    <xs:attribute name="format" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">The short name for the output datatype.
The valid values for format can be found in
        <xs:documentation xml:lang="en"><![CDATA[
The short name for the output datatype. The valid values for format can be found in
[/config/datatypes_conf.xml.sample](https://github.com/galaxyproject/galaxy/blob/dev/config/datatypes_conf.xml.sample)
(e.g. ``format="pdf"`` or ``format="fastqsanger"``). For collections this is the default format for all included
elements. Note that the format specified here is ignored for discovered data sets.</xs:documentation>
(e.g. ``format="pdf"`` or ``format="fastqsanger"``). For collections this is the default
format for all included elements. Note that the format specified here is ignored for
discovered data sets on Galaxy versions prior to 24.0 and should be specified using the ``<discovered_data>`` tag set.
        ]]></xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="format_source" type="xs:string">
+52 −0
Original line number Diff line number Diff line
<tool id="discover_default_ext" name="discover_default_ext" version="0.1.0">
    <command><![CDATA[
echo 1 > 1.txt;
]]></command>
    <inputs />
    <outputs>
        <collection name="collection_with_default_ext" type="list" label="with default format" format="fasta">
            <discover_datasets pattern="__name_and_ext__" />
        </collection>
        <collection name="collection_default_ext_and_explicit_format" type="list" label="with default format and static element format" format="fasta">
            <discover_datasets pattern="__name__" format="txt" />
        </collection>
        <collection name="collection_default_ext_used" type="list" label="with default format and no override" format="fasta">
            <discover_datasets pattern="__name__" />
        </collection>
        <collection name="collection_without_default_ext" type="list" label="wihtout default ext, should be data">
            <discover_datasets pattern="__name__" />
        </collection>
    </outputs>
    <tests>
        <test expect_num_outputs="4">
            <output_collection name="collection_with_default_ext" type="list" count="1">
                <element name="1" ftype="txt">
                    <assert_contents>
                        <has_text text="1" />
                    </assert_contents>
                </element>
            </output_collection>
            <output_collection name="collection_default_ext_and_explicit_format" type="list" count="1">
                <element name="1.txt" ftype="txt">
                    <assert_contents>
                        <has_text text="1" />
                    </assert_contents>
                </element>
            </output_collection>
            <output_collection name="collection_default_ext_used" type="list" count="1">
                <element name="1.txt" ftype="fasta">
                    <assert_contents>
                        <has_text text="1" />
                    </assert_contents>
                </element>
            </output_collection>
            <output_collection name="collection_without_default_ext" type="list" count="1">
                <element name="1.txt" ftype="data">
                    <assert_contents>
                        <has_text text="1" />
                    </assert_contents>
                </element>
            </output_collection>
        </test>
    </tests>
</tool>
+1 −0
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@
  <tool file="collection_cat_group_tag.xml" />
  <tool file="collection_cat_group_tag_multiple.xml" />
  <tool file="discover_sort_by.xml" />
  <tool file="discover_default_ext.xml" />
  <tool file="expression_forty_two.xml" />
  <tool file="expression_pick_larger_file.xml" />
  <tool file="expression_parse_int.xml" />
Loading