Skip to content

Commit

Permalink
Merge branch 'release_24.1' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Jun 19, 2024
2 parents 205f58a + 08d42ea commit 3845d5e
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 25 deletions.
19 changes: 14 additions & 5 deletions client/src/components/Workflow/Editor/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,15 @@ export default {
}
const tags = ref([]);
watch(
() => props.workflowTags,
(newTags) => {
tags.value = [...newTags];
},
{ immediate: true }
);
const setTagsHandler = new SetValueActionHandler(
undoRedoStore,
(value) => (tags.value = structuredClone(value)),
Expand Down Expand Up @@ -792,12 +801,9 @@ export default {
this.report.markdown = markdown;
},
onRun() {
const runUrl = `/workflows/run?id=${this.id}${
this.version !== undefined ? `&version=${this.version}` : ""
}`;
this.onNavigate(runUrl);
this.onNavigate(`/workflows/run?id=${this.id}`, false, false, true);
},
async onNavigate(url, forceSave = false, ignoreChanges = false) {
async onNavigate(url, forceSave = false, ignoreChanges = false, appendVersion = false) {
if (this.isNewTempWorkflow) {
await this.onCreate();
} else if (this.hasChanges && !forceSave && !ignoreChanges) {
Expand All @@ -810,6 +816,9 @@ export default {
await this.onSave();
}
if (appendVersion && this.version !== undefined) {
url += `&version=${this.version}`;
}
this.hasChanges = false;
await nextTick();
this.$router.push(url);
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/Workflow/Editor/SaveChangesModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const busy = ref(false);
const emit = defineEmits<{
/** Proceed with or without saving the changes */
(e: "on-proceed", url: string, forceSave: boolean, ignoreChanges: boolean): void;
(e: "on-proceed", url: string, forceSave: boolean, ignoreChanges: boolean, appendVersion: boolean): void;
/** Update the nav URL prop */
(e: "update:nav-url", url: string): void;
/** Update the show modal boolean prop */
Expand All @@ -49,13 +49,13 @@ function closeModal() {
function dontSave() {
busy.value = true;
emit("on-proceed", props.navUrl, false, true);
emit("on-proceed", props.navUrl, false, true, true);
}
function saveChanges() {
busy.value = true;
closeModal();
emit("on-proceed", props.navUrl, true, false);
emit("on-proceed", props.navUrl, true, false, true);
}
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</details>
<ParameterStep
v-else-if="workflowStepType == 'parameter_input'"
:parameters="[invocation.input_step_parameters[stepDetails.workflow_step_label]]" />
:parameters="[getParamInput(stepDetails)]" />
<GenericHistoryItem
v-else-if="
isDataStep &&
Expand Down Expand Up @@ -209,6 +209,11 @@ export default {
this.fetchWorkflowForInstanceId(this.workflowStep.workflow_id);
}
},
getParamInput(stepDetails) {
return Object.values(this.invocation.input_step_parameters).find(
(param) => param.workflow_step_id === stepDetails.workflow_step_id
);
},
showJob(id) {
this.$emit("show-job", id);
},
Expand Down
2 changes: 1 addition & 1 deletion client/src/entry/analysis/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ export function getRouter(Galaxy) {
props: (route) => ({
invocationId: route.params.invocationId,
isFullPage: true,
fromPanel: route.query.from_panel,
fromPanel: Boolean(route.query.from_panel),
}),
},
{
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8922,7 +8922,7 @@ def to_dict(self, view="collection", value_mapper=None, step_details=False, lega
for input_step_parameter in self.input_step_parameters:
label = input_step_parameter.workflow_step.label
if not label:
continue
label = f"{input_step_parameter.workflow_step.order_index + 1}: Unnamed parameter"
input_parameters[label] = {
"parameter_value": input_step_parameter.parameter_value,
"label": label,
Expand Down
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 @@ -1058,19 +1062,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
8 changes: 7 additions & 1 deletion lib/galaxy/tool_util/parser/output_collection_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
10 changes: 6 additions & 4 deletions lib/galaxy/tool_util/xsd/galaxy.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
52 changes: 52 additions & 0 deletions test/functional/tools/discover_default_ext.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<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 change: 1 addition & 0 deletions test/functional/tools/sample_tool_conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
14 changes: 14 additions & 0 deletions test/unit/app/tools/test_collect_primary_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,20 @@ def test_collect_multiple_recurse_dict(self):
created_hda_3 = datasets[DEFAULT_TOOL_OUTPUT]["test3"]
assert_created_with_path(self.app.object_store, created_hda_3.dataset, path3)

def test_collect_collection_default_format(self):
self._replace_output_collectors(
"""<dataset_collection name="parent" format="abcdef">
<discover_datasets pattern="__name__" directory="subdir_for_name_discovery" sort_by="reverse_filename" />
</dataset_collection>"""
)
self._setup_extra_file(subdir="subdir_for_name_discovery", filename="test1")
self._setup_extra_file(subdir="subdir_for_name_discovery", filename="test2")

datasets = self._collect()
assert DEFAULT_TOOL_OUTPUT in datasets
for dataset in datasets[DEFAULT_TOOL_OUTPUT].values():
assert dataset.ext == "abcdef"

def test_collect_sorted_reverse(self):
self._replace_output_collectors(
"""<output>
Expand Down
6 changes: 4 additions & 2 deletions test/unit/app/tools/test_parameter_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,13 @@ def test_InRangeValidator(self):
)
p.validate(10)
with self.assertRaisesRegex(
ValueError, r"Parameter blah: Value \('15'\) must not fulfill float\('10'\) < float\(value\) <= float\('20'\)"
ValueError,
r"Parameter blah: Value \('15'\) must not fulfill float\('10'\) < float\(value\) <= float\('20'\)",
):
p.validate(15)
with self.assertRaisesRegex(
ValueError, r"Parameter blah: Value \('20'\) must not fulfill float\('10'\) < float\(value\) <= float\('20'\)"
ValueError,
r"Parameter blah: Value \('20'\) must not fulfill float\('10'\) < float\(value\) <= float\('20'\)",
):
p.validate(20)
p.validate(21)
Expand Down

0 comments on commit 3845d5e

Please sign in to comment.