Skip to content

Commit

Permalink
Record and list reference bundle inputs in job
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Feb 9, 2024
1 parent d53a14e commit de6d264
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
23 changes: 14 additions & 9 deletions lib/galaxy/managers/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,23 +901,24 @@ def inputs_recursive(input_params, param_values, depth=1, upgrade_messages=None)

for input in input_params.values():
if input.name in param_values:
input_value = param_values[input.name]
if input.type == "repeat":
for i in range(len(param_values[input.name])):
rval.extend(inputs_recursive(input.inputs, param_values[input.name][i], depth=depth + 1))
for i in range(len(input_value)):
rval.extend(inputs_recursive(input.inputs, input_value[i], depth=depth + 1))
elif input.type == "section":
# Get the value of the current Section parameter
rval.append(dict(text=input.name, depth=depth))
rval.extend(
inputs_recursive(
input.inputs,
param_values[input.name],
input_value,
depth=depth + 1,
upgrade_messages=upgrade_messages.get(input.name),
)
)
elif input.type == "conditional":
try:
current_case = param_values[input.name]["__current_case__"]
current_case = input_value["__current_case__"]
is_valid = True
except Exception:
current_case = None
Expand All @@ -929,7 +930,7 @@ def inputs_recursive(input_params, param_values, depth=1, upgrade_messages=None)
rval.extend(
inputs_recursive(
input.cases[current_case].inputs,
param_values[input.name],
input_value,
depth=depth + 1,
upgrade_messages=upgrade_messages.get(input.name),
)
Expand All @@ -948,12 +949,16 @@ def inputs_recursive(input_params, param_values, depth=1, upgrade_messages=None)
dict(
text=input.group_title(param_values),
depth=depth,
value=f"{len(param_values[input.name])} uploaded datasets",
value=f"{len(input_value)} uploaded datasets",
)
)
elif input.type == "data" or input.type == "data_collection":
elif (
input.type == "data"
or input.type == "data_collection"
or isinstance(input_value, model.HistoryDatasetAssociation)
):
value = []
for element in listify(param_values[input.name]):
for element in listify(input_value):
element_id = element.id
if isinstance(element, model.HistoryDatasetAssociation):
hda = element
Expand All @@ -977,7 +982,7 @@ def inputs_recursive(input_params, param_values, depth=1, upgrade_messages=None)
dict(
text=label,
depth=depth,
value=input.value_to_display_text(param_values[input.name]),
value=input.value_to_display_text(input_value),
notes=upgrade_messages.get(input.name, ""),
)
)
Expand Down
3 changes: 3 additions & 0 deletions lib/galaxy/tools/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
DataCollectionToolParameter,
DataToolParameter,
RuntimeValue,
SelectToolParameter,
)
from galaxy.tools.parameters.wrapped import (
LegacyUnprefixedDict,
Expand Down Expand Up @@ -283,6 +284,8 @@ def process_dataset(data, formats=None):
value.child_collection = new_collection
else:
value.collection = new_collection
elif isinstance(input, SelectToolParameter) and isinstance(value, HistoryDatasetAssociation):
input_datasets[prefixed_name] = value

tool.visit_inputs(param_values, visitor)
return input_datasets, all_permissions
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/tools/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def __populate_input_dataset_wrappers(self, param_dict, input_datasets):
if wrapper:
param_dict[name] = wrapper
continue
if not isinstance(param_dict_value, (DatasetFilenameWrapper, DatasetListWrapper)):
if not isinstance(param_dict_value, ToolParameterValueWrapper):
wrapper_kwds = dict(
datatypes_registry=self.app.datatypes_registry,
tool=self.tool,
Expand Down
4 changes: 0 additions & 4 deletions lib/galaxy/tools/parameters/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,10 +1028,6 @@ def from_json(self, value, trans, other_values=None, require_legal_value=True):
raise ParameterValueError(
"requires a value, but no legal values defined", self.name, is_dynamic=self.is_dynamic
)
# TODO: dataset security check ??
if dataset := history_item_dict_to_python(value, app=trans.app, name=self.name):
if dataset in legal_values:
return dataset
if isinstance(value, list):
if not self.multiple:
raise ParameterValueError(
Expand Down

0 comments on commit de6d264

Please sign in to comment.